claude-code-router

command module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2026 License: BSD-2-Clause Imports: 5 Imported by: 0

README

claude-code-router

CI

Local HTTP router for Claude Code that forwards /v1/messages requests to one of several LLM providers (Anthropic subscription, MiniMax, local Ollama, company vLLM/DeepSeek) based on the request's model field — using a declarative config at ~/.dark-factory/config.yaml.

v1 skeleton state (this commit): minimal HTTP listener on 127.0.0.1:8788 with a /healthz endpoint. Provider routing logic + config loading land in subsequent commits.

Install

  1. Install the binary onto your PATH:

    make install
    

    Drops claude-code-router into $(go env GOPATH)/bin/.

  2. Run it continuously in the background — pick your platform:

  3. Add the clauder shell function (below) so your Claude Code sessions can route through it.

clauder shell function

clauder is a one-line wrapper that points Claude Code at the local router for a single invocation. The choice stays per-session: claude still talks directly to Anthropic, clauder goes through the router.

Append to ~/.zshrc (or ~/.bashrc on Linux):

# Routes Claude Code through claude-code-router on 127.0.0.1:8788.
# WICHTIG: do NOT set ANTHROPIC_API_KEY — that overrides the subscription
# OAuth bearer and breaks auth. clauder sets only ANTHROPIC_BASE_URL.
clauder() {
  ANTHROPIC_BASE_URL="http://127.0.0.1:8788" claude "$@"
}

Reload the shell (source ~/.zshrc) and use clauder whenever you want the router in the loop:

clauder                 # interactive Claude Code session via the router
clauder --resume        # resume previous session via the router
clauder -p "summarize"  # one-shot prompt via the router
claude                  # direct to Anthropic, router not involved

Develop

make precommit   # gofmt, lint, vet, test, vulncheck
make run         # run locally on 127.0.0.1:8788

License

BSD-2. See LICENSE.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
cli
Package cli holds the application struct that service.MainCmd parses CLI args into, plus the Run entry-point that delegates to the injected server factory.
Package cli holds the application struct that service.MainCmd parses CLI args into, plus the Run entry-point that delegates to the injected server factory.

Jump to

Keyboard shortcuts

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