← Back to Discover

ccg-router

Open-source local daemon that routes Claude Code and Codex CLI traffic through one port, with three routing strategies and a local SQLite ledger of every request.

Command-line toolsModel APIs

What it does

ccg-router is a small daemon for developers who use both Claude Code and Codex CLI. It listens on a local port and accepts Anthropic-compatible and OpenAI-compatible requests at the same address, so both command-line tools can be pointed at it through their base-URL environment variables. Requests are forwarded to the upstream provider you configure. Provider keys stay in a local config file and there is no hosted control plane. Each request is recorded as a row in a local SQLite ledger that can be queried from the terminal, with an optional encrypted ledger at rest. A read-only local dashboard and a Prometheus-compatible metrics endpoint are also provided. Three routing strategies are available: prefer-cheaper, prefer-capable and round-robin. The page lists streaming passthrough for both protocols and a provider-compatibility guide covering services such as OpenRouter, DeepSeek, Groq, Together, Ollama and LM Studio. It can be installed with Homebrew, a release installer, go install or Docker. The repository is under the Apache-2.0 licence. It compares itself with claude-code-router and says that tool is the more mature choice if you only use Claude Code.

Capabilities

  • One local port serving Anthropic-compatible and OpenAI-compatible endpoints
  • Prefer-cheaper, prefer-capable and round-robin routing
  • Per-request local SQLite usage ledger, optionally encrypted
  • Streaming passthrough for both protocols
  • Read-only local dashboard and Prometheus-compatible metrics
  • Provider keys kept in a local config file

When to use it

  • Using Claude Code and Codex CLI side by side and wanting a single routing point
  • Tracking what your AI coding usage costs without a hosted dashboard
  • Switching between compatible providers by strategy instead of editing shell variables

Alternatives to explore

  • claude-code-router