- Extract 4756 source files from cli.js.map (57MB) - Set up Bun build system with bun:bundle feature flag shim - Configure 90+ compile-time feature flags matching production defaults - Inject MACRO constants (VERSION, BUILD_TIME, etc.) - Create stubs for private packages (color-diff-napi, modifiers-napi, etc.) - Install all public dependencies via pnpm - Patch commander v14 to allow multi-char short flags (-d2e) - Build output: dist/cli.js (22MB), verified working
Claude SDK for Microsoft Foundry
This library provides convenient access to the Claude API via Microsoft Azure AI Foundry. See the documentation for more details.
For the direct Claude API at api.anthropic.com, see @anthropic-ai/sdk.
Installation
npm install @anthropic-ai/foundry-sdk
Usage
Basic Usage with API Key
import { AnthropicFoundry } from '@anthropic-ai/foundry-sdk';
const client = new AnthropicFoundry({
apiKey: process.env.ANTHROPIC_FOUNDRY_API_KEY, // defaults to process.env.ANTHROPIC_FOUNDRY_API_KEY
resource: 'example-resource.azure.anthropic.com', // your Azure resource
});
const message = await client.messages.create({
model: 'claude-3-5-sonnet-20241022',
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello, Claude!' }],
});
console.log(message.content);
Using Azure AD Token Provider
For enhanced security, you can use Azure AD (Microsoft Entra) authentication instead of an API key:
import { AnthropicFoundry } from '@anthropic-ai/foundry-sdk';
import { getBearerTokenProvider, DefaultAzureCredential } from '@azure/identity';
const credential = new DefaultAzureCredential();
const scope = 'https://ai.azure.com/.default';
const azureADTokenProvider = getBearerTokenProvider(credential, scope);
const client = new AnthropicFoundry({
azureADTokenProvider,
resource: 'example-resource.azure.anthropic.com', // your Azure resource
});
const message = await client.messages.create({
model: 'claude-3-5-sonnet-20241022',
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello, Claude!' }],
});
console.log(message.content);
Using Model Deployments
If you have a model deployment configured, you can specify it to have the SDK automatically construct the correct URL path:
const client = new AnthropicFoundry({
apiKey: process.env.ANTHROPIC_FOUNDRY_API_KEY,
resource: 'example-resource.azure.anthropic.com',
});
// The SDK will automatically use /deployments/my-claude-deployment/messages
const message = await client.messages.create({
model: 'claude-3-5-sonnet-20241022',
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello!' }],
});