bn-router

CLI & tooling

Connect Claude Code, Codex CLI, and CC-Switch to your bnrouter gateway.

Claude Code

Claude Code ships with native support for custom API gateways. Set the base URL and your key in the environment, and every model call goes through your gateway.

Claude Code · .env
# Point Claude Code at your bnrouter gateway
ANTHROPIC_BASE_URL=https://your-gateway.example.com/v1
ANTHROPIC_API_KEY=sk-your-api-key

Codex CLI

Codex CLI uses the OpenAI protocol and can be configured to point at any compatible endpoint. Point it at your gateway URL and use your key to route every request.

Codex CLI · openai_config
# ~/.codex/config.json
{
  "openai_config": {
    "api_base": "https://your-gateway.example.com/v1",
    "api_key": "sk-your-api-key"
  }
}

CC-Switch

CC-Switch manages Claude Code sessions across multiple API keys and regions. Configure your gateway as one of the endpoints so all sessions share the same quota and tracking.

CC-Switch · cc_config
# ~/.config/cc-switch/config.yaml
endpoints:
  bnrouter:
    url: "https://your-gateway.example.com/v1"
    key: "sk-your-api-key"
    profiles: ["default"]