{"record":{"id":"4dc5bf8b6eedcdc4","repo":"continuedev/continue","slug":"continue-azure-endpoint-detected-but-api-key-app","errorCode":null,"errorMessage":"[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.","messagePattern":"\\[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\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/openai-adapters/src/apis/AnthropicUtils.ts","lineNumber":75,"sourceCode":"      hostname.endsWith(\".services.ai.azure.com\") ||\n      hostname.endsWith(\".cognitiveservices.azure.com\")\n    );\n  } catch {\n    // Invalid URL - fall back to false\n    return false;\n  }\n}\n\nexport function getAnthropicHeaders(\n  apiKey: string,\n  enableCaching: boolean,\n  apiBase?: string,\n): Record<string, string> {\n  const isAzure = isAzureAnthropicEndpoint(apiBase);\n\n  // Warn if Azure endpoint is used with Anthropic-style key\n  if (isAzure && apiKey.startsWith(\"sk-ant-\")) {\n    console.warn(\n      \"[Continue] Azure endpoint detected but API key appears to be a standard Anthropic key (sk-ant-*). \" +\n        \"Azure endpoints require Azure API keys from your AI Foundry resource.\",\n    );\n  }\n\n  const authHeaderName =\n    isAzure && apiBase?.toLowerCase().includes(\"cognitiveservices.azure.com\")\n      ? \"api-key\"\n      : \"x-api-key\";\n\n  const headers: Record<string, string> = {\n    \"Content-Type\": \"application/json\",\n    Accept: \"application/json\",\n    \"anthropic-version\": \"2023-06-01\",\n    [authHeaderName]: apiKey,\n  };\n\n  if (enableCaching) {","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/packages/openai-adapters/src/apis/AnthropicUtils.ts#L57-L93","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\napiBase: https://my-resource.services.ai.azure.com/models\napiKey: sk-ant-api03-xxxx\n\n# after\napiBase: https://my-resource.services.ai.azure.com/models\napiKey: <Azure Foundry key>","handlingStrategy":"validation","validationCode":"if (apiBase.includes(\"azure.com\") && apiKey.startsWith(\"sk-ant-\")) {\n  throw new Error(\"Azure endpoint requires an Azure Foundry API key, not an sk-ant- key\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["anthropic","azure","authentication","api-key","config"],"backgroundTag":"wrong-api-key-for-endpoint","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}