Claude Code to OpenCode Go adapter — route Anthropic format to OpenAI models
Project description
cc2go v0.8.0
Claude Code → OpenCode Go Adapter
A lightweight proxy that lets Claude Code use any OpenAI-compatible model
Web admin page — switch models, add endpoints, view logs
Features
- 🔄 Protocol translation — Converts Anthropic Messages API to OpenAI Chat Completions
- 🌐 Web UI — Built-in admin page at
http://localhost:4001, click to switch models - 🎯 Model switching — Click to switch models, auto-syncs to Claude Code settings
- ➕ Custom models — Add your own endpoints with independent API keys and URLs
- 🖼️ Image support — Converts Anthropic image blocks to OpenAI image_url format
- ⚡ Streaming — Real-time SSE streaming conversion (OpenAI → Anthropic format)
- 🔁 Adaptive retry — Error classification with exponential backoff, max 3 retries
- 📋 Log management — Built-in log viewer with rotation (5MB per file, 3 backups)
- 🖥️ System tray — Tray icon for opening admin page and quitting; auto-opens admin on start
- 💰 Token saving — Strips
<system-reminder>,[思考过程]reasoning, andthinkingblocks before forwarding upstream - 💾 Config backup — Auto-backup original Claude Code config on first model switch; one-click restore from admin UI
- 🔑 Security — Defaults to 127.0.0.1 (local-only), Bearer Token authentication on proxy endpoints
- 🔧 Tool name sanitization — Replaces special characters in tool names to prevent 400 errors
- 🧹 Schema cleaning — Recursively removes incompatible JSON Schema fields for broader model compatibility
- 🔄 Model switching compatibility — Auto-completes missing tool results when switching between strict (DeepSeek) and lenient (MiniMax) models
- ⚡ Web search bypass — Intercepts
web_searchtool calls at the response level, runsmmxsearch locally, returns results immediately without extra round-trips
Getting Started (For Non-Technical Users)
Step 1: Download
Download the latest release from GitHub Releases. Extract the ZIP file to any folder (not Program Files).
Step 2: Configure API Key
- Open the extracted folder
- Copy
.env.exampleto.env(or create a new file named.env) - Open
.envwith a text editor (like Notepad) and add your OpenCode Go API key:OPENCODE_API_KEY=your_api_key_here
Step 3: Run
Double-click start_bg.bat in the folder.
A system tray icon will appear. The admin page will open automatically in your browser.
Step 4: Open in Claude Code
In Claude Code's settings, configure:
| Setting | Value |
|---|---|
| Base URL | http://localhost:4001 |
| API Key | sk-cc2go-local |
That's it! Use Claude Code as normal — select models from the web admin page at http://localhost:4001.
How to Quit
Right-click the system tray icon → click "Exit".
For Developers
pip install -r requirements.txt
cp .env.example .env # Edit .env with your API key
python src/router.py
Scripts (Windows)
scripts\start_bg.bat # Background mode (system tray, no terminal)
scripts\stop.bat # Stop background process
Docker
docker build -t cc2go .
docker run -d -p 4001:4001 --env-file .env cc2go
Access at http://localhost:4001.
Linux Service (systemd)
For permanent deployment on Linux:
# Copy service file
sudo cp cc2go.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable cc2go
sudo systemctl start cc2go
Requires a cc2go user and /opt/cc2go installation directory.
API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Web admin UI |
/v1/messages |
POST | Claude format entry (Anthropic → OpenAI) |
/v1/chat/completions |
POST | OpenAI format passthrough |
/v1/models |
GET | List available models |
/health |
GET | Health check |
/api/config |
GET/PUT | Configuration management |
/api/custom-models |
GET/PUT | Custom model management |
/api/logs |
GET | Recent log entries |
Custom Model Routing
| Endpoint | Behavior |
|---|---|
/v1/messages |
Anthropic format passthrough (no conversion, thinking blocks preserved) |
/v1/chat/completions |
OpenAI format conversion (tool_calls gets reasoning_content="" if missing) |
Configuration
All configuration via Web UI (http://localhost:4001):
- Connection — OpenCode Go base URL and API key
- Service — Host, port, master key (auto-syncs to Claude Code)
- Custom Models — Add/edit/remove custom model endpoints
- Logs — View logs, set log level, toggle detailed logging
License
MIT
Technical details in ARCHITECTURE.md
Project details
Release history Release notifications | RSS feed
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 cc2go-0.8.0.tar.gz.
File metadata
- Download URL: cc2go-0.8.0.tar.gz
- Upload date:
- Size: 27.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0633c34d71d658fb4a2239fb65808947710d33503141b6e732b7d061cd5c5aa
|
|
| MD5 |
6cb7e49425767b6673d217e1b737ebfa
|
|
| BLAKE2b-256 |
84c00170824403dd93ce8374cf77534edbefdce88cf4a65ae8e05193abaf13f8
|
File details
Details for the file cc2go-0.8.0-py3-none-any.whl.
File metadata
- Download URL: cc2go-0.8.0-py3-none-any.whl
- Upload date:
- Size: 30.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2090c5ab8a393dcb53383eacba9d835eda1f443bb9b760ab3d336af0fb3a814f
|
|
| MD5 |
f27f6d9442417505b0f128a31de2deba
|
|
| BLAKE2b-256 |
67b212142355b8ea900c481a1f600e2e3cea579670fce4d328a88d36e887432c
|