Repository Public
1---2title: Claude in Microsoft Foundry3url: https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry4description: Access Claude models through Microsoft Foundry with Azure-native endpoints and authentication.5---67This guide shows you how to set up and make API calls to Claude in Microsoft Foundry using one of Anthropic's client SDKs or direct HTTP requests. When you access Claude in Microsoft Foundry, you are billed for Claude usage in the Azure Marketplace. You can use Claude models including Claude Fable 5.1, Claude Opus 5, Claude Opus 4.8, and Claude Sonnet 5, and features such as the [1M-token context window](https://platform.claude.com/docs/en/build-with-claude/context-windows), while managing costs through your Azure subscription.89Claude is available in Global Standard and US Data Zone Standard deployment types in Foundry resources, billed in Claude Consumption Units through the Azure Marketplace. Visit [Claude in Microsoft Foundry pricing](https://platform.claude.com/docs/en/about-claude/pricing#claude-in-microsoft-foundry-pricing) for details.1011## Hosting options1213Claude models in Microsoft Foundry are available in two hosting options. You choose the hosting option when you configure the deployment.1415| | Hosted on Azure | Hosted on Anthropic |16| -------------------- | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |17| Where inference runs | Anthropic-operated service running on Azure infrastructure | Anthropic-operated service running on Anthropic infrastructure |18| Model availability | The latest models in the Opus, Sonnet, and Haiku families | All Claude models available on Microsoft Foundry |19| Deployment types | Global Standard, US Data Zone Standard | Global Standard |20| Recommended for | Most workloads | [Access to features or models not yet hosted on Azure](https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#additional-features-not-supported-when-hosted-on-azure) |2122<Note>23 Anthropic acts as an independent processor for Microsoft. Customers using Claude through Microsoft Foundry are subject to Anthropic's data use terms. For deployments hosted on Azure, prompts and completions remain within Azure. Only usage metadata and content flagged by Anthropic's safety systems egress to Anthropic. Anthropic continues to provide its safety and data commitments.24</Note>2526## Prerequisites2728Before you begin, ensure you have:2930* An active Azure subscription31* Access to the [Foundry portal](https://ai.azure.com/)32* The [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) installed (required for the Entra ID cURL example, optional otherwise)33* An Azure RBAC role that allows you to use the resource, such as **Foundry User** (formerly Azure AI User) or **Cognitive Services User**3435## Install an SDK3637Anthropic's [client SDKs](https://platform.claude.com/docs/en/cli-sdks-libraries/overview) support Foundry through a platform-specific package or client class. The examples on this page also show requests with cURL and the ant CLI. To set up the CLI, see [CLI quickstart](https://platform.claude.com/docs/en/cli-sdks-libraries/cli/quickstart).3839<Note>40 Foundry is supported by the C#, Java, PHP, Python, and TypeScript SDKs. Foundry is not currently available in the Go and Ruby SDKs.41</Note>4243<Tabs>44 <Tab title="Python">45 ```bash46 pip install -U "anthropic"4748 # For Entra ID authentication, also install the Azure Identity library49 pip install azure-identity50 ```51 </Tab>5253 <Tab title="TypeScript">54 ```bash55 npm install @anthropic-ai/foundry-sdk5657 # For Entra ID authentication, also install the Azure Identity library58 npm install @azure/identity59 ```60 </Tab>6162 <Tab title="C#">63 ```bash64 dotnet add package Anthropic.Foundry65 ```66 </Tab>6768 <Tab title="Go">69 ```bash70 # The Go SDK does not yet support Foundry natively (see the Authentication71 # examples for using the standard Go SDK as a workaround)72 go get github.com/anthropics/anthropic-sdk-go73 ```74 </Tab>7576 <Tab title="Java">77 <Tabs>78 <Tab title="Gradle">79 ```kotlin80 implementation("com.anthropic:anthropic-java:2.63.0")81 implementation("com.anthropic:anthropic-java-foundry:2.63.0")8283 // For Entra ID authentication, also add the Azure Identity library84 implementation("com.azure:azure-identity:1.18.3")85 ```86 </Tab>8788 <Tab title="Maven">89 ```xml90 <dependency>91 <groupId>com.anthropic</groupId>92 <artifactId>anthropic-java</artifactId>93 <version>2.63.0</version>94 </dependency>95 <dependency>96 <groupId>com.anthropic</groupId>97 <artifactId>anthropic-java-foundry</artifactId>98 <version>2.63.0</version>99 </dependency>100 <!-- For Entra ID authentication, also add the Azure Identity library -->101 <dependency>102 <groupId>com.azure</groupId>103 <artifactId>azure-identity</artifactId>104 <version>1.18.3</version>105 </dependency>106 ```107 </Tab>108 </Tabs>109 </Tab>110111 <Tab title="PHP">112 ```bash113 composer require "anthropic-ai/sdk" "guzzlehttp/guzzle:^7"114 ```115 </Tab>116117 <Tab title="Ruby">118 ```bash119 # The Ruby SDK does not yet support Foundry natively (see the Authentication120 # examples for using the standard Ruby SDK as a workaround)121 # Gemfile122 gem "anthropic"123 ```124 </Tab>125</Tabs>126127## Provisioning128129Foundry uses a two-level hierarchy: **resources** contain your security and billing configuration, while **deployments** are the model instances you call through the API. You'll first create a Foundry resource, then create one or more Claude deployments within it.130131### Provisioning Foundry resources132133Create a Foundry resource, which is required to use and manage services in Azure. You can follow these instructions to create a [Foundry resource](https://learn.microsoft.com/en-us/azure/ai-services/multi-service-resource?pivots=azportal#create-a-new-azure-ai-foundry-resource). Alternatively, you can start by creating a [Foundry project](https://learn.microsoft.com/en-us/azure/foundry/how-to/create-projects), which involves creating a Foundry resource.134135To provision your resource:1361371. Navigate to the [Foundry portal](https://ai.azure.com/).1382. Create a new Foundry resource or select an existing one.1393. Configure access management using Azure-issued API keys or Entra ID (formerly Azure Active Directory) for role-based access control.1404. Optionally configure the resource to be part of a private network (Azure Virtual Network) to restrict network access to your resource.1415. Note your resource name. You'll use this as `{resource}` in API endpoints (for example, `https://{resource}.services.ai.azure.com/anthropic/v1/*`).142143### Creating Foundry deployments144145After creating your resource, deploy a Claude model to make it available for API calls. These steps describe the new Foundry portal (the **New Foundry** toggle is on):1461471. Sign in to the Foundry portal. From the portal homepage, select **Discover** in the upper-right navigation, then **Models** in the left pane to open the model catalog.1481492. Search for and select a Claude model (for example, claude-opus-5). Each model appears once in the catalog regardless of how many hosting options it supports.1501513. On the model card, select **Deploy**, then **Custom settings** to open the deployment settings pane. If you choose **Default settings** instead, the deployment is automatically configured as Hosted on Azure for models available in both hosting options.1521534. On your first Claude deployment, review the Azure Marketplace terms, select an industry, and select **Agree and Proceed** to accept the terms and subscribe to the Azure Marketplace offer.1541555. Configure the deployment:156157 * **Deployment name:** Defaults to the model ID, but you can customize it (for example, `my-claude-deployment`). The deployment name cannot be changed after creation.158 * **Region scope:** Select Global, or for models hosted on Azure, Data Zone. Selecting Data Zone creates a US Data Zone Standard deployment, which keeps inference within the United States and is equivalent to setting [`inference_geo: "us"`](https://platform.claude.com/docs/en/manage-claude/data-residency#inference-geo) on the Claude API.159 * **Model version:** Expand **Model version settings** and select a version from the **Model version** dropdown menu. Each [hosting option](https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options) is listed as a separate model version, labeled with its hosting option (for example, version 1 for Hosted on Anthropic, version 2 for Hosted on Azure).1601616. Select **Deploy** and wait for provisioning to complete.1621637. Once deployed, select **Build** in the upper-right navigation, then **Models** in the left pane, and open your deployment. The **Details** tab shows the **Target URI** (your endpoint URL) and **Key** (your API key).164165If the **New Foundry** toggle is off, you are in the classic portal layout. There, open **Model catalog** in the left pane to find and deploy a model, and open **Models + endpoints** (under **My assets**) to view your deployments and their endpoint details.166167<Note>168 The deployment name you choose becomes the value you pass in the `model` parameter of your API requests. You can create multiple deployments of the same model with different names to manage separate configurations or rate limits.169</Note>170171## Authentication172173Claude in Microsoft Foundry supports two authentication methods: API keys and Entra ID tokens. Both methods use Azure-hosted endpoints in the format `https://{resource}.services.ai.azure.com/anthropic/v1/*`.174175### API key authentication176177After provisioning your Foundry Claude resource, you can obtain an API key from the Foundry portal:1781791. In the Foundry portal, select **Build** in the upper-right navigation, then **Models** in the left pane.1802. Open your Claude deployment and select the **Details** tab.1813. Copy the **Key** value (and note the **Target URI** for your endpoint).1824. Use either the `api-key` or `x-api-key` header in your requests, or provide it to the SDK.183184The Foundry SDKs require an API key and either a resource name or base URL. The C#, Java, PHP, Python, and TypeScript SDKs automatically read these from the following environment variables if they are defined:185186* `ANTHROPIC_FOUNDRY_API_KEY` - Your API key187* `ANTHROPIC_FOUNDRY_RESOURCE` - Your resource name (for example, `example-resource`)188* `ANTHROPIC_FOUNDRY_BASE_URL` - Alternative to resource name: the full base URL (for example, `https://example-resource.services.ai.azure.com/anthropic/`). The C# SDK does not read this variable: it always constructs the base URL from the resource name.189190<Note>191 The `resource` and `base_url` parameters are mutually exclusive. Provide either the resource name (which the SDK uses to construct the URL as `https://{resource}.services.ai.azure.com/anthropic/`) or the full base URL directly.192</Note>193194**Example using API key:**195196<CodeGroup>197 ```bash cURL198 curl https://{resource}.services.ai.azure.com/anthropic/v1/messages \199 -H "content-type: application/json" \200 -H "api-key: YOUR_AZURE_API_KEY" \201 -H "anthropic-version: 2023-06-01" \202 -d '{203 "model": "claude-opus-5",204 "max_tokens": 1024,205 "messages": [206 {"role": "user", "content": "Hello!"}207 ]208 }'209 ```210211 ```bash CLI212 # ant reads ANTHROPIC_API_KEY and sends it as x-api-key, which Foundry accepts213 export ANTHROPIC_API_KEY="YOUR_AZURE_API_KEY"214215 ant messages create \216 --base-url https://example-resource.services.ai.azure.com/anthropic \217 --model claude-opus-5 \218 --max-tokens 1024 \219 --message '{role: user, content: "Hello!"}' \220 --transform content221 ```222223 ```python Python224 import os225 from anthropic import AnthropicFoundry226227 client = AnthropicFoundry(228 api_key=os.environ.get("ANTHROPIC_FOUNDRY_API_KEY"),229 resource="example-resource", # your resource name230 )231232 message = client.messages.create(233 model="claude-opus-5",234 max_tokens=1024,235 messages=[{"role": "user", "content": "Hello!"}],236 )237 print(message.content)238 ```239240 ```typescript TypeScript241 import AnthropicFoundry from "@anthropic-ai/foundry-sdk";242243 const client = new AnthropicFoundry({244 apiKey: process.env.ANTHROPIC_FOUNDRY_API_KEY,245 resource: "example-resource" // your resource name246 });247248 const message = await client.messages.create({249 model: "claude-opus-5",250 max_tokens: 1024,251 messages: [{ role: "user", content: "Hello!" }]252 });253 console.log(message.content);254 ```255256 ```csharp C#257 using Anthropic.Foundry;258 using Anthropic.Models.Messages;259260 var client = new AnthropicFoundryClient(261 new AnthropicFoundryApiKeyCredentials(262 Environment.GetEnvironmentVariable("ANTHROPIC_FOUNDRY_API_KEY")!,263 "example-resource"264 )265 );266267 var response = await client.Messages.Create(new MessageCreateParams268 {269 Model = "claude-opus-5",270 MaxTokens = 1024,271 Messages = [new() { Role = Role.User, Content = "Hello!" }],272 });273274 Console.WriteLine(275 string.Join("", response.Content276 .Select(block => block.Value)277 .OfType<TextBlock>()278 .Select(textBlock => textBlock.Text)));279 ```280281 ```go Go282 // The Go SDK does not yet support Foundry natively. This example uses the283 // standard Go SDK as a workaround. WithoutEnvironmentDefaults keeps the284 // client from also reading ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN from285 // the environment and sending a Claude API credential to your Foundry286 // endpoint. Features that Foundry does not support fail server-side rather287 // than client-side. For full Foundry support, use the C#, Java, PHP,288 // Python, or TypeScript SDKs.289 package main290291 import (292 "context"293 "fmt"294 "os"295296 "github.com/anthropics/anthropic-sdk-go"297 "github.com/anthropics/anthropic-sdk-go/option"298 )299300 func main() {301 client := anthropic.NewClient(302 option.WithoutEnvironmentDefaults(),303 option.WithBaseURL("https://example-resource.services.ai.azure.com/anthropic"),304 option.WithAPIKey(os.Getenv("ANTHROPIC_FOUNDRY_API_KEY")),305 )306307 message, err := client.Messages.New(context.Background(), anthropic.MessageNewParams{308 Model: "claude-opus-5",309 MaxTokens: 1024,310 Messages: []anthropic.MessageParam{311 anthropic.NewUserMessage(anthropic.NewTextBlock("Hello!")),312 },313 })314 if err != nil {315 panic(err)316 }317 fmt.Println(message.Content)318 }319 ```320321 ```java Java322 import com.anthropic.client.AnthropicClient;323 import com.anthropic.client.okhttp.AnthropicOkHttpClient;324 import com.anthropic.foundry.backends.FoundryBackend;325 import com.anthropic.models.messages.MessageCreateParams;326327 void main() {328 // Requires env vars: ANTHROPIC_FOUNDRY_API_KEY, ANTHROPIC_FOUNDRY_RESOURCE329 AnthropicClient client = AnthropicOkHttpClient.builder()330 .backend(FoundryBackend.fromEnv())331 .build();332333 MessageCreateParams params = MessageCreateParams.builder()334 .model("claude-opus-5")335 .maxTokens(1024)336 .addUserMessage("Hello!")337 .build();338339 client.messages().create(params).content().stream()340 .flatMap(block -> block.text().stream())341 .forEach(textBlock -> IO.println(textBlock.text()));342 }343 ```344345 ```php PHP346 use Anthropic\Foundry;347348 $client = Foundry\Client::withCredentials(349 apiKey: getenv('ANTHROPIC_FOUNDRY_API_KEY'),350 baseUrl: 'https://example-resource.services.ai.azure.com/anthropic',351 );352353 $message = $client->messages->create(354 maxTokens: 1024,355 messages: [356 ['role' => 'user', 'content' => 'Hello!']357 ],358 model: 'claude-opus-5',359 );360 echo array_find($message->content, fn ($block) => $block->type === 'text')->text;361 ```362363 ```ruby Ruby364 # The Ruby SDK does not yet support Foundry natively. This example uses the365 # standard Ruby SDK as a workaround. Pass credentials explicitly: without366 # them, the client falls back to the ANTHROPIC_API_KEY or367 # ANTHROPIC_AUTH_TOKEN environment variables and could send a Claude API368 # credential to your Foundry endpoint. Features that Foundry369 # does not support fail server-side rather than client-side. For full370 # Foundry support, use the C#, Java, PHP, Python, or TypeScript SDKs.371 require "anthropic"372373 client = Anthropic::Client.new(374 base_url: "https://example-resource.services.ai.azure.com/anthropic",375 api_key: ENV.fetch("ANTHROPIC_FOUNDRY_API_KEY")376 )377378 message = client.messages.create(379 model: "claude-opus-5",380 max_tokens: 1024,381 messages: [{role: "user", content: "Hello!"}]382 )383384 puts message.content.find { it.type == :text }.text385 ```386</CodeGroup>387388<Warning>389 Keep your API keys secure. Never commit them to version control or share them publicly. Anyone with access to your API key can make requests to Claude through your Foundry resource.390</Warning>391392### Microsoft Entra authentication393394Entra ID authentication lets you manage access with Azure RBAC, integrate with your organization's identity management, and avoid handling API keys manually. To use Entra ID tokens:3953961. Enable [Microsoft Entra ID authentication](https://learn.microsoft.com/en-us/azure/ai-foundry/model-inference/how-to/configure-entra-id) for your Foundry resource.3972. Obtain an access token from Entra ID.3983. Use the token in the `Authorization: Bearer {TOKEN}` header.399400**Example using Entra ID:**401402<CodeGroup>403 ```bash cURL404 # Get Microsoft Entra ID token405 ACCESS_TOKEN=$(az account get-access-token --resource https://ai.azure.com --query accessToken -o tsv)406407 # Make request with token. Replace {resource} with your resource name408 curl https://{resource}.services.ai.azure.com/anthropic/v1/messages \409 -H "content-type: application/json" \410 -H "Authorization: Bearer $ACCESS_TOKEN" \411 -H "anthropic-version: 2023-06-01" \412 -d '{413 "model": "claude-opus-5",414 "max_tokens": 1024,415 "messages": [416 {"role": "user", "content": "Hello!"}417 ]418 }'419 ```420421 ```bash CLI422 # The ant CLI can send a bearer token with --auth-token, but a set423 # ANTHROPIC_API_KEY environment variable takes precedence over it (the CLI424 # prints only a console notice), so your request could authenticate with425 # the wrong credential. For the Entra ID flow, use the cURL example or one426 # of the SDK examples instead.427 ```428429 ```python Python430 from anthropic import AnthropicFoundry431 from azure.identity import DefaultAzureCredential, get_bearer_token_provider432433 # Get Microsoft Entra ID token using token provider pattern434 token_provider = get_bearer_token_provider(435 DefaultAzureCredential(), "https://ai.azure.com/.default"436 )437438 # Create client with Entra ID authentication439 client = AnthropicFoundry(440 resource="example-resource", # your resource name441 azure_ad_token_provider=token_provider, # Use token provider for Entra ID auth442 )443444 # Make request445 message = client.messages.create(446 model="claude-opus-5",447 max_tokens=1024,448 messages=[{"role": "user", "content": "Hello!"}],449 )450 print(message.content)451 ```452453 ```typescript TypeScript454 import AnthropicFoundry from "@anthropic-ai/foundry-sdk";455 import { DefaultAzureCredential, getBearerTokenProvider } from "@azure/identity";456457 // Get Entra ID token using token provider pattern458 const credential = new DefaultAzureCredential();459 const tokenProvider = getBearerTokenProvider(credential, "https://ai.azure.com/.default");460461 // Create client with Entra ID authentication462 const client = new AnthropicFoundry({463 resource: "example-resource", // your resource name464 azureADTokenProvider: tokenProvider // Use token provider for Entra ID auth465 });466467 // Make request468 const message = await client.messages.create({469 model: "claude-opus-5",470 max_tokens: 1024,471 messages: [{ role: "user", content: "Hello!" }]472 });473 console.log(message.content);474 ```475476 ```csharp C#477 using Anthropic.Foundry;478 using Anthropic.Models.Messages;479 using Azure.Identity;480481 var client = new AnthropicFoundryClient(482 new AnthropicFoundryIdentityTokenCredentials(483 new DefaultAzureCredential(),484 "example-resource"485 )486 );487488 var response = await client.Messages.Create(new MessageCreateParams489 {490 Model = "claude-opus-5",491 MaxTokens = 1024,492 Messages = [new() { Role = Role.User, Content = "Hello!" }],493 });494495 Console.WriteLine(496 string.Join("", response.Content497 .Select(block => block.Value)498 .OfType<TextBlock>()499 .Select(textBlock => textBlock.Text)));500 ```501502 ```go Go503 // The Go SDK does not yet support Foundry natively. This example uses the504 // standard Go SDK as a workaround, with a static Entra ID token: automatic505 // token refresh is not built in, so your application must refresh tokens506 // itself (they typically expire after 1 hour). WithoutEnvironmentDefaults507 // keeps the client from also reading ANTHROPIC_API_KEY or508 // ANTHROPIC_AUTH_TOKEN from the environment and sending a Claude API509 // credential to your Foundry endpoint. For full Foundry support, use the510 // C#, Java, PHP, Python, or TypeScript SDKs.511 package main512513 import (514 "context"515 "fmt"516 "os"517518 "github.com/anthropics/anthropic-sdk-go"519 "github.com/anthropics/anthropic-sdk-go/option"520 )521522 func main() {523 // Obtain an Entra ID access token, for example using the Azure CLI:524 // az account get-access-token --resource https://ai.azure.com \525 // --query accessToken -o tsv526 client := anthropic.NewClient(527 option.WithoutEnvironmentDefaults(),528 option.WithBaseURL("https://example-resource.services.ai.azure.com/anthropic"),529 option.WithAuthToken(os.Getenv("AZURE_ACCESS_TOKEN")),530 )531532 message, err := client.Messages.New(context.Background(), anthropic.MessageNewParams{533 Model: "claude-opus-5",534 MaxTokens: 1024,535 Messages: []anthropic.MessageParam{536 anthropic.NewUserMessage(anthropic.NewTextBlock("Hello!")),537 },538 })539 if err != nil {540 panic(err)541 }542 fmt.Println(message.Content)543 }544 ```545546 ```java Java547 import com.anthropic.client.AnthropicClient;548 import com.anthropic.client.okhttp.AnthropicOkHttpClient;549 import com.anthropic.foundry.backends.FoundryBackend;550 import com.anthropic.models.messages.MessageCreateParams;551 import com.azure.identity.AuthenticationUtil;552 import com.azure.identity.DefaultAzureCredentialBuilder;553 import java.util.function.Supplier;554555 void main() {556 Supplier<String> bearerTokenSupplier = AuthenticationUtil.getBearerTokenSupplier(557 new DefaultAzureCredentialBuilder().build(),558 "https://ai.azure.com/.default"559 );560561 AnthropicClient client = AnthropicOkHttpClient.builder()562 .backend(FoundryBackend.builder()563 .bearerTokenSupplier(bearerTokenSupplier)564 .resource("example-resource")565 .build())566 .build();567568 MessageCreateParams params = MessageCreateParams.builder()569 .model("claude-opus-5")570 .maxTokens(1024)571 .addUserMessage("Hello!")572 .build();573574 client.messages().create(params).content().stream()575 .flatMap(block -> block.text().stream())576 .forEach(textBlock -> IO.println(textBlock.text()));577 }578 ```579580 ```php PHP581 use Anthropic\Foundry;582583 // Obtain an Entra ID access token, for example using the Azure CLI:584 // az account get-access-token --resource https://ai.azure.com \585 // --query accessToken -o tsv586 $token = getenv('AZURE_ACCESS_TOKEN');587588 $client = Foundry\Client::withCredentials(589 authToken: $token,590 baseUrl: 'https://example-resource.services.ai.azure.com/anthropic',591 );592593 $message = $client->messages->create(594 maxTokens: 1024,595 messages: [596 ['role' => 'user', 'content' => 'Hello!']597 ],598 model: 'claude-opus-5',599 );600 echo array_find($message->content, fn ($block) => $block->type === 'text')->text;601 ```602603 ```ruby Ruby604 # The Ruby SDK does not yet support Foundry natively. This example uses the605 # standard Ruby SDK as a workaround, with a static Entra ID token: automatic606 # token refresh is not built in, so your application must refresh tokens607 # itself (they typically expire after 1 hour). Pass credentials explicitly:608 # without them, the client falls back to the ANTHROPIC_API_KEY or609 # ANTHROPIC_AUTH_TOKEN environment variables. For full Foundry support, use610 # the C#, Java, PHP, Python, or TypeScript SDKs.611 require "anthropic"612613 # Obtain an Entra ID access token, for example using the Azure CLI:614 # az account get-access-token --resource https://ai.azure.com \615 # --query accessToken -o tsv616 client = Anthropic::Client.new(617 base_url: "https://example-resource.services.ai.azure.com/anthropic",618 auth_token: ENV.fetch("AZURE_ACCESS_TOKEN")619 )620621 message = client.messages.create(622 model: "claude-opus-5",623 max_tokens: 1024,624 messages: [{role: "user", content: "Hello!"}]625 )626627 puts message.content.find { it.type == :text }.text628 ```629</CodeGroup>630631## Correlation request IDs632633Foundry includes request identifiers in HTTP response headers for debugging and tracing. When contacting support, provide both the `request-id` and `apim-request-id` (Azure API Management) values to help teams quickly locate and investigate your request across both Anthropic and Azure systems.634635## Feature support636637Claude in Microsoft Foundry supports most Claude features. You can find all the features currently supported in [Features overview](https://platform.claude.com/docs/en/build-with-claude/overview).638639### Context window640641Claude Fable 5.1, Claude Fable 5, Claude Opus 5, Claude Opus 4.8, Claude Opus 4.7, Claude Opus 4.6, Claude Sonnet 5, and Claude Sonnet 4.6 have a [1M-token context window](https://platform.claude.com/docs/en/build-with-claude/context-windows) on Microsoft Foundry. Other Claude models, including Claude Sonnet 4.5, have a 200k-token context window.642643### Claude features not supported for Claude in Microsoft Foundry644645* Admin API646* Advisor tool647* Claude Managed Agents648* Compliance API649* Models API650* Message Batches API651* Server-side fallback (the [`fallbacks` parameter](https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback#server-side-fallback); use the [client-side fallback pattern](https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback#client-side-fallback) instead)652* [Computer use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool) and [browser use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/browser-use-tool) toolsets (`computer_toolset_20260801` and `browser_toolset_20260801` are not currently available on Microsoft Foundry; the beta computer use tool versions remain available)653654### Additional features not supported when hosted on Azure655656The following features are available for deployments hosted on Anthropic but are not supported for deployments hosted on Azure:657658* [Code execution](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool)659* [Web search](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool) and [web fetch](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-fetch-tool) tool versions later than `web_search_20250305` and `web_fetch_20250910`. Deployments hosted on Azure support only these basic versions, so dynamic filtering, response inclusion, and cache bypass are not available.660* [Agent Skills](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview)661* [Programmatic tool calling](https://platform.claude.com/docs/en/agents-and-tools/tool-use/programmatic-tool-calling)662* [Files API](https://platform.claude.com/docs/en/build-with-claude/files)663664Requests that use these features against a deployment hosted on Azure return a `400 Bad Request` error by design. Claude Code detects deployments hosted on Azure and automatically adapts its feature set.665666## API responses667668API responses from Claude in Microsoft Foundry follow the standard [Claude API response format](https://platform.claude.com/docs/en/api/messages/create). This includes the `usage` object in response bodies, which provides detailed token consumption information for your requests. The `usage` object is consistent across all platforms (Claude API, Amazon Bedrock, Claude Platform on AWS, Foundry, and Google Cloud).669670For details on response headers specific to Foundry, see [Correlation request IDs](https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#correlation-request-ids).671672## API model IDs and deployments673674Lifecycle terms (Deprecated, Retired) are defined in [Model deprecations](https://platform.claude.com/docs/en/about-claude/model-deprecations). Microsoft Foundry follows the Claude API lifecycle schedule.675676The following Claude models are available through Foundry:677678| Model | Default deployment name | Hosted on Azure | Hosted on Anthropic |679| :---------------- | :---------------------- | :-------------: | :-----------------: |680| Claude Fable 5.1 | `claude-fable-5-1` | | ✓ |681| Claude Fable 5 | `claude-fable-5` | | ✓ |682| Claude Opus 5 | `claude-opus-5` | ✓ | ✓ |683| Claude Opus 4.8 | `claude-opus-4-8` | ✓ | ✓ |684| Claude Opus 4.7 | `claude-opus-4-7` | | ✓ |685| Claude Opus 4.6 | `claude-opus-4-6` | | ✓ |686| Claude Opus 4.5 | `claude-opus-4-5` | | ✓ |687| Claude Sonnet 5 | `claude-sonnet-5` | ✓ | ✓ |688| Claude Sonnet 4.6 | `claude-sonnet-4-6` | | ✓ |689| Claude Sonnet 4.5 | `claude-sonnet-4-5` | | ✓ |690| Claude Haiku 4.5 | `claude-haiku-4-5` | ✓ | ✓ |691692By default, deployment names match the model IDs shown in the preceding table. However, you can create custom deployments with different names in the Foundry portal to manage different configurations, versions, or rate limits. Use the deployment name (not necessarily the model ID) in your API requests.693694<Info>695 [Claude Mythos Preview](https://anthropic.com/glasswing) is a research preview available to invited customers on Microsoft Foundry.696</Info>697698<Tip>699 Upgrading to a newer Claude model? In Claude Code, run `/claude-api migrate` to apply model ID swaps and breaking parameter changes across your codebase. The skill detects which cloud platform your code targets and adjusts model ID formats and feature changes for that platform. See [Migrating to a newer Claude model](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/claude-api-skill#migrating-to-a-newer-claude-model).700</Tip>701702## Billing703704Claude in Microsoft Foundry bills through the [Azure Marketplace](https://azuremarketplace.microsoft.com/). Usage is denominated in Claude Consumption Units (CCUs), metered hourly, and invoiced monthly in arrears on your Azure bill. CCUs are not prepaid credits. There is no CCU balance or commitment.705706For the CCU price, conversion mechanics, and per-model token rates, see [Claude in Microsoft Foundry pricing](https://platform.claude.com/docs/en/about-claude/pricing#claude-in-microsoft-foundry-pricing).707708## Migrating between hosting options709710To move an existing deployment from one hosting option to the other:7117121. Create a new deployment of the model's other hosting version (Hosted on Azure or Hosted on Anthropic). This can be in the same Foundry resource, or a new one.7132. Update your application to pass the new deployment name in the `model` parameter.7143. Delete the old deployment once traffic has moved.715716If the new deployment is in the same Foundry resource, your endpoint URL and authentication are unchanged. If you created a new resource, update your application's endpoint and credentials to point to it.717718## Monitoring and logging719720Azure provides monitoring and logging for your Claude usage through standard Azure patterns:721722* **Azure Monitor:** Track API usage, latency, and error rates723* **Azure Log Analytics:** Query and analyze request/response logs724* **Cost Management:** Monitor and forecast costs associated with Claude usage725726Anthropic recommends logging your activity on at least a 30-day rolling basis to understand usage patterns and investigate any potential issues.727728<Note>729 Azure's logging services are configured within your Azure subscription. Enabling logging does not provide Microsoft or Anthropic access to your content beyond what's necessary for billing and service operation.730</Note>731732## Troubleshooting733734### Authentication errors735736**Error:** `401 Unauthorized` or `Invalid API key`737738* **Solution:** Verify your API key is correct. You can find it in the Foundry portal on your deployment's **Details** tab (under **Build** > **Models**).739* **Solution:** If using Microsoft Entra ID, ensure your access token is valid and hasn't expired. Tokens typically expire after 1 hour.740741**Error:** `403 Forbidden`742743* **Solution:** Your Azure account may lack the necessary permissions. Ensure you have the appropriate Azure RBAC role assigned (for example, **Foundry User** (formerly Azure AI User) or **Cognitive Services User**).744745### Rate limiting746747**Error:** `429 Too Many Requests`748749* **Solution:** You've exceeded your rate limit. Implement exponential backoff and retry logic in your application.750* **Solution:** Consider requesting rate limit increases through the Azure portal or Azure support.751752#### Rate limit headers753754Foundry does not include Anthropic's standard rate limit headers (`anthropic-ratelimit-tokens-limit`, `anthropic-ratelimit-tokens-remaining`, `anthropic-ratelimit-tokens-reset`, `anthropic-ratelimit-input-tokens-limit`, `anthropic-ratelimit-input-tokens-remaining`, `anthropic-ratelimit-input-tokens-reset`, `anthropic-ratelimit-output-tokens-limit`, `anthropic-ratelimit-output-tokens-remaining`, and `anthropic-ratelimit-output-tokens-reset`) in responses. Manage rate limiting through Azure's monitoring tools instead.755756### Model and deployment errors757758**Error:** `Model not found` or `Deployment not found`759760* **Solution:** Verify you're using the correct deployment name. If you haven't created a custom deployment, use the default model ID (for example, claude-opus-5).761* **Solution:** Ensure the model/deployment is available in your Azure region.762763**Error:** `Invalid model parameter`764765* **Solution:** The model parameter should contain your deployment name, which can be customized in the Foundry portal. Verify the deployment exists and is properly configured.766767## Next steps768769<CardGroup cols={2}>770 <Card title="Features overview" icon="stack" href="https://platform.claude.com/docs/en/build-with-claude/overview">771 Explore Claude's advanced features and capabilities.772 </Card>773774 <Card title="Pricing" icon="chart" href="https://platform.claude.com/docs/en/about-claude/pricing#claude-in-microsoft-foundry-pricing">775 Learn about Anthropic's pricing structure for models and features.776 </Card>777778 <Card title="Model deprecations" icon="arrow-clockwise" href="https://platform.claude.com/docs/en/about-claude/model-deprecations">779 As safer and more capable models launch, Anthropic regularly retires older ones. See all API deprecations, along with recommended replacements.780 </Card>781</CardGroup>782783## Additional resources784785<CardGroup cols={2}>786 <Card title="Foundry model catalog" icon="grid" href="https://ai.azure.com/catalog/publishers/anthropic">787 Browse Anthropic models in the Foundry catalog.788 </Card>789790 <Card title="Azure AI Foundry pricing" icon="calculator" href="https://azure.microsoft.com/en-us/pricing/details/ai-foundry/#pricing">791 View Microsoft's pricing details for Azure AI Foundry.792 </Card>793794 <Card title="Model pricing" icon="table" href="https://platform.claude.com/docs/en/about-claude/pricing#model-pricing">795 View Anthropic's per-model pricing details.796 </Card>797798 <Card title="Azure portal" icon="cloud" href="https://portal.azure.com/">799 Manage your Azure resources.800 </Card>801</CardGroup>802