raine/claude-code-proxy

Use Claude Code with your ChatGPT, Kimi, Cursor or Grok subscription via a local Anthropic-compatible proxy

What it is

claude-code-proxy is a small local server that sits between the Claude Code editor (a coding‑assistant UI built on Anthropic’s Claude) and a variety of large‑language‑model providers such as OpenAI Codex, Kimi, Grok, OpenCode Go and Cursor Agent. It translates the Anthropic‑style API calls that Claude Code expects into the native APIs of those providers, handling authentication, model routing, streaming responses and basic diagnostics.

Why it matters

Claude Code already offers a rich set of coding‑assistant features (code‑completion, refactoring, documentation, sub‑agents, editor integrations). However, Claude Code is hard‑wired to Anthropic’s paid API. The proxy lets you keep the same UI while using any of the supported subscription‑based back‑ends, potentially lowering cost or giving access to models that have different strengths (e.g., Kimi‑for‑coding, Grok, Cursor). It also provides a local monitor UI so you can see request rates, token usage and errors in real time.

How to get started

  1. Install – on macOS/Linux you can brew install raine/claude-code-proxy/claude-code-proxy or run the one‑line installer script from the repo. Windows binaries are on the GitHub releases page.
  2. Authenticate – log in with a ChatGPT Plus or Pro account (the proxy uses the ChatGPT session token, not the OpenAI API key):
    claude-code-proxy codex auth login
    
  3. Run the proxy – start it in a terminal:
    claude-code-proxy serve
    
    Optionally add --no-monitor to run it as a background service and attach a TUI monitor later with claude-code-proxy monitor.
  4. Launch Claude Code – point the editor at the local proxy by setting a few environment variables, for example:
    ANTHROPIC_BASE_URL=http://127.0.0.1:18765 \
    ANTHROPIC_AUTH_TOKEN=unused \
    ANTHROPIC_MODEL=gpt-6-sol \
    claude
    
    The proxy will forward the request to the provider you authenticated with.
  5. Optional image generation – enable the Codex image endpoint with CCP_CODEX_IMAGES_API=1 and call the local /v1/images/generations endpoint; the proxy forwards the request to the signed‑in ChatGPT account’s image quota.

Key features

Feature What it does
Multi‑provider support Works with Codex, Kimi, Grok, OpenCode Go and Cursor Agent; you can list available models with claude-code-proxy models.
Authentication handling Logs in to the chosen provider (e.g., ChatGPT Plus) and stores the session token locally.
Protocol translation Accepts Anthropic‑style HTTP requests from Claude Code and converts them to the provider’s native API format.
Streaming responses Preserves the token‑by‑token streaming that Claude Code expects, so the UI feels instantaneous.
Local monitor TUI claude-code-proxy monitor shows active sessions, recent requests, errors, token usage and throughput.
Diagnostics & routing Routes requests to the appropriate model based on environment variables; can be configured per‑project.
Image generation (opt‑in) Exposes a /v1/images/generations endpoint that returns base64‑encoded images using the ChatGPT image quota.
Safety warning Binds only to 127.0.0.1 by default; users must add firewall or reverse‑proxy protection for any external exposure.

Who might use it

  • Developers who love Claude Code but want to swap in cheaper or specialized models.
  • Power‑users running multiple coding agents (e.g., via the author’s aven task queue) who need a single local endpoint that can route to different back‑ends.
  • Researchers experimenting with model performance across Codex, Kimi, Grok, etc., without rewriting the Claude Code client.

Limitations

  • The proxy only accepts local (loopback) connections; exposing it publicly requires extra security steps.
  • It relies on subscription accounts for each provider; the proxy does not provide any free‑tier access.
  • Unofficial use may violate provider terms, so users assume the risk.

Further reading

The repo links to extensive documentation (getting‑started guide, provider comparison, configuration options, HTTP API reference, and a monitor TUI guide) hosted at claude-code-proxy.raine.dev.


License: MIT

Related

  • Project
  • Project
  • Project
  • Project
  • Project