For AI agents, the documentation index lists all pages. Append .md to a documentation URL for Markdown, or request text/markdown.

Skip to Content

BYOK & Subscriptions

Connect API keys, subscription logins, multiple accounts, and custom endpoints to BitRouter.

6 min readEdit this page

A provider tells BitRouter where and how to call an upstream. A model is a routable id declared by one or more providers. Bring an API key, sign in to a supported subscription provider, or configure a custom endpoint to make its models available to your deployment. A provider account and an agent harness are separate choices.

Choose the path

NeedUse
A supported provider with your API keyEnvironment variable or an empty built-in provider block
Claude or Codex subscriptionSubscription login
Local inferenceLocal Models
A private or OpenAI-compatible endpointA custom providers entry below
A provider everyone should discoverA pull request to the open registry
Your provider key on BitRouter CloudCloud BYOK

Built-in providers with your own key

The local binary detects common provider credentials without a config file:

export OPENAI_API_KEY=sk-...
export ANTHROPIC_API_KEY=sk-ant-...
export GEMINI_API_KEY=...

bro providers list
bro start

To make the enabled set explicit, add empty provider blocks and let them inherit the bundled registry definition:

providers:
  openai: {}
  anthropic: {}
  google: {}

Keep credentials in environment variables. Run bro reload after rotating a key and bro providers list to confirm which sources are active.

Subscriptions

Subscription credentials are separate from API keys and from the harness you launch. A configured subscription source requires an explicit provider-qualified route; bare model selection does not silently consume a personal subscription. Available models and protocols depend on the selected source.

Use a Claude subscription

The claude-code provider uses a Claude Pro or Max credential instead of an Anthropic API key. It is separate from the standard anthropic provider, but it can be used with the Claude Code harness.

Sign in:

bro providers login claude-code

BitRouter adopts a compatible local Claude Code login when possible and otherwise starts the provider's login flow. The stored credential refreshes automatically; no providers: block is required.

Verify the models and route:

bro models --provider claude-code
bro route claude-code:claude-sonnet-4-6

Use the provider-qualified id to require the subscription source. A request routed to anthropic:<model> uses ANTHROPIC_API_KEY instead.

Then launch any Claude Code mode normally:

bro start
bro claude
# or: bro run claude "Summarize this repo"

Sign out with:

bro providers logout claude-code

This removes BitRouter's stored subscription credential and route. It does not modify Claude Code's own configuration.

Provider login and BitRouter Cloud login are separate. bro providers login claude-code authenticates the upstream subscription; bro cloud login authenticates your BitRouter account.

Use a Codex subscription

The openai-codex provider uses a ChatGPT Plus or Pro credential and the Codex Responses backend. It is separate from the standard openai API-key provider, but it can be used with the Codex harness.

Sign in:

bro providers login openai-codex

BitRouter can import a compatible local Codex login or start the provider's browser flow. For automation that must not open a browser:

bro providers login openai-codex --import-existing --no-browser

No providers: block is required. Verify the models and route:

bro models --provider openai-codex
bro route openai-codex:gpt-5-codex

Use the provider-qualified id to require the subscription source. A request routed to openai:<model> uses OPENAI_API_KEY and the public OpenAI API instead.

Then launch any Codex mode normally:

bro start
bro codex
# or: bro run codex "Summarize this repo"

Sign out with:

bro providers logout openai-codex

This removes BitRouter's stored subscription credential. It does not sign the Codex CLI out of its own account.

Provider login and BitRouter Cloud login are separate. bro providers login openai-codex authenticates the upstream subscription; bro cloud login authenticates your BitRouter account.

Custom endpoints and models

Any endpoint using a supported outbound protocol can become a provider:

providers:
  my-cluster:
    api_base: "https://llm.internal.example/v1"
    api_key: "${MY_CLUSTER_TOKEN}"
    api_protocol:
      - "*": chat_completions
    models:
      - id: team/llama-3.1-8b
        capabilities: [tools, structured_outputs]
FieldPurpose
api_baseUpstream base URL
api_keyOptional credential; use an environment reference
api_protocolModel-pattern to ordered protocol mapping
models[].idCanonical model id the provider declares
models[].capabilitiesPositively verified features used during route filtering
priority / tagsDeterministic ordering and routing filters

Supported built-in protocol names are chat_completions, responses, messages, and generate_content. A model-specific api_protocol overrides the provider pattern.

Do not advertise a capability merely because the protocol can encode it. Declare only behavior verified for that exact provider/model route.

Validate and route

bro config validate -c bitrouter.yaml
bro models --provider my-cluster
bro route my-cluster:team/llama-3.1-8b -c bitrouter.yaml

The provider:model selector pins one provider. The bare model id joins every active provider that declares that id; use Virtual Models to define a named route and Model Fallbacks for replacement behavior.

For Ollama, vLLM, Unsloth, and similar servers, use the shorter Local Models recipe.

Multiple accounts

One provider can expose several credentials:

providers:
  openai:
    account_strategy: failover
    accounts:
      - label: primary
        api_key: "${OPENAI_KEY_PRIMARY}"
      - label: backup
        api_key: "${OPENAI_KEY_BACKUP}"

failover preserves declared order and advances after retryable or credit-exhaustion failures. balance rotates the first account, while the remaining accounts still form the request's fallback chain.

BitRouter Cloud BYOK

Cloud BYOK stores a provider credential for your account and routes eligible calls through it. The recommended path is the Cloud console, which fetches the node's encryption public key and seals the provider key in the browser before upload.

Cloud Auto Routing with BYOK uses $0.01 per million processed tokens — early access pricing, based on verifiable actual input + output tokens processed by BitRouter Cloud. The same platform fee applies to Elastic Inference and is counted once per request, including when routing into the market. Your provider bills model inference separately under its own rates. Local, self-hosted BYOK routing has no BitRouter fee. See pricing.

For automated onboarding, start with the BYOK API reference. Keep encryption and upload code in the client; never send a plaintext provider key to a logging or application endpoint.

Contribute a provider

Private config affects only your deployment. To make a provider discoverable to every BitRouter installation, add its manifest to the open provider registry and submit a pull request. Registry data can describe endpoints, protocols, models, capabilities, pricing, and authentication conventions; provider-specific executors or OAuth flows still require code.

How is this guide?

On this page