Claude Code
Route Claude Code through ToyGate by overriding the Anthropic base URL.
Claude Code talks to the Anthropic Messages API by default. Override its base URL with the gateway's root and it will route through the gateway transparently — the gateway accepts Anthropic-format requests on /v1/messages for models whose provider_format is anthropic.
Config
Note: no /v1 suffix here. Claude Code appends /v1/messages itself.
Verify
Expected: a normal Claude Code response. Streaming sessions stream; tool-call sessions make tool calls.
Model compatibility
Claude Code expects Anthropic-shaped responses (message_start, content_block_delta, message_stop). Use it only with model slugs whose provider_format is anthropic. The catalog page for each model shows its provider format; mismatches return upstream_invalid_response (502) — the gateway noticed the upstream sent the standard chat-completion shape when Claude Code expected Anthropic shape.
Troubleshooting
- Tool calls don't work — verify that the model's
capabilities.toolsistruein the catalog. Some upstreams disable tool calls for specific model snapshots. - HTTP 401 with
error.type: "authentication_error"— the key needs to be agw_…key (not an Anthropic-issued key). The Anthropic-shaped response has no separate public code field; the corresponding OpenAI-compatible auth envelope usescode: null. upstream_invalid_response— usually means you pointed Claude Code at a model whoseprovider_formatisopenai(notanthropic). Either switch models or use a Claude variant.
Gateway URL: https://api.toygate.store