← all repositories
fuergaosi233/claude-code-proxy

Claude Code’s OpenAI escape hatch

Because Claude Code shouldn’t be forced to speak only Anthropic.

claude-code-proxy
Not currently ranked — collecting fresh signals.
star history

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/messages requests to OpenAI format on the fly
  • Supports tool calling, image inputs, and SSE streaming
  • Maps haiku/sonnet/opus requests to configurable provider models via environment variables
  • Optional ANTHROPIC_API_KEY validation 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_MODEL is described as being for “Claude opus requests,” and its default is listed as BIG_MODEL in the table but gpt-4o elsewhere, so treat the documentation as slightly ahead of the proofreading.
  • It targets only the /v1/messages endpoint; 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.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.