// STATUS: UNVERIFIED — no cloud credentials in this atlas; snippet follows official docs verbatim-ish // Source: https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry (retrieved 2026-09-18) // Install: npm install @anthropic-ai/foundry-sdk (npm install @azure/identity for Entra ID) // Env: ANTHROPIC_FOUNDRY_API_KEY, ANTHROPIC_FOUNDRY_RESOURCE (or ANTHROPIC_FOUNDRY_BASE_URL). import AnthropicFoundry from "@anthropic-ai/foundry-sdk"; const client = new AnthropicFoundry({ apiKey: process.env.ANTHROPIC_FOUNDRY_API_KEY, resource: process.env.ANTHROPIC_FOUNDRY_RESOURCE, // -> https://{resource}.services.ai.azure.com/anthropic/ }); const message = await client.messages.create({ model: "claude-haiku-4-5", // default deployment name for Haiku 4.5 max_tokens: 8, messages: [{ role: "user", content: "Reply with OK." }], }); const textBlock = message.content.find((block) => block.type === "text"); if (textBlock && textBlock.type === "text") console.log(textBlock.text); // Entra ID alternative (not run here): // import { DefaultAzureCredential, getBearerTokenProvider } from "@azure/identity"; // const azureADTokenProvider = getBearerTokenProvider(new DefaultAzureCredential(), "https://ai.azure.com/.default"); // new AnthropicFoundry({ resource: process.env.ANTHROPIC_FOUNDRY_RESOURCE, azureADTokenProvider });