Anthropic SDK with idapt
The Anthropic-compatible surface: Messages API code unchanged, routed through idapt.
Last reviewed 2026-07-17
Install
bash
npm i @anthropic-ai/sdk # or: pip install anthropicPoint it at idapt
ts
import 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-4.8",
max_tokens: 512,
messages: [{ role: "user", content: "Three facts about ravens." }],
});Python: Anthropic(base_url=..., api_key=...) takes the same two arguments.
Pitfalls
Messages API shape, Anthropic auth header
The compat surface speaks the Messages API and accepts the SDK's x-api-key header with your idapt key. Non-Anthropic catalog models work here too.