Anthropic SDK and Claude Code
Zabio serves Anthropic’s Messages API on the same host and key as the OpenAI-compatible API. Tools built on Anthropic’s SDKs, Claude Code among them, work with two settings changed: the base URL and the key. Your account, your credit and your bill are the same ones.
| Path | What it is |
|---|---|
POST /v1/messages |
Anthropic’s Messages API: a message, or a stream of Anthropic’s events |
POST /v1/messages/count_tokens |
Anthropic’s token count |
GET /v1/models with an anthropic-version header |
the model list in Anthropic’s shape |
Base URL and key
Section titled “Base URL and key”The Anthropic SDKs add /v1/messages themselves, so their base URL has no /v1:
| Client | Base URL |
|---|---|
| Anthropic SDKs, Claude Code | https://api.zabio.ai |
| OpenAI SDKs | https://api.zabio.ai/v1 |
Send your Zabio key either way the SDKs do: x-api-key: zb_live_... or Authorization: Bearer [MASKED] The anthropic-version` header is accepted with any value.
import anthropic
client = anthropic.Anthropic(base_url="https://api.zabio.ai", api_key="insert your zabio.ai key here")message = client.messages.create( model="claude-sonnet-5", 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://api.zabio.ai", apiKey: "insert your zabio.ai key here" });const message = await client.messages.create({ model: "claude-sonnet-5", max_tokens: 1024, messages: [{ role: "user", content: "Hello" }],});Claude Code
Section titled “Claude Code”Set three environment variables before you start claude:
export ANTHROPIC_BASE_URL="https://api.zabio.ai"export ANTHROPIC_AUTH_TOKEN="insert your zabio.ai key here"export ANTHROPIC_API_KEY=""ANTHROPIC_AUTH_TOKEN sends your Zabio key as a bearer token. ANTHROPIC_API_KEY must be set and empty, so Claude Code does not use a key of Anthropic’s or ask you to log in to Anthropic. Claude Code’s own model settings pick the model: ANTHROPIC_MODEL=auto lets Zabio choose for every request, and /model inside a session switches to any model id from GET /v1/models. Anthropic’s dated model ids, which Claude Code uses for its background calls (claude-haiku-4-5-20251001), are served by the model of the same name without the date (claude-haiku-4-5).
Claude Code’s advisor is not available through Zabio. When you set an advisor model, Claude Code adds Anthropic’s advisor tool to each request; Zabio removes it, lists it in zabio.ignored_parameters, and the session goes on without the advisor. The same holds for every other tool Anthropic runs on its side (see Server tools).
Which model answers
Section titled “Which model answers”- A Claude model named in
model(claude-sonnet-5,claude-opus-5-5,claude-haiku-4-5): Zabio sends your request body to Anthropic as you wrote it, with your system blocks, yourcache_controlmarkers, thinking blocks and their signatures, images and documents. The answer is Anthropic’s message or Anthropic’s stream, with Zabio’s id. Zabio writes three things over your body: the model id,max_tokenswhen your plan or your balance caps the answer, andmetadata.user_id, which becomes an opaque id derived from your organization and your value (on your own Anthropic key, your value). See What the vendor receives. Where the model you named refuses a field, Zabio changes it so the request does not fail, and the answer says so. On the Claude 5 models,claude-opus-4-8andclaude-opus-4-7,temperature,top_pandtop_kare left out and listed inzabio.dropped_parameters, andthinkingwithbudget_tokensgoes as adaptive thinking at the effort the budget stands for (listed asbudget_tokens). On a model that always thinks (claude-fable-5-2,claude-fable-5-1,claude-fable-5,claude-opus-5-5,claude-opus-5,claude-sonnet-5-5),thinking: {"type": "disabled"}goes as adaptive thinking at the lowest effort, andzabio.reasoning.appliednames it. A forced tool choice (anyortool) onclaude-fable-5-2,claude-fable-5-1,claude-opus-5-5orclaude-sonnet-5-5is refused with 400 before it reaches Anthropic, which refuses it too (see Forced tool choice). auto,auto/best,auto/balanced,auto/cheap, or a model of another vendor (gpt-5-mini,gemini-3.5-flash): the request is translated, routed like a chat completion, and the answer is translated back into Anthropic’s shape. auto may pick any vendor’s model, Claude included. See Models.
Every call is billed as the same call on chat completions: the provider list price plus the fee, with Anthropic’s cache reads and writes at their own rates. A Claude call that writes to the one hour cache is billed at the one hour write rate.
What the translation does not carry
Section titled “What the translation does not carry”These apply to auto and to other vendors’ models, never to a Claude model named in model:
| In your request or answer | What happens |
|---|---|
| Thinking blocks in earlier turns | left out; other vendors cannot read Anthropic’s signatures |
| Thinking in the answer | not returned; the answer has text and tool calls only |
cache_control markers |
not sent; the other vendors cache a repeated prefix on their own |
top_k |
not sent; listed in zabio.ignored_parameters |
Messages with the system role between the turns |
sent in place as user text; the other vendors take no system message there |
thinking and output_config.effort |
read as a reasoning level on Zabio’s scale (a budget under 4,096 tokens is low, under 16,384 medium, from there high; max is the highest) |
stop_sequence in the answer |
null: the stop reason is stop_sequence, but the sequence that matched is not named |
The usage in a stream’s message_start |
zero; the counts arrive in message_delta |
Document blocks, images inside a tool_result, Anthropic-defined tools (bash_*, text_editor_*, computer_*, memory_*) |
refused with invalid_request_error: name a Claude model to send them |
On a Claude model named in model, a request that carries one of the items in the last row stays with Anthropic when Anthropic fails: your key’s fallback reaches other Claude models only.
What Zabio does not serve on this path
Section titled “What Zabio does not serve on this path”Refused with 400 invalid_request_error, nothing sent to a vendor:
| Field or value | Why |
|---|---|
container, mcp_servers |
Anthropic’s code execution containers and its MCP connector are not served. Run your MCP client yourself and send its tools as custom tools |
speed: "fast" |
fast mode has its own prices; Zabio serves the standard speed |
inference_geo other than global |
data residency has its own prices; Zabio serves global inference |
| A field Anthropic’s Messages API does not have | as Anthropic answers it: <field>: Extra inputs are not permitted. |
Server tools
Section titled “Server tools”Anthropic’s web search passes through on a Claude model named in model that takes web search (one whose zabio.pricing.per_search is set in GET /v1/models): the web_search_20250305 tool, as you send it, with Anthropic’s own blocks in the answer (server_tool_use, web_search_tool_result, the text’s citations). Each search Anthropic counts (usage.server_tool_use.web_search_requests) is billed on its own line beside the call, at the vendor’s price per search with Zabio’s fee, and shown in zabio.search and zabio.cost; the results count as input tokens. A web search tool that sets no max_uses gets max_uses: 5, the most the call may run and what its balance check counts; a value you send is kept. On your organization’s own Anthropic key the tool passes through and Anthropic bills you the searches itself.
Where web search is not served, the tool is removed and listed in zabio.ignored_parameters as tools: <type> with the reason, and the call goes on without it: on auto and other vendors’ models, on a model that does not take web search, on a key whose web search is turned off and on the Free plan’s limits. The later versions of the tool (web_search_20260209 and after), which run code on Anthropic’s side, are removed the same way.
The other tools that Anthropic runs on its side (web_fetch_*, code_execution_*, the advisor advisor_* and the others) are charged per use by Anthropic, a charge Zabio does not bill. They are removed from your request before it reaches any model, each one is listed in zabio.ignored_parameters as tools: <type>, and the call goes on with your other tools. A tool_choice that names a removed tool becomes auto. Use custom tools for what you need the model to call.
service_tier is accepted and not sent: calls run at the standard tier. These anthropic-beta values are not passed on, and each one is listed in zabio.ignored_parameters: context-1m-* (on the models that need it, Anthropic prices prompts over 200,000 tokens higher), fast-mode-*, mcp-client-*, code-execution-*, skills-*, files-api-* and oauth-*. Every other beta reaches Claude models as you sent it.
Streaming
Section titled “Streaming”With stream: true the answer is Anthropic’s events: message_start, then content_block_start, content_block_delta and content_block_stop for each block, message_delta with the stop reason and the usage, and message_stop. On a Claude model named in model they are Anthropic’s own events, ping and thinking deltas included. While the model has not started its answer, Zabio may send SSE comment lines (: ZABIO PROCESSING) to keep the connection open; the SDKs skip them. Zabio may still move a request to another model while nothing of the answer has been sent, so a long thinking phase reaches you when the first text or tool call starts. A failure in the stream ends it with Anthropic’s error event.
Counting tokens
Section titled “Counting tokens”POST /v1/messages/count_tokens takes the request without max_tokens and answers {"input_tokens": N}. On a Claude model the count is Anthropic’s. On auto and other vendors’ models it is Zabio’s estimate, the one admission uses, marked "zabio": {"estimated": true}. Counting is free and counts toward your key’s request rate limit.
The model list
Section titled “The model list”GET /v1/models with an anthropic-version header (the Anthropic SDKs send it) answers in Anthropic’s shape: data with type, id, display_name and created_at for each model, then has_more, first_id and last_id. limit (1 to 1,000, 20 by default), after_id and before_id page through it. The list is the same one as without the header: the auto models first, then every model your key may call.
Errors
Section titled “Errors”Errors on these paths use Anthropic’s envelope, so the SDKs raise their own exceptions:
{ "type": "error", "error": { "type": "not_found_error", "message": "The model 'claude-nope' does not exist or you do not have access to it." }, "request_id": "req_6f1c...", "zabio": { "code": "model_not_found" }}zabio.code is the code the same error has on the OpenAI paths. See Errors for the status codes.
The zabio object
Section titled “The zabio object”A message carries the zabio object of a chat completion beside Anthropic’s fields: the vendor, the model that answered, the cost and, under auto, the routing. A stream does not carry it; read the x-zabio-vendor header and look the call up in Logs. Zabio’s request options go in the body’s zabio object or in the x-zabio-* headers, as on chat completions.