Local LiteLLM proxy for routing Claude Code to OpenCode Go.
Project description
oc-cc-proxy
oc-cc-proxy runs a local LiteLLM Proxy that lets Claude Code send Anthropic Messages API requests to OpenCode Go's OpenAI-compatible endpoint.
The proxy listens on http://127.0.0.1:4000 by default and routes all Claude Code model names through LiteLLM wildcard passthrough to https://opencode.ai/zen/go/v1/chat/completions.
Quickstart (uvx)
uvx oc-cc-proxy --api-key your-key-here
You can still use OPENCODE_GO_API_KEY from the environment or a .env file instead. The proxy fails before accepting requests if neither --api-key nor OPENCODE_GO_API_KEY is provided.
uvx should run this package with Python 3.12 or 3.13. LiteLLM's current uvicorn and uvloop stack is not compatible with Python 3.14 yet.
Claude Code Settings
Add equivalent environment values to your Claude Code user-scope settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "http://127.0.0.1:4000",
"ANTHROPIC_API_KEY": "dummy-key-for-claude-code",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4-flash",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "qwen3.6-plus",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-v4-pro"
}
}
ANTHROPIC_API_KEY only needs to be non-empty for the local proxy path. OpenCode Go authentication uses the --api-key flag or OPENCODE_GO_API_KEY on the proxy process.
Configuration
--api-key: optional CLI override for the OpenCode Go API key. Recommended foruvxusage.OPENCODE_GO_API_KEY: required if--api-keyis not provided.OC_PROXY_HOST: optional host override, defaults to127.0.0.1.OC_PROXY_PORT: optional port override, defaults to4000.
Local Development Setup
-
Install dependencies:
uv sync -
Configure the OpenCode Go API key:
cp .env.example .env
-
Edit
.envand setOPENCODE_GO_API_KEY. -
Start the proxy:
uv run oc-cc-proxy
Validation
With the proxy running, validate non-streaming text, wildcard model passthrough, streaming terminal events, tool definitions, tool results, and streamed tool requests:
uvx oc-cc-proxy-validate --model deepseek-v4-pro
Expected successful output starts each check with ok:. Any dropped, malformed, or ignored tool-call behavior should be treated as a blocking compatibility issue before describing the proxy as Claude Code-ready.
Project-local checks:
uv run pytest
uv run ruff check .
Debugging
Enable LiteLLM verbose logging and local request-shape diagnostics:
uvx oc-cc-proxy --debug
If uvx selected Python 3.14, pin a supported runtime explicitly:
uvx --python 3.12 oc-cc-proxy --api-key your-key-here
Debug helpers redact sensitive headers such as Authorization, x-api-key, and api-key. Avoid pasting raw upstream logs publicly unless you have checked them for secrets.
To inspect the generated LiteLLM config path without starting the server:
uvx oc-cc-proxy --print-config --config /tmp/oc-cc-proxy-litellm.yaml
Validated Models
These models pass the full oc-cc-proxy-validate suite (non-streaming text, wildcard passthrough, streaming terminal events, tool definitions, streamed tool metadata, and tool-result follow-up):
glm-5.1glm-5kimi-k2.5kimi-k2.6deepseek-v4-prodeepseek-v4-flashmimo-v2.5mimo-v2.5-prominimax-m2.7minimax-m2.5qwen3.6-plusqwen3.5-plus
Current Limitations
- Tool-use compatibility must be validated against a live OpenCode Go account and target model before claiming a model is known-good for Claude Code.
- DeepSeek V4 and Kimi K2.x models require their returned reasoning metadata to be replayed on assistant tool-call history. The proxy installs a LiteLLM callback that converts Anthropic
thinkingblocks back into upstreamreasoning_contentbeforetool_resultfollow-up turns. Non-reasoning models (Qwen, GLM, MiMo, MiniMax) havethinking_blocksstripped unconditionally to avoid upstream rejection. - MiniMax M2.7 emits empty
choiceschunks during streaming that LiteLLM's stream handler rejects. The proxy monkeypatches LiteLLM's Anthropic streaming adapter and repetition guard at import time to tolerate these chunks. - Anthropic-specific features such as prompt caching, extended thinking, and any endpoints beyond
/v1/messagesare not claimed as supported unless separately validated.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oc_cc_proxy-0.1.4.tar.gz.
File metadata
- Download URL: oc_cc_proxy-0.1.4.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d8dc0f56bdafdac729f78e8db3f62d525baf9a88f9a9d046926d7fdf41026cd
|
|
| MD5 |
781fc193660cf783458a057f435f0c58
|
|
| BLAKE2b-256 |
4f1eaf9fa4976c7a3c3cb49fb6233cfc413ebd2ea3c4774c01731fedde467f78
|
File details
Details for the file oc_cc_proxy-0.1.4-py3-none-any.whl.
File metadata
- Download URL: oc_cc_proxy-0.1.4-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79bb10330de1abd14875b9432f103d86cde74571d23d9fcd7d20a86a4f1135c6
|
|
| MD5 |
8525acd362b967d755330f6709f68d0f
|
|
| BLAKE2b-256 |
7fd3c1ca6340f552940829777fbc88b07e1a1e6040e24e9998e0fc30536e29fa
|