Skip to content

Bug: Anthropic provider fails with Azure AI Foundry endpoints (incorrect auth header) #9009

@Cozmopolit

Description

@Cozmopolit

Before submitting your bug report

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:

  1. packages/openai-adapters/src/apis/AnthropicUtils.ts

    • Add Azure endpoint detection function
    • Modify getAnthropicHeaders() to accept apiBase parameter
    • Use conditional header name based on endpoint
  2. packages/openai-adapters/src/apis/Anthropic.ts

    • Pass apiBase to getAnthropicHeaders()
  3. core/llm/llms/Anthropic.ts

    • Pass apiBase to getAnthropicHeaders()

Why This Matters

  1. GDPR Compliance: EU customers can use Claude models while keeping data in EU regions
  2. Enterprise Requirements: Many organizations require Azure-based deployments
  3. Unified Billing: Anthropic usage through Azure subscription
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:integrationIntegrations (context providers, model providers, etc.)kind:bugIndicates an unexpected problem or unintended behavior

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions