Bug: Anthropic provider fails with Azure AI Foundry endpoints (incorrect auth header)
Before submitting your bug report
- [x] I've tried using the "Ask AI" feature on the Continue docs site to see if the docs have an answer
- [x] I'm not able to find a related conversation on GitHub discussions that reports the same bug
- [x] I'm not able to find an open issue that reports the same bug
- [x] I've seen the troubleshooting guide on the Continue Docs
Relevant environment info
- OS:
- Continue version:
- IDE version:
- Model:
- config:
OR link to agent in Continue hub:
Description
Problem
Continue does not support Azure AI Foundry-hosted Anthropic models (Claude Opus 4.5, Haiku 4.5, etc.), even though these are now available in EU regions and represent an important deployment option for enterprise customers requiring GDPR compliance and data residency.
Current Behavior
When configuring an Azure-hosted Anthropic endpoint:
models:
- provider: anthropic
model: claude-opus-4-5
apiBase: https://my-resource.services.ai.azure.com/anthropic
apiKey: <AZURE_API_KEY>
Result:
- ❌ 401 Unauthorized Error
- Misleading error message: "forgot to add '/v1' to apiBase"
Root Cause
Azure AI Foundry uses the native Anthropic Messages API format but with a different authentication header:
| Provider | Auth Header | Value |
|---|---|---|
| Anthropic Direct | x-api-key |
Anthropic API Key |
| Azure-hosted Anthropic | api-key |
Azure API Key |
Continue's Anthropic provider always sends x-api-key, which Azure rejects.
Expected Behavior
Continue should automatically detect Azure endpoints and use the correct authentication header:
// Detection logic
const isAzureEndpoint = apiBase?.toLowerCase().includes('.services.ai.azure.com') ||
apiBase?.toLowerCase().includes('.cognitiveservices.azure.com');
const authHeader = isAzureEndpoint ? 'api-key' : 'x-api-key';
Proposed Solution
Extend the Anthropic provider to detect Azure endpoints and adjust the authentication header accordingly. This requires minimal changes:
-
packages/openai-adapters/src/apis/AnthropicUtils.ts- Add Azure endpoint detection function
- Modify
getAnthropicHeaders()to acceptapiBaseparameter - Use conditional header name based on endpoint
-
packages/openai-adapters/src/apis/Anthropic.ts- Pass
apiBasetogetAnthropicHeaders()
- Pass
-
core/llm/llms/Anthropic.ts- Pass
apiBasetogetAnthropicHeaders()
- Pass
Why This Matters
- GDPR Compliance: EU customers can use Claude models while keeping data in EU regions
- Enterprise Requirements: Many organizations require Azure-based deployments
- Unified Billing: Anthropic usage through Azure subscription
- Data Residency: Regional deployments for compliance
Additional Context
- Azure AI Foundry Anthropic API uses the same request/response format as standard Anthropic
- Only the authentication header differs
- All Anthropic features (streaming, caching, tools) work identically
- Continue's existing retry logic handles Azure rate limits (HTTP 429 + Retry-After)
Workarounds
None available. Users cannot currently use Azure-hosted Anthropic models with Continue.
Environment
- Continue Version: [latest]
- IDE: VS Code / JetBrains
- Azure AI Foundry: Claude Opus 4.5, Claude Haiku 4.5
References
I'm willing to contribute a PR for this if the approach is acceptable.
To reproduce
No response
Log output
Related Issues
Found the following related issues:
Azure Foundry Issues:
- #3938 - Cannot Provision DeepSeek R1 from Azure Foundry
- #3902 - Cannot setup Deepseek model using Azure Foundry
- #3735 - Azure Foundry models don't work (Mistral Codestral 2501 with Azure) [CLOSED]
- #5188 - JSON error when trying to connect to Azure Foundry endpoint [CLOSED]
Authentication Header Issues:
- #7047 - IntelliJ: duplicate authorization header sent for OpenAI models, causing authentication failure [CLOSED]
- #4243 - HTTP 401 Unauthorized from https://api.anthropic.com/v1/messages (x-api-key header is required) [CLOSED]
- #4661 - tabAutocompleteModel does not respect requestOptions.headers when using Mistral provider [CLOSED]
The most relevant appears to be #3735 which discusses the different URI structure for Azure Foundry vs Azure OpenAI endpoints.
Clarification: This issue is NOT related to #3735
Thanks for the automated related issues list, but I want to clarify that this issue is fundamentally different from #3735 and the other Azure Foundry issues listed.
| Issue | Problem | Provider | API Format |
|---|---|---|---|
| #3735 (Codestral/Mistral) | URL path structure (/openai/deployments/... vs /chat/completions) |
azure (OpenAI-compatible) |
OpenAI Chat API |
| #3902 (DeepSeek) | URL path structure | azure (OpenAI-compatible) |
OpenAI Chat API |
| #9009 (This issue) | Authentication header (x-api-key vs api-key) |
anthropic |
Native Anthropic Messages API |
Key Differences:
- Different Provider: This issue affects the
anthropicprovider, not theazureprovider - Different API: Azure-hosted Anthropic uses the native Anthropic Messages API (not OpenAI-compatible)
- Different Root Cause: The issue is the authentication header name, not URL path construction
- Different Fix Location: Changes needed in
AnthropicUtils.ts/Anthropic.ts, not Azure/OpenAI adapters
Why #3735's solution doesn't apply here:
- #3735 proposes adding
apiType: 'foundry'for URL path handling in the Azure/OpenAI provider - This issue requires detecting Azure endpoints in the Anthropic provider and switching from
x-api-keytoapi-key - The request/response format is identical to standard Anthropic - only the auth header differs
This is a new, distinct feature request for Azure-hosted Anthropic Claude models (not Mistral, DeepSeek, or other OpenAI-compatible models).
:tada: This issue has been resolved in version 1.36.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version 1.38.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version 1.8.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket: