FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(app): support anthropic models on azure cognitive services by uanandaraja · Pull Request #9000 · anomalyco/opencode · GitHub

fix(app): support anthropic models on azure cognitive services - #9000

Closed
uanandaraja wants to merge 2 commits into
anomalyco:devfrom
uanandaraja:anthropic-on-azure-cognitive-services
Closed

fix(app): support anthropic models on azure cognitive services#9000
uanandaraja wants to merge 2 commits into
anomalyco:devfrom
uanandaraja:anthropic-on-azure-cognitive-services

Conversation

uanandaraja commented Jan 17, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

When using Anthropic models (like claude-opus-4.5) via Azure Cognitive Services, the code was using @ai-sdk/azure SDK which tries to call sdk.responses(modelID). But @ai-sdk/azure doesn't support Anthropic models - Azure's Anthropic endpoint uses a different API structure that requires @ai-sdk/anthropic.

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one potentially related PR:

Related PR:

The PR #8566 could be worth reviewing to ensure there's no overlap with your current fix. The other results returned were the current PR itself (#9000) or unrelated feature PRs.

Copy link
Copy Markdown
Collaborator

/review

Copy link
Copy Markdown
Contributor

lgtm

uanandaraja force-pushed the anthropic-on-azure-cognitive-services branch from a6e242d to d1f8fc0 Compare January 19, 2026 02:29

Copy link
Copy Markdown
Contributor Author

are we good here? @rekram1-node

Copy link
Copy Markdown
Collaborator

I actually have a simpler solution if u wanna test it

Copy link
Copy Markdown
Collaborator

#9341

@uanandaraja try this?

uanandaraja commented Jan 19, 2026
edited
Loading

Copy link
Copy Markdown
Contributor Author

#9341

@uanandaraja try this

it says RESOURCE NOT FOUND, different env variable?

Copy link
Copy Markdown
Collaborator

Hm may need a tweak but do you see what I'm trying to do? everything should live in that one module it shouldnt require edits outside of it

},
)

// Azure Cognitive Services with Claude models uses Anthropic SDK

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

this change shouldnt be needed


export function providerOptions(model: Provider.Model, options: { [x: string]: any }) {
// Azure Cognitive Services with Claude models uses Anthropic provider options
const isAzureClaude = model.providerID === "azure-cognitive-services" && model.api.id.includes("claude")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

this change shouldnt be needed

// Anthropic rejects messages with empty content - filter out empty string messages
// and remove empty text/reasoning parts from array content
if (model.api.npm === "@ai-sdk/anthropic") {
const isAzureClaude = model.providerID === "azure-cognitive-services" && model.api.id.includes("claude")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

this shouldnt be needed

if (id.includes("deepseek") || id.includes("minimax") || id.includes("glm") || id.includes("mistral")) return {}

// Azure Cognitive Services with Claude models uses Anthropic thinking config
const isAzureClaude = model.providerID === "azure-cognitive-services" && model.api.id.includes("claude")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

i dont think this should be needed

// Special case: google-vertex-anthropic uses a subpath import
const bundledKey =
model.providerID === "google-vertex-anthropic" ? "@ai-sdk/google-vertex/anthropic" : model.api.npm
model.providerID === "google-vertex-anthropic"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This shouldnt be needed

}

// Special case: Azure Cognitive Services with Anthropic models uses @ai-sdk/anthropic
const isAzureClaude = model.providerID === "azure-cognitive-services" && model.api.id.includes("claude")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

you would also need to handle if the resourceName is being passed as a provider option for the provider

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

claude-opus-4.5 on azure unusable

2 participants


Back | FazBrowse Home | New Git URL