Anthropic-compatible API
Found this helpful? Share it:
Found this helpful? Share it:
idapt exposes an Anthropic-compatible Messages API so you can use 200+ models from Claude Code, the Anthropic SDK, or any tool that supports the Anthropic format. Point your code at idapt instead of Anthropic, and everything just works 🤖
Pro and upAn API key with the completions scope. See API keys and scopes.
The base URL https://idapt.app/api/anthropic/v1.
An active subscription, or your own provider key (BYOK). The free daily pool does not apply on this gateway.
Set these environment variables and Claude Code will connect through idapt:
export ANTHROPIC_BASE_URL=https://idapt.app/api/anthropic/v1
export ANTHROPIC_API_KEY=uk_your_key_hereIf you encounter issues with beta features, set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 as well.
import anthropic
client = anthropic.Anthropic(
base_url="https://idapt.app/api/anthropic/v1",
api_key="uk_your_key_here",
)
message = client.messages.create(
model="anthropic/claude-sonnet-4.6",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello!"}],
)
print(message.content[0].text)import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://idapt.app/api/anthropic/v1",
apiKey: "uk_your_key_here",
});
const message = await client.messages.create({
model: "openai/gpt-5.4-pro",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello!" }],
});
console.log(message.content[0].text);curl https://idapt.app/api/anthropic/v1/messages \
-H "x-api-key: uk_your_key_here" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "google/gemini-2.5-flash",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello!"}]
}'You can use any model from the idapt catalog, not just Anthropic
models. Switch models by changing the model parameter.
POST /messages, Create a message (streaming and
non-streaming)
GET /models, List available models (with pagination)
GET /models/{id}, Get a single model's
details
The anthropic-version and anthropic-beta headers are accepted but not required.
Set stream: true to receive Server-Sent Events in the
Anthropic streaming format. Events include message_start, content_block_start, content_block_delta, content_block_stop, message_delta, and message_stop.
Token usage is reported in message_start(input tokens)
and message_delta(output tokens).
Use the full model ID including the provider prefix, for example anthropic/claude-sonnet-4.6, openai/gpt-5.4-pro, or google/gemini-2.5-flash.
Call GET /models to see all available models, or browse
the full catalog on the Models page.
Tool definitions use the Anthropic format with input_schema. Tool results are sent as tool_result content blocks in user messages.
Completions on this gateway need an active subscription or your own
provider key, the same options as the OpenAI-compatible gateway. Calls
without one return a 403 with code free_tier_requires_subscription. Language models bill at
the prices shown in the app, and bring-your-own-key calls bill to your
provider account.
Watch your spend on the usage page (/app/usage). See Plans, allowances, and credits for how the meters fit together.
Errors follow the Anthropic format. Common status codes:
400, Bad request (missing model, invalid params,
missing max_tokens)
401, Invalid or missing API key
403, Key lacks required permissions
429, Rate limit exceeded
The Anthropic SDK automatically parses these errors and throws typed exceptions.
Related articles
Switch from the Anthropic API
Point the Anthropic SDK or Claude Code at idapt's base URL: the same Messages API with usage tracking and per-key spend caps.
OpenAI-compatible API
Use idapt's 200+ models from any app that speaks the OpenAI API format.
Connect Claude Code
Drive your idapt workspace from Claude Code over the CLI or MCP, with a shared memory and agent identity.
Was this helpful?