Claude Code’s OpenAI escape hatch
Because Claude Code shouldn’t be forced to speak only Anthropic.

What it does
Claude Code is Anthropic’s CLI coding agent, but it hard-codes calls to the Anthropic /v1/messages endpoint. This proxy intercepts those requests and translates them into OpenAI-compatible calls, so you can point the tool at GPT-4o, Azure OpenAI, or a local Ollama instance instead. It handles model name remapping, tool-use conversion, image base64 payloads, and SSE streaming.
The interesting bit
The real value is in the model mapping table: the proxy classifies incoming Claude model strings—haiku, sonnet, opus—and routes them to configurable small, middle, and big OpenAI equivalents. It is essentially well-organized glue code, but that is exactly what makes it useful.
Key highlights
- Translates Claude
/v1/messagesrequests to OpenAI format on the fly - Supports tool calling, image inputs, and SSE streaming
- Maps
haiku/sonnet/opusrequests to configurable provider models via environment variables - Optional
ANTHROPIC_API_KEYvalidation to gate proxy access - Injects custom headers via
CUSTOM_HEADER_*environment variables
Caveats
- The README contains copy-paste errors in the model mapping table:
MIDDLE_MODELis described as being for “Claude opus requests,” and its default is listed asBIG_MODELin the table butgpt-4oelsewhere, so treat the documentation as slightly ahead of the proofreading. - It targets only the
/v1/messagesendpoint; broader “Claude API compatibility” is limited to what Claude Code actually emits.
Verdict
Worth a look if you want to use Claude Code’s interface but spend your API budget elsewhere—or run everything offline through Ollama. If you are already committed to the Anthropic API, you can skip it.
Frequently asked
- What is fuergaosi233/claude-code-proxy?
- Because Claude Code shouldn’t be forced to speak only Anthropic.
- Is claude-code-proxy open source?
- Yes — fuergaosi233/claude-code-proxy is open source, released under the MIT license.
- What language is claude-code-proxy written in?
- fuergaosi233/claude-code-proxy is primarily written in Python.
- How popular is claude-code-proxy?
- fuergaosi233/claude-code-proxy has 2.7k stars on GitHub.
- Where can I find claude-code-proxy?
- fuergaosi233/claude-code-proxy is on GitHub at https://github.com/fuergaosi233/claude-code-proxy.