Anthropic SDK with idapt
Found this helpful? Share it:
Found this helpful? Share it:
Set up Anthropic SDK against idapt's compatible APIs with the steps below. This article and the AI Gateway quickstarts lander render the same shared steps, so they never drift.
Anthropic SDK with idapt
The Anthropic-compatible surface: Messages API code unchanged, routed through idapt.
npm i @anthropic-ai/sdk # or: pip install anthropicimport Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://idapt.app/api/anthropic/v1",
apiKey: process.env.IDAPT_API_KEY,
});
const reply = await client.messages.create({
model: "anthropic/claude-opus-5",
max_tokens: 512,
messages: [{ role: "user", content: "Three facts about ravens." }],
});Python: Anthropic(base_url=..., api_key=...) takes the same two arguments.
Related articles
API keys and scopes
Create a key, choose its scopes, pin it to an API version, rotate it, and cap what it can spend.
Rate limits and errors
Every error shape the API returns, what each rate limit is, and how to handle a wall in code.
Cap what an API key spends
Give every Gateway API key a lifetime, monthly, or daily USD cap, and what a capped-out key returns.
Anthropic-compatible API
Use idapt's 200+ models from Claude Code or any app that speaks the Anthropic Messages API.
Claude Code with idapt
Point Claude Code at idapt's Anthropic-compatible API with ANTHROPIC_BASE_URL and an idapt key; add MCP for workspace access.
OpenAI SDK (JS) with idapt
Point the official OpenAI Node SDK at idapt's compatible API: a three-line change routes 200+ models through your existing code.
curl with idapt
curl examples for idapt's three compatible APIs: OpenAI chat completions, Anthropic messages, and OpenRouter completions with one key.
Was this helpful?