continuedev/continue · warning
[Continue] Azure endpoint detected but API key appears to…
Error message
[Continue] Azure endpoint detected but API key appears to be a standard Anthropic key (sk-ant-*). Azure endpoints require Azure API keys from your AI Foundry resource.
What it means
getAnthropicHeaders detects an Azure endpoint (via isAzureAnthropicEndpoint on the apiBase) but the supplied API key starts with sk-ant-, the prefix of standard Anthropic console keys. Azure AI Foundry endpoints authenticate with Azure-provisioned keys, so the request will fail auth; this warning tells you the key type does not match the endpoint type.
Solutions
- Generate an API key in your Azure AI Foundry / Azure AI Services resource (Keys and Endpoint blade) and use that instead
- Double-check apiBase: if you actually intend to hit api.anthropic.com, remove the Azure endpoint URL
- Keep separate named profiles for Anthropic-direct and Azure so keys are not crossed
Example fix
# before apiBase: https://my-resource.services.ai.azure.com/models apiKey: sk-ant-api03-xxxx # after apiBase: https://my-resource.services.ai.azure.com/models apiKey: <Azure Foundry key>
Defensive patterns
Strategy: validation
Validate before calling
if (apiBase.includes("azure.com") && apiKey.startsWith("sk-ant-")) {
throw new Error("Azure endpoint requires an Azure Foundry API key, not an sk-ant- key");
} Prevention
- Keep separate profiles for Anthropic-direct and Azure endpoints
- Automate key checks in config validation: endpoint type must match key prefix
- Source Azure keys from the Foundry resource's Keys blade
When it happens
Trigger: Configuring apiBase to an Azure AI Foundry / Models-as-a-Service Anthropic endpoint while keeping an Anthropic console key (sk-ant-...) from a non-Azure config.
Common situations: Migrating an existing Anthropic config to Azure and forgetting to swap the key; mixing credentials across profiles; copy-pasting a default Anthropic key into an Azure deployment's config.
Related errors
- AskSage adapter: missing apiKey. Provide it in your…
- `env.apiVersion` is a required configuration property for…
- `env.deployment` is a required configuration property for…
- Failed to fetch Anthropic models
- Model does not have an apiKeyLocation or envSecretLocations…
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/4dc5bf8b6eedcdc4.
Report an issue: GitHub.
Appendix: source
Thrown at packages/openai-adapters/src/apis/AnthropicUtils.ts:75
hostname.endsWith(".services.ai.azure.com") ||
hostname.endsWith(".cognitiveservices.azure.com")
);
} catch {
// Invalid URL - fall back to false
return false;
}
}
export function getAnthropicHeaders(
apiKey: string,
enableCaching: boolean,
apiBase?: string,
): Record<string, string> {
const isAzure = isAzureAnthropicEndpoint(apiBase);
// Warn if Azure endpoint is used with Anthropic-style key
if (isAzure && apiKey.startsWith("sk-ant-")) {
console.warn(
"[Continue] Azure endpoint detected but API key appears to be a standard Anthropic key (sk-ant-*). " +
"Azure endpoints require Azure API keys from your AI Foundry resource.",
);
}
const authHeaderName =
isAzure && apiBase?.toLowerCase().includes("cognitiveservices.azure.com")
? "api-key"
: "x-api-key";
const headers: Record<string, string> = {
"Content-Type": "application/json",
Accept: "application/json",
"anthropic-version": "2023-06-01",
[authHeaderName]: apiKey,
};
if (enableCaching) {View on GitHub (pinned to 5522c6f44c)