proxy

module
v0.4.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2026 License: AGPL-3.0

README

routatic-proxy (prev OC-GO-CC) Join us on Discord

A Go CLI proxy that lets you route Claude Code requests through multiple upstream providers — OpenCode Go, OpenCode Zen, and AWS Bedrock — with automatic model selection and format transformation.

routatic-proxy sits between Claude Code and your chosen providers, intercepting Anthropic API requests, transforming them to the appropriate format (OpenAI, Anthropic, Responses, or Gemini), and forwarding them upstream. Claude Code thinks it's talking to Anthropic — but your requests go to the models and providers you configure.

oc-go-cc remains available as a compatibility alias, and existing OC_GO_CC_* environment variables and ~/.config/oc-go-cc/config.json files are still recognized.


✨ macOS GUI Version / macOS GUI 图形界面版

This fork repository provides a native macOS GUI (System Tray + Console Dashboard) for routatic-proxy. 本 Fork 仓库为 routatic-proxy 额外提供了 macOS 原生图形界面支持(系统托盘 + 内嵌控制台面板)。

Features / 功能特点
  • System Tray Icon (系统托盘) — Control the proxy server directly from the macOS status bar (Start, Stop, Autostart, Quit). 系统托盘图标 — 直接在 macOS 顶部状态栏中快捷控制代理服务的启动、停止、开机自启和退出。
  • Interactive Dashboard (内嵌控制台) — A beautiful native console window to view real-time request history, model usage metrics, and easily edit/save your API keys without editing JSON files. 交互式控制台 — 原生窗口控制台,支持查看实时历史请求、模型调用分布,并且无需手动编辑 JSON 配置文件,即可直接在界面中修改和保存 API Key。
  • App DMG Installer (DMG 一键安装) — Package into a standard macOS app with custom icons and launch support. DMG 一键安装包 — 提供标准的 macOS 应用程序打包,带有关机自启与双击运行托盘支持。
How to Run / 如何运行

You can download the compiled .dmg from the Releases page of this repository, or run the following command directly: 您可以直接在此仓库的 Releases 页面下载编译好的 .dmg 安装包,或者在终端运行以下命令启动:

# Launch with native macOS GUI
routatic-proxy ui

Why?

OpenCode Go gives you access to powerful open coding models for $5/month (then $10/month). OpenCode Zen provides curated, tested models with pay-as-you-go pricing. AWS Bedrock lets you run models on your own AWS infrastructure. This proxy makes all three work seamlessly with Claude Code's interface — no patches, no forks, just set two environment variables and go.

Features

  • Multi-Provider — Route through OpenCode Go, OpenCode Zen, or AWS Bedrock from a single config
  • Transparent Proxy — Claude Code sends Anthropic-format requests, proxy transforms to provider-native format and back
  • Model Routing — Automatically routes to different models based on context (default, thinking, long context, background)
  • Streaming Scenario Routing — Configurable routing for streaming requests; enables proper scenario selection for Claude Code multi-agent and review workflows (see CONFIGURATION.md)
  • Fallback Chains — If a model fails, automatically tries the next one in your configured chain
  • Circuit Breaker — Tracks model health and skips failing models to avoid latency spikes
  • Real-time Streaming — Full SSE streaming with live format transformation
  • Tool Calling — Proper Anthropic tool_use/tool_result <-> OpenAI/Gemini function calling translation
  • Token Counting — Uses tiktoken (cl100k_base) for accurate token counting and context threshold detection
  • JSON Configuration — Flexible config file with environment variable overrides and ${VAR} interpolation
  • Hot Reload — Watch config file for changes and reload automatically (off by default)
  • Background Mode — Run as daemon detached from terminal
  • Auto-start on Login — Launch on system startup via launchd (macOS)

Supported Models

OpenCode Go Models
Model Context Best For
GLM-5.2 ~200K tokens Critical architecture, production code review
Kimi K2.7 Code ~256K tokens Large code generation, 32K max output
Qwen3.7 Plus ~128K tokens General coding, better quality than Qwen3.6
Qwen3.7 Max ~128K tokens Complex coding, Qwen's best quality

See MODELS.md for the complete model list including costs and routing recommendations.

OpenCode Zen Models

Zen provides pay-as-you-go access to additional models:

  • Claude Models: Claude Fable 5, Claude Opus 4.8/4.6/4.5/4.1, Claude Sonnet 4
  • Gemini Models: Gemini 3.5 Flash, Gemini 3.1 Pro, Gemini 3 Flash
  • GPT Models: GPT 5.5, GPT 5.4, GPT 5.3 Codex, and more
  • Free Tier: DeepSeek V4 Pro, Grok Build 0.1, Big Pickle, and others

See MODELS.md for the full Zen model list.

Deprecated Models

The following models are deprecated and will be removed:

  • GPT 5.2/5.1/5 Codex variants (replaced by GPT 5.3 Codex)
  • Claude Sonnet 4 (replaced by Claude Sonnet 4.5/4.6)
  • GLM 5/4.7/4.6 (replaced by GLM 5.1/5.2)
  • MiniMax M2.1 (replaced by MiniMax M2.5/M2.7/M3)
  • Gemini 3 Pro (replaced by Gemini 3.1 Pro)
  • Kimi K2/K2 Thinking (replaced by Kimi K2.5/K2.6/K2.7 Code)

See MODELS.md for the complete deprecation schedule.

Quick Start

1. Install
# macOS / Linux
brew tap routatic/tap && brew install routatic-proxy

# Windows
scoop bucket add routatic https://github.com/routatic/scoop-bucket && scoop install routatic-proxy

# Docker (with Makefile)
cp .env.example .env                    # then put your API key in .env
make docker-up

# Docker (manual)
cp .env.example .env
docker build -t routatic-proxy .
docker run -d --restart unless-stopped --name routatic-proxy --env-file .env -p 3456:3456 routatic-proxy

# Docker from GitHub Container Registry
docker pull ghcr.io/routatic/proxy:latest
docker run -d --restart unless-stopped --name routatic-proxy --env-file .env -p 3456:3456 ghcr.io/routatic/proxy:latest

Or see INSTALLATION.md for more options.

2. Initialize Configuration
routatic-proxy init

Creates a default config at ~/.config/routatic-proxy/config.json. Edit it to add your API key, or set the environment variable:

export ROUTATIC_PROXY_API_KEY=sk-opencode-your-key-here
3. Start the Proxy
routatic-proxy serve

Stop the Docker container (if using Docker):

make docker-stop
4. Configure Claude Code
export ANTHROPIC_BASE_URL=http://127.0.0.1:3456
export ANTHROPIC_AUTH_TOKEN=unused
5. Run Claude Code
claude

CLI Commands

routatic-proxy serve              Start the proxy server
routatic-proxy serve -b           Start in background (detached from terminal)
routatic-proxy serve --port 8080  Start on a custom port
routatic-proxy stop               Stop the running proxy server
routatic-proxy status             Check if the proxy is running
routatic-proxy init               Create default configuration file
routatic-proxy validate           Validate configuration file
routatic-proxy models             List all available models (Go, Zen, Bedrock)
routatic-proxy autostart enable   Enable auto-start on login
routatic-proxy autostart disable  Disable auto-start on login
routatic-proxy autostart status   Check autostart status
routatic-proxy --version          Show version

Documentation

Document Description
INSTALLATION.md Homebrew, Scoop, build from source, release binaries
CONFIGURATION.md Config file reference, env vars, model routing, fallback chains
MODELS.md Model capabilities, costs, and routing recommendations
CONTRIBUTING.md Development setup, architecture, how it works
TROUBLESHOOTING.md Common issues and debug mode
docs/architecture.md System design, request flow, module overview
docs/reference-api.md HTTP API reference (endpoints, streaming, errors)
docs/howto-add-model.md Adding new models (zero code changes)
docs/howto-custom-routing.md Customizing scenario detection and model selection
docs/howto-debug-routing.md Debugging routing issues and common problems

License

AGPL-3.0

Directories

Path Synopsis
cmd
routatic-proxy command
Package main is the CLI entry point for the Routatic proxy server.
Package main is the CLI entry point for the Routatic proxy server.
internal
client
Package client manages upstream API client connections.
Package client manages upstream API client connections.
config
Package config handles application configuration loading and validation.
Package config handles application configuration loading and validation.
core
Package core defines the provider abstraction, wire format types, and capability metadata that form the foundation of the routing engine.
Package core defines the provider abstraction, wire format types, and capability metadata that form the foundation of the routing engine.
debug
Package debug provides request/response capture functionality for debugging.
Package debug provides request/response capture functionality for debugging.
gui
Package gui provides the embedded HTTP server that serves the GUI dashboard and exposes /api/* endpoints for metrics, history, and configuration.
Package gui provides the embedded HTTP server that serves the GUI dashboard and exposes /api/* endpoints for metrics, history, and configuration.
handlers
Package handlers contains HTTP request handlers for API endpoints.
Package handlers contains HTTP request handlers for API endpoints.
history
Package history maintains an in-memory ring buffer of recent proxy requests.
Package history maintains an in-memory ring buffer of recent proxy requests.
metrics
Package metrics provides in-memory metrics for the proxy.
Package metrics provides in-memory metrics for the proxy.
middleware
Package middleware provides HTTP middleware for the proxy.
Package middleware provides HTTP middleware for the proxy.
models
Package models provides model classification utilities shared across the client and provider packages.
Package models provides model classification utilities shared across the client and provider packages.
provider
Package provider implements the core.Provider interface for all supported upstream LLM providers.
Package provider implements the core.Provider interface for all supported upstream LLM providers.
router
Package router defines HTTP route registration and middleware chaining.
Package router defines HTTP route registration and middleware chaining.
server
Package server manages the HTTP server lifecycle.
Package server manages the HTTP server lifecycle.
token
Package token provides token counting utilities using tiktoken encoding.
Package token provides token counting utilities using tiktoken encoding.
transformer
Package transformer includes ctxio: a context-bound reader wrapper.
Package transformer includes ctxio: a context-bound reader wrapper.
tray
Package tray manages the macOS system tray icon and menu.
Package tray manages the macOS system tray icon and menu.
pkg
types
Package types defines shared data structures and interfaces.
Package types defines shared data structures and interfaces.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL