Skip to main content
Claude Code and any Anthropic SDK run on Runcrate models: point them at https://api.runcrate.ai with your Runcrate API key and a Runcrate model id. Requests are billed, rate limited and routed exactly as chat completions are, at the same per-token prices.

Claude Code

ANTHROPIC_MODEL is required. Without it Claude Code sends its own model names (claude-sonnet-4-5, claude-haiku-4-5), which are not Runcrate model ids: each request answers 404, which Claude Code reports as an issue with the selected model (the API’s message says to set ANTHROPIC_MODEL). ANTHROPIC_DEFAULT_HAIKU_MODEL is the model Claude Code uses for its background tasks, such as naming a session. Any text model in the model catalog works; one with tool calling is needed for Claude Code to read files and run commands. ANTHROPIC_API_KEY works in place of ANTHROPIC_AUTH_TOKEN; Claude Code then sends the key as x-api-key. Claude Code assumes a 200K-token context window for a model id it does not know, and compacts the conversation at that size, whatever the model’s own window.

Endpoint

The key goes in x-api-key (as the Anthropic SDKs send it) or Authorization: Bearer. anthropic-version and anthropic-beta headers are accepted.

Basic usage

Streaming

With stream: true the answer arrives as Anthropic’s events: message_start, ping, then each block as content_block_start, its deltas (text_delta, thinking_delta, input_json_delta) and content_block_stop, then message_delta with the stop reason and usage, and message_stop.

Tools

Custom tools take name, description and input_schema. A tool call comes back as a tool_use block with its input parsed; send the result back as a tool_result block (is_error: true marks a failure).

Thinking

thinking: {type: "enabled", budget_tokens} sets the model’s reasoning effort: a budget under 4,096 is low, under 16,384 medium, and anything larger high. output_config.effort (low, medium, high, max) takes precedence. A reasoning model’s reasoning comes back as thinking blocks before the answer; send them back or not, they are not passed to the model again.

What is supported

stop_sequence is named when the model reports which sequence it stopped on; otherwise a stop is end_turn.

Counting tokens

POST /v1/messages/count_tokens takes the same body and answers {"input_tokens": N}: an estimate at four characters a token, 1,000 tokens an image and four tokens a message. It is not billed. Each model counts its own way, so the usage on the response is the exact figure.

Errors

Errors use Anthropic’s shape, with Runcrate’s code named in the message and kept as code. Any other detail of the error (a free allowance’s free_tier reset times and what remains) is kept beside it, and a Retry-After header says when to retry a 429 or 503.