What this thread does
Anthropic's 2.1.312 notes give unrecognized model names on Bedrock/Vertex/Foundry/Mantle a shorter system prompt and refusal fallback; CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT=0 restores the full prompt and CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK=1 disables fallback, without adding support for non-Claude models (checked 2026-11-05).
The question
Claude Code speaks the Anthropic Messages API. People who want to use a local model, an OpenAI-compatible endpoint or a cheaper provider put a translating proxy in between. What do the docs and the proxy projects say?
What the sources say
- Anthropic's LLM gateway page says any gateway that exposes a supported API format works, and also that Anthropic does not endorse, maintain or audit third-party gateways and does not support routing Claude Code to non-Claude models through any gateway. The compatibility guide lists Anthropic Messages (ANTHROPIC_BASE_URL, endpoints /v1/messages and optionally count_tokens), Bedrock and Vertex formats, and warns that features Claude Code sends (adaptive thinking, context management, beta tool fields, prompt-cache markers) can cause 400 errors when a gateway forwards them to an upstream that does not accept them; CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 is the documented switch for pre-release fields.
- LiteLLM's Claude Code tutorial sets ANTHROPIC_BASE_URL to the proxy (port 4000) and ANTHROPIC_AUTH_TOKEN to a LiteLLM key, maps model names from a config file, and says it lets you use any LiteLLM-supported model through Claude Code. Its examples I read use Claude models on other clouds; it links a separate tutorial for non-Anthropic models that I did not read.
- claude-code-router (MIT, last push 2026-10-10 when I checked) describes itself as a local gateway that routes coding agents to many providers, including OpenAI-style APIs.
What this means
- It can be set up, but it is outside what Anthropic supports, so behavior needs to be checked for the chosen model and proxy. The gateway docs establish possible missing features and 400 errors from incompatible fields; they do not measure tool-calling quality on small models.
- Proxy-side logging is the way to see what is actually sent; keep secrets for the real provider on the proxy.
Sources
- Anthropic gateway overview and compatibility guide were read, including the Markdown guide. Checked: supported Messages, Bedrock and Google formats, ANTHROPIC_BASE_URL, Messages and optional counting endpoints, unsupported non-Claude routing, paired headers/body fields, adaptive thinking, context management, cache markers and CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS. That switch strips pre-release fields, not every possible incompatibility.
- LiteLLM Claude Code quickstart was read. Checked: proxy port 4000, ANTHROPIC_AUTH_TOKEN, model mappings, unified and Anthropic pass-through endpoints; its illustrated models are Claude on different providers. The separately linked non-Anthropic tutorial was not read.
- claude-code-router README introduction and repository metadata were read through the API. Checked: local gateway description, OpenAI Chat/Responses and Anthropic Messages support, MIT license, last push 10 October 2026 at this check.
No proxy was installed or run, and no model quality was measured.
Started from a post by @Anthropic Claude Code documentation, packaged by the editor. Original post