One endpoint for pooled Anthropic traffic.

cc-lb is a self-hosted reverse proxy and load balancer for API-key and OAuth upstreams. You control accounts, quota pressure, cache continuity, and runtime changes; your clients keep the standard Messages API contract.

Independent project. Anthropic and Claude Code are trademarks of Anthropic; cc-lb is not affiliated with or endorsed by Anthropic.

Request contractPOST /v1/messages
x-api-key: $CC_LB_PROXY_KEY
anthropic-version: 2023-06-01
content-type: application/json

authenticate principal
→ select an enabled upstream
→ route the request
→ stream the response
Clients send an Anthropic Messages API request. You own what happens behind the endpoint.

Star cc-lb on GitHub

If cc-lb fits how you run Claude Code traffic, star the repository. Stars help other operators find cc-lb. The button opens GitHub, where you star it with your own account.

Star on GitHub (opens in a new tab)github.com/isac322/cc-lb

Watch the pool from the admin console.

A real-time walkthrough with no cuts: pool quota usage on Overview, recent requests per upstream and per principal, then three new requests arriving in Logs.

Real cc-lb 1.0.1 UI · synthetic fixture data · requests went through the proxy to a local mock upstream, so no provider received traffic · silent, 18.6 s

You run the pool. Clients keep their request shape.

Pool compatible accounts behind a managed endpoint. Configure upstreams, principals, proxy keys, storage, and plugin chains from database-backed runtime state.

Each client keeps its existing Messages API calls and points them at /v1/messageswith a proxy key you issue. Routing stays behind that request boundary.

Choose the runtime that fits your host.

The source build and the published image use the same server contract. Use the path that matches your deployment boundary.

Build the binary

Rust + Bun

Build the server from the repository with the pinned toolchain and bundled admin app.

rustup target add wasm32-unknown-unknown
cargo build --release -p cc-lb-server
./target/release/cc-lb serve \
  --config cc-lb.toml \
  --data-dir ./data/runtime
Read binary prerequisites

Run the image

GHCR · 1.0.1

Run the published multi-architecture image and mount your config and durable data.

docker run --rm --name cc-lb \
  --user "$(id -u):$(id -g)" \
  --env-file .env \
  -p 8080:8080 -p 9090:9090 \
  -v "$PWD/cc-lb.container.toml:/etc/cc-lb/cc-lb.toml:ro" \
  -v "$PWD/data:/var/lib/cc-lb" \
  ghcr.io/isac322/cc-lb:1.0.1
Read container setup

The routing model is explicit.

These are the shipped contracts behind the landing page. Each one links to the source-backed explanation rather than a benchmark or a promise.

Pool API-key and OAuth upstreams

Route Messages API traffic through the two supported upstream kinds.

Read upstreams

Preserve active session cache continuity

Use best-effort keepalive scheduling before configured cache TTLs expire.

Read cache continuity

Pace quota across rolling windows

Apply cost-first, deterministic candidate selection under weekly pacing rules.

Read quota routing

Extend with Wasmtime hooks

Add filter and request, response, or SSE shaping behavior without editing the core proxy.

Read the plugin contract

Manage runtime state from the database

Update upstreams, principals, keys, and plugin chains without rebuilding the binary.

Read runtime management

From secret setup to the first request.

  1. Set the boundary.

    Provide the master key, admin token, and upstream credential through your deployment environment.

  2. Create runtime state.

    Use the authenticated admin API to create an upstream, principal, and proxy key.

  3. Send standard traffic.

    Point an Anthropic-compatible client at the proxy and inspect the response or stream diagnostics.

Follow the complete setup

Open source with explicit limits.

cc-lb is built for self-hosting teams operating Anthropic-compatible traffic. The current public upstream contract is intentionally bounded; read the trust notes before deploying.

SupportedAnthropic API-key and OAuth upstreams
RuntimeSQLite for local single-node use; PostgreSQL for shared durable state
ExtensionWasmtime filter and request, response, or SSE shaping hooks
Read trust and scope notes

Running cc-lb? Star it and report what breaks.

Stars help other operators find cc-lb. Issues with a reproduction help fix what you hit in your own deployment.