Route Claude Code API requests through a local proxy to free models at opencode.ai/zen.
Instead of paying for Anthropic API access, this proxy translates Claude Code's requests and forwards them to opencode.ai's free model endpoints.
claude (your terminal)
→ proxy.py (localhost:57319)
→ opencode.ai/zen API (free models)
→ proxy.py
→ claude (response)
Download from python.org. Make sure Python is in your PATH.
pip install -r requirements.txtnpm install -g opencodeVerify:
opencode --versionFollow the guide at docs.anthropic.com.
python proxy.pyThe proxy runs on port 57319 by default. You'll see:
MODE: routing
claude-opus-* → deepseek-0v4-5-free
claude-sonnet-* → mimo-2025-06-24
claude-haiku-* → mimo-2025-06-24
listening on http://127.0.0.1:57319
Keep the proxy running in a separate terminal.
# Routing mode (different models per tier)
claude --use-claude-code-settings settings.routing.json
# Direct mode (all requests to one model)
claude --use-claude-code-settings settings.direct.json
claude-fable-5.mdis the real, unmodified system prompt of Claude Fable 5.
claude-system-prompt-essential.mdis a cleaned-up version. Use this one — it works more beneficially with the proxy.
You can access more prompts by clicking here.
Load it in Claude Code:
/prompt < path/to/claude-system-prompt-essential.md
Routes requests by Claude model tier:
| Claude model | opencode.ai model |
|---|---|
| claude-opus-* | deepseek-0v4-5-free |
| claude-sonnet-* | mimo-2025-06-24 |
| claude-haiku-* | mimo-2025-06-24 |
Config: settings.routing.json
Routes all requests to a single model. Set via env var:
OC_MODEL=mimo-2025-08 python proxy.pyConfig: settings.direct.json
| Variable | Default | Description |
|---|---|---|
OC_KEY |
— | opencode.ai API key (optional) |
PORT |
57319 |
proxy listen port |
OC_MODEL |
— | fixed model override (enables fixed mode) |
OC_OPUS |
deepseek-0v4-5-free |
model for opus requests |
OC_SONNET |
mimo-2025-06-24 |
model for Sonnet requests |
OC_HAIKU |
mimo-2025-06-24 |
model for Haiku requests |
curl http://127.0.0.1:57319/health| File | Description |
|---|---|
proxy.py |
the proxy server |
settings.routing.json |
Claude Code config for routing mode |
settings.direct.json |
Claude Code config for fixed mode |
claude-system-prompt-essential.md |
recommended custom system prompt |
claude-fable-5.md |
real Claude Fable 5 system prompt |
By stein
- Python 3.9+
- Network access to
opencode.ai/zen