Skip to content

Azure provider crashes with TypeError on non-OpenAI models (Claude, etc.) #16328

@androolloyd

Description

@androolloyd

Bug

Using any non-OpenAI model under the azure provider (e.g. azure/claude-opus-4-6) crashes with:

TypeError: sdk.responses is not a function. (In 'sdk.responses(modelID)', 'sdk.responses' is undefined)

Root Cause

Azure Claude models in the models.dev catalog use npm: "@ai-sdk/anthropic" with endpoint https://${AZURE_RESOURCE_NAME}.services.ai.azure.com/anthropic/v1. The azure and azure-cognitive-services custom loaders unconditionally call sdk.responses(modelID), which only exists on @ai-sdk/azure and @ai-sdk/openai SDKs.

When the SDK is @ai-sdk/anthropic (has .chat() but no .responses()) or @ai-sdk/openai-compatible (has only .languageModel()), the call crashes.

Affected Models

Any Azure model with a model-level provider.npm override that isn't @ai-sdk/azure:

  • azure/claude-opus-4-6@ai-sdk/anthropic
  • azure/claude-opus-4-5@ai-sdk/anthropic
  • azure/claude-sonnet-4-5@ai-sdk/anthropic
  • azure/claude-haiku-4-5@ai-sdk/anthropic
  • azure/claude-opus-4-1@ai-sdk/anthropic

Fix

Guard sdk.responses with existence checks, falling back through sdk.chatsdk.languageModel:

if (sdk.responses) return sdk.responses(modelID)
if (sdk.chat) return sdk.chat(modelID)
return sdk.languageModel(modelID)

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions