You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Add support for Anthropic models in Azure AI Foundry #4474
Looking into this now - added support in anomalyco/models.dev#405 but unable to use the claude models yet. Wondering if we should wait for ai-sdk/azure support for @anthropic-ai/foundry-sdk or just add a switch for the time being.
@rekram1-node I can see now azure/claude-sonnet-4-5, is there any way to clean the cache. Also would opencode auth login with azure, going to support foundry key or we need to set env as suggested here
`
INFO 2025-11-21T14:49:36 +0ms service=session.prompt sessionID=ses_5591ba16affeJMoRrZpI0kg4cr cancel
INFO 2025-11-21T14:49:36 +1ms service=bus type=session.status publishing
INFO 2025-11-21T14:49:36 +0ms service=bus type=session.idle publishing
68 | autoload: false,
69 | async getModel(sdk: any, modelID: string, options?: Record<string, any>) {
70 | if (options?.["useCompletionUrls"]) {
71 | return sdk.chat(modelID)
72 | } else {
73 | return sdk.responses(modelID)
^
TypeError: sdk.responses is not a function. (In 'sdk.responses(modelID)', 'sdk.responses' is undefined)
at (src/provider/provider.ts:73:24)
at getModel (src/provider/provider.ts:69:34)
at getModel (src/provider/provider.ts:584:26)
INFO 2025-11-21T14:49:36 +0ms service=provider status=completed duration=43 providerID=azure getSDK
ERROR 2025-11-21T14:49:36 +1ms service=acp-command promise={} reason=sdk.responses is not a function. (In 'sdk.responses(modelID)', 'sdk.responses' is undefined) Unhandled rejection
ERROR 2025-11-21T14:49:36 +0ms service=default e=sdk.responses is not a function. (In 'sdk.responses(modelID)', 'sdk.responses' is undefined) rejection
INFO 2025-11-21T14:49:36 +3ms service=default directory=/home/edisonpaul4 disposing instance
INFO 2025-11-21T14:49:36 +0ms service=state key=/home/edisonpaul4 waiting for state disposal to complete
INFO 2025-11-21T14:49:36 +1ms service=state key=/home/edisonpaul4 state disposal completed
`
The resource name can also be provided in opencode.json. The API-Key can be set in auth.json as well. That's my current setup. Thanks to the comment before.
The resource name can also be provided in opencode.json. The API-Key can be set in auth.json as well. That's my current setup. Thanks to the comment before.
The resource name can also be provided in opencode.json. The API-Key can be set in auth.json as well. That's my current setup. Thanks to the comment before.
This worked for me on 1.1.45! You don't have to add the api key in auth.json, it will ask the first time inside OpenCode and if you paste it there, it will add it for you. If you do want to add it manually it's in ~/.local/share/opencode/auth.json
Just fyi, still having the same issue under the latest version. Bypassing for now with custom provider but not all features are working great (variants for example or pricing)
Reacted by Lefteris Loukas, grandfso and Christoph
The resource name can also be provided in opencode.json. The API-Key can be set in auth.json as well. That's my current setup. Thanks to the comment before.
"provider": {
"azure-anthropic": {
"name": "Azure AI Foundry (Anthropic)",
"npm": "@ai-sdk/anthropic",
"api": "https://.ai.azure.com/anthropic/v1",
"models": {
"claude-opus-4-5": {
"id": "claude-opus-4-5",
"name": "Claude Opus 4.5",
"tool_call": true,
"attachment": true,
"reasoning": true,
"temperature": true
},
"claude-sonnet-4-5": {
"id": "claude-sonnet-4-5",
"name": "Claude Sonnet 4.5",
"tool_call": true,
"attachment": true,
"reasoning": true,
"temperature": true
}
} auth.json:
{
"azure-anthropic": {
"type": "api",
"key": "xyz"
}
}
This worked for me on 1.1.45! You don't have to add the api key in auth.json, it will ask the first time inside OpenCode and if you paste it there, it will add it for you. If you do want to add it manually it's in ~/.local/share/opencode/auth.json
For me it is working on 1.2.17 as well. But I needed to change the API URL to https://<RSN>.services.ai.azure.com/anthropic/v1.
Without "services", no connection could be established.
If you use the azure provider in opencode this should just work, all models should behave as expected.
I'm realizing we mistakenly added a duplicate provider to models.dev called azure-cognitive-services if you are using that one it may not behave correctly so make sure you are authed for azure
Activity
rekram1-node commentedon Nov 19, 2025
Yep we should do that, basically just means updating: https://github.com/sst/models.dev
cau1k commentedon Nov 20, 2025
Looking into this now - added support in anomalyco/models.dev#405 but unable to use the claude models yet. Wondering if we should wait for ai-sdk/azure support for @anthropic-ai/foundry-sdk or just add a switch for the time being.
rekram1-node commentedon Nov 20, 2025
u can override the npm package per model if u need to:
[provider]
npm = “…”
cau1k commentedon Nov 20, 2025
Thanks - fixed in anomalyco/models.dev#409
krishna1s commentedon Nov 20, 2025
is this available with latest opencode version 1.0.80
rekram1-node commentedon Nov 20, 2025
@krishna1s should be you just need to restart opencode a couple of times to refresh ur cache
krishna1s commentedon Nov 20, 2025
@rekram1-node I can see now azure/claude-sonnet-4-5, is there any way to clean the cache. Also would opencode auth login with azure, going to support foundry key or we need to set env as suggested here
rekram1-node commentedon Nov 20, 2025
rm ~/.cache/opencode/models.json
Uh idk I didn't set it up but i can take a look when I get a chance
krishna1s commentedon Nov 20, 2025
I tried configuring anthropic env variable but it doesn't seems to be working
cau1k commentedon Nov 21, 2025
@krishna1s this works, just set the envs to your foundry creds (base url: https://{resource-name}.services.ai.azure.com/anthropic/v1)
{ "provider": { "azure": { "models": { "claude-haiku-4-5": { "id": "claude-haiku-4-5", "provider": { "npm": "@ai-sdk/anthropic", "options": { "apiKey": "{env:ANTHROPIC_FOUNDRY_API_KEY}", "baseURL": "{env:ANTHROPIC_FOUNDRY_BASE_URL}" } } } } } } }edisonpaul4 commentedon Nov 21, 2025
This is very important :)
edisonpaul4 commentedon Nov 21, 2025
Didnt work for me.
`
INFO 2025-11-21T14:49:36 +0ms service=session.prompt sessionID=ses_5591ba16affeJMoRrZpI0kg4cr cancel
INFO 2025-11-21T14:49:36 +1ms service=bus type=session.status publishing
INFO 2025-11-21T14:49:36 +0ms service=bus type=session.idle publishing
68 | autoload: false,
69 | async getModel(sdk: any, modelID: string, options?: Record<string, any>) {
70 | if (options?.["useCompletionUrls"]) {
71 | return sdk.chat(modelID)
72 | } else {
73 | return sdk.responses(modelID)
^
TypeError: sdk.responses is not a function. (In 'sdk.responses(modelID)', 'sdk.responses' is undefined)
at (src/provider/provider.ts:73:24)
at getModel (src/provider/provider.ts:69:34)
at getModel (src/provider/provider.ts:584:26)
INFO 2025-11-21T14:49:36 +0ms service=provider status=completed duration=43 providerID=azure getSDK
ERROR 2025-11-21T14:49:36 +1ms service=acp-command promise={} reason=sdk.responses is not a function. (In 'sdk.responses(modelID)', 'sdk.responses' is undefined) Unhandled rejection
ERROR 2025-11-21T14:49:36 +0ms service=default e=sdk.responses is not a function. (In 'sdk.responses(modelID)', 'sdk.responses' is undefined) rejection
INFO 2025-11-21T14:49:36 +3ms service=default directory=/home/edisonpaul4 disposing instance
INFO 2025-11-21T14:49:36 +0ms service=state key=/home/edisonpaul4 waiting for state disposal to complete
INFO 2025-11-21T14:49:36 +1ms service=state key=/home/edisonpaul4 state disposal completed
`
4 remaining items
krishna1s commentedon Nov 25, 2025
Does it work irrespective of foundry deployment name ?
niusnet commentedon Nov 25, 2025
Yes, it works regardless of the Foundry deployment name.
The resource URL is configured through an environment variable like ANTHROPIC_FOUNDRY_BASE_URL, where you set the full URL of your resource:
https://[RESOURCE_NAME].services.ai.azure.com/anthropic/v1So the deployment name itself doesn't matter what matters is that the base URL points to your specific Azure AI Foundry resource.
rekram1-node commentedon Nov 25, 2025
do we need to update models.dev was it incorrect?
cloonix commentedon Nov 27, 2025
The resource name can also be provided in
opencode.json. The API-Key can be set inauth.jsonas well. That's my current setup. Thanks to the comment before.auth.json:{ "azure-anthropic": { "type": "api", "key": "xyz" } }lasficw commentedon Jan 5, 2026
This works great in the Terminal but not on the Web UI for some reason. Has anybody found a workaround for that?
bluet commentedon Jan 13, 2026
I'm having the issue with OpenCode 1.1.16 , is that opencode need to dump version of dependency, or this need to be configured manually?
jonas-lomholdt commentedon Jan 30, 2026
This worked for me on
1.1.45! You don't have to add the api key inauth.json, it will ask the first time inside OpenCode and if you paste it there, it will add it for you. If you do want to add it manually it's in~/.local/share/opencode/auth.jsonFaresKi commentedon Feb 2, 2026
Just fyi, still having the same issue under the latest version. Bypassing for now with custom provider but not all features are working great (variants for example or pricing)
hathagat commentedon Mar 6, 2026
For me it is working on 1.2.17 as well. But I needed to change the API URL to
https://<RSN>.services.ai.azure.com/anthropic/v1.Without "services", no connection could be established.
rekram1-node commentedon Apr 30, 2026
If you use the
azureprovider in opencode this should just work, all models should behave as expected.I'm realizing we mistakenly added a duplicate provider to models.dev called
azure-cognitive-servicesif you are using that one it may not behave correctly so make sure you are authed forazurelazka commentedon May 4, 2026
Using the default azure provider with v1.14.32 results in:
when using Claude models. The custom config is still required.
I think this should be re-opened.
rekram1-node commentedon May 4, 2026
Oh thanks for raising thatll be resolved in next release