SDKs & Developer Experience

Using the SDK with Microsoft Azure AI Foundry

For Azure-committed enterprises, Foundry is the door to Claude. The official Python SDK has a dedicated client for it — two parameters and you are on your own resource.

Claude 3P 101 · Updated July 2026 · Unofficial guide

Microsoft Foundry is Azure's platform for hosting and managing AI models, and it is how Claude arrives inside an Azure estate — billed through your Microsoft relationship, governed by Azure's controls. On the developer side, the official anthropic Python package ships a dedicated client class, AnthropicFoundry, so application code written against the Messages API carries over with a constructor swap rather than a rewrite.

The client and its two parameters

from anthropic import AnthropicFoundry

client = AnthropicFoundry(api_key="...", resource="my-foundry-resource")

message = client.messages.create(
    model="claude-sonnet-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello, Claude"}],
)

resource names your Foundry resource — the Azure-side object you create to host model access, which carries the region, keys, and policy attachments. The client uses it to address the right endpoint, so you do not assemble a base URL by hand in the common case; the resource name is the routing information. If your network architecture requires pointing the client at a nonstandard endpoint (a gateway, a private route), check the official SDK documentation for the supported override mechanism rather than improvising.

api_key is a Foundry key, issued and managed on the Azure side with your resource — not an Anthropic sk-ant-api... key from the Claude Console. Treat it like any Azure credential: keep it in Azure Key Vault or your secrets manager, inject it through configuration, rotate on your normal schedule, and never commit it. The lifecycle details are covered in the Foundry API keys article; for identity-based alternatives on Azure, see Entra authentication and managed identity.

Model identifiers

Foundry uses bare, first-party-style model IDs — claude-sonnet-5, claude-opus-4-8, claude-haiku-4-5, and claude-fable-5 (generally available on Microsoft Foundry since June 9, 2026). There is no prefix or platform-specific renaming; only Amazon Bedrock prefixes model IDs with anthropic.. That makes Foundry-targeted code unusually portable back to the first-party API. One deployment-side note: which models you can actually call depends on what has been deployed on your Foundry resource — see model deployments.

What works, and what is beta

The core Claude capabilities are available on Foundry: the Messages API, streaming, tool use, vision, thinking, prompt caching, PDF input, citations, and 1M context — all generally available. Some advanced features (the Files API, structured outputs, code execution, web tools) are currently offered in beta rather than general availability. One hard gap: Anthropic's Message Batches API is not available on Foundry at all.

Enterprise translation: "beta" means the capability exists but may change and may not carry the assurances your production checklist expects. Prototype freely; before a launch that depends on a beta feature, confirm its current status in official documentation. Foundry beta caveats goes deeper.

Billing and data-zone notes worth knowing early

Two Foundry-specific facts tend to surface late in projects and are better known up front. First, billing: Claude in Microsoft Foundry is billed through the marketplace in Claude Consumption Units (CCUs) at $0.01 per CCU — 100 CCUs equal $1.00 of usage at standard per-model rates after discounts — metered hourly and invoiced in arrears; CCUs are not prepaid credits. Second, data zones: Foundry's "US Data Zone Standard" deployment type is the equivalent of Anthropic's inference_geo: "us" setting and carries the same 1.1x pricing multiplier over standard global routing. If legal asks for US-resident inference, that is the lever — and it costs 10% more.

Across languages

AnthropicFoundry is the Python client. The official TypeScript, Java, Go, Ruby, C#, and PHP SDK READMEs do not document Foundry client classes — for those stacks, see Foundry from TypeScript, from .NET, and from Java, or check current official documentation. The concepts — resource, Azure-side key, bare model IDs, beta awareness — are the same in every language.

Where to go next

Walk through your first Claude call on Foundry from resource creation onward, then check the feature matrix and Foundry feature parity before committing production workloads.

Sources