Skip to content

Provider Anthropic uses api-key instead of x-api-key for azure hosted service #11513

@sresam89

Description

@sresam89

Before submitting your bug report

Relevant environment info

- OS: Windows
- Continue version: 1.0.61
- IDE version: Android Studio Panda 1 | 2025.3.1 Patch 1
- Model:
- config:
  : Local Config
version: 1.0.0
schema: v1
models:
  - name: Claude Opus (Azure)
    provider: anthropic
    model: claude-opus-4-6
    apiKey: 
    apiBase: https://abc123-resource.services.ai.azure.com/anthropic/v1

  
  OR link to agent in Continue hub:

Description

When using the above config, with a apiBase url hosted on azure.com, the endpoint kept returning
'''{"code":"401","message":"Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource."}

Was able to work it around using a proxy, and then went into rabbit hole for finding the root cause

Cause appears to be in the file continue/packages/openai-adapters/src/apis/AnthropicUtils.ts line 81, using api-key in header if isAzure is true, instead of x-api-key

Requesting change like below or requesting leads for similar approach
const authHeaderName = isAzure && apiBase?.includes("cognitiveservices.azure.com") ? "api-key" : "x-api-key";

Forked and pushed the changes here

To reproduce

  1. Make a local config for any azure hosted anthropic model

Log output

{"error":{"code":"401","message":"Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource."}}
[info] Starting Continue core...
[2026-03-16T19:27:18] [info] Starting Continue core... 
[2026-03-16T19:27:18] Setup 
[2026-03-16T19:27:18] [binary] Core started 
[2026-03-16T19:27:18] (node:323136) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `continue-binary --trace-warnings ...` to show where the warning was created) 
[2026-03-16T19:50:11] deleteChain called from files/closed 
[2026-03-16T19:50:11] deleteChain called from files/closed 
[2026-03-16T19:50:11] deleteChain called from files/closed 
[2026-03-16T19:50:11] deleteChain called from files/closed 
[2026-03-16T19:50:11] deleteChain called from files/closed 
[2026-03-16T19:50:11] deleteChain called from files/closed 
[2026-03-16T19:50:11] deleteChain called from files/closed 
[2026-03-16T19:50:11] deleteChain called from files/closed 
[2026-03-16T19:50:12] [info] Exiting Continue core... 
[info] Starting Continue core...
[2026-03-16T19:50:46] [info] Starting Continue core... 
[2026-03-16T19:50:46] Setup 
[2026-03-16T19:50:46] [binary] Core started 
[2026-03-16T19:50:47] (node:294016) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `continue-binary --trace-warnings ...` to show where the warning was created) 
[2026-03-16T19:50:50] [DEBUG] Request URL: https://abc123-resource.services.ai.azure.com/anthropic/v1/messages
[2026-03-16T19:50:50] [DEBUG] Request headers: {
  "Content-Type": "application/json",
  "Accept": "application/json",
  "anthropic-version": "2023-06-01",
  "api-key": "" <-removed on purpose
}

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