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, limited and routed exactly as chat completions are, at the same per-token prices, with no per-minute cap on paid models beyond a high abuse guard.

Claude Code

Paste this one line into Claude Code. It reads the steps written for it, asks you for your API key and the model, and sets itself up; then restart it.
ANTHROPIC_BASE_URL is https://api.runcrate.ai, and ANTHROPIC_AUTH_TOKEN carries your Runcrate key. Claude Code assumes 200K tokens for a model it does not know. CLAUDE_CODE_MAX_CONTEXT_TOKENS gives it this model’s 1M.
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.

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 refusal’s free_tier.resets_at, when free usage comes back) is kept beside it, and a Retry-After header says when to retry a 429, 503 or 529. A free refusal that can be paid for instead (free_allowance_used, free_tier_paused, free_prompt_too_large, github_link_required, free_tier_card_required) also carries free_tier.upgrade: add_credit_url (the billing page), topup_api and topup_docs (an agent can top up by API once Top-ups are on for its key), min_amount_usd (20) and paid_price, what the free models cost once paid for, in words. overloaded and the free per-minute limit (rate_limit_exceeded) have none: they are not a reason to pay. free_tier_card_required is the 402 a Google sign-up gets until it has a card on file; its free_tier carries action: "add_card" and add_card_url. Free usage comes first, and anything beyond it is charged to the card by automatic top-up. A key that is refused on the free allowance more than 20 times in a minute gets the same refusal as a 429 with a Retry-After of at least 300 seconds (longer when the refusal’s own wait is longer) and x-should-retry: false, and the same code; stop the loop, or add credit, and the next request is served as usual.