Coding agents

Run supported coding agents through BitRouter interactively, headlessly, or in their native interface.

8 min readEdit this page

BitRouter separates the agent harness that drives the loop from the model source that supplies tokens. The same Claude, Codex, OpenCode, or Pi harness can use a hosted model, a subscription, or a model running on your machine.

Choose the interface

GoalCommandInterface owner
Work in BitRouter's conversationbro code <agent>BitRouter
Run one turn from a scriptbro run <agent> "..."BitRouter, headless
Use the harness's own terminal UIbro launch <agent>The harness
Let another ACP client launch the adapterbro acp serve <agent>The ACP client
bro code codex
bro run claude "Review the current diff" --format quiet
bro launch opencode

bro code, bro run, and bro acp serve use ACP adapters. bro launch starts the harness's native interface with process-local routing overrides. It does not rewrite the user's normal harness configuration.

Supported agents

Run bro agents list for the catalog shipped by your installed version. Alpha.31 includes local ACP adapters for Claude, Codex, Gemini CLI, OpenCode, Pi, Hermes, and OpenClaw.

Friendly idACP adapterNative launch
claudeclaude-acpbro claude or bro launch claude
codexcodex-acpbro codex or bro launch codex
opencodeopencodebro launch opencode
pipi-acpbro launch pi
hermeshermes-acpbro launch hermes
openclawopenclawbro launch openclaw
gemini-cligemini-cliACP only in the bundled catalog

Use bro agents check <agent> before a long task. It verifies that the adapter can initialize and reports whether its model traffic can be routed through BitRouter.

What launch changes

For Claude and Codex, BitRouter passes temporary environment variables or command-line overrides. For OpenCode, Pi, Hermes, and OpenClaw, it writes a generated profile under the working tree's self-ignoring .bitrouter/launch/ directory and points only the child process at it.

bro launch pi --model bitrouter/auto
bro launch codex --check
bro launch claude -- --permission-mode plan

Arguments after -- belong to the harness. BitRouter options such as --model, --base-url, and --check must come before it.

Supported native harnesses also receive the aggregate MCP gateway when they expose a compatible injection mechanism. The launch summary states what was actually routed or injected; Pi and some other harnesses do not expose an MCP injection surface.

Other harnesses

If a harness is not in the catalog, configure it as a normal API client:

ProtocolLocal base URLCloud base URL
OpenAI-compatiblehttp://127.0.0.1:4356/v1https://api.bitrouter.ai/v1
Anthropic-compatiblehttp://127.0.0.1:4356https://api.bitrouter.ai

Use a provider/model id where the harness accepts a model name. Product-specific configuration keys belong to that harness's documentation; BitRouter only owns the endpoint and routing contract.

Claude Code

Claude Code owns the agent loop and tools. BitRouter supplies its model route, fallback, policy, and metering.

Pick a mode

bro code claude                         # BitRouter conversation
bro run claude "Summarize this repo"   # headless ACP turn
bro claude                              # Claude Code's native interface

bro launch claude is the generic spelling of bro claude. Both use temporary environment variables for the child process and do not edit Claude Code's user or project settings.

Before launching, verify the executable, daemon, and route:

bro launch claude --check

If the Claude executable is missing, the launcher can offer Claude's official installer. Use --no-install when an automated environment should fail instead.

Select a Claude model

Pin a daemon-routable model before the -- separator:

bro claude --model bitrouter/auto
bro launch claude --model anthropic/claude-sonnet-4-6

Arguments after -- go directly to Claude Code:

bro launch claude -- --permission-mode plan

Configure Claude Code manually

Use manual environment variables only when Claude Code must start outside bro launch. Claude Code appends /v1/messages, so the base URL is the host root:

export ANTHROPIC_BASE_URL=http://127.0.0.1:4356
export ANTHROPIC_AUTH_TOKEN=local-placeholder
export ANTHROPIC_MODEL=bitrouter/auto
claude

For Cloud, use https://api.bitrouter.ai and set ANTHROPIC_AUTH_TOKEN to a BitRouter key. An authenticated self-hosted daemon likewise requires a valid BitRouter key instead of the placeholder.

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 described above.

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 code 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.

Codex

Codex owns the agent loop and tools. BitRouter supplies its model route, fallback, policy, and metering.

Pick a mode

bro code codex                         # BitRouter conversation
bro run codex "Summarize this repo"   # headless ACP turn
bro codex                              # Codex's native interface

bro launch codex is the generic spelling of bro codex. It injects a temporary bitrouter model provider into the child process and does not edit ~/.codex/config.toml.

Verify the executable, daemon, and route before a long run:

bro launch codex --check

Select a Codex model

Pin a daemon-routable model with BitRouter's option:

bro codex --model bitrouter/auto
bro launch codex --model openai/gpt-5-codex

Arguments after -- go directly to Codex. Avoid forwarding Codex -c or --config overrides that replace the injected provider; bro launch rejects known conflicting shapes.

Configure Codex permanently

Use a permanent provider block only when Codex must start outside bro launch:

model_provider = "bitrouter"

[model_providers.bitrouter]
name = "BitRouter"
base_url = "http://127.0.0.1:4356/v1"
wire_api = "responses"
# env_key = "BITROUTER_API_KEY"

For Cloud, use https://api.bitrouter.ai/v1, set env_key = "BITROUTER_API_KEY", and export a BitRouter key. An authenticated self-hosted daemon requires the same.

Codex model-provider configuration belongs in the user-level ~/.codex/config.toml. Project-local Codex configuration does not define model providers.

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 described above.

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 code 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.

Model sources

A model source is where inference runs and how it is authenticated. BitRouter puts each source behind the same model ids and routing policy, so the calling agent does not need source-specific code.

SourceAuthenticationSetup
Claude or Codex subscriptionProvider OAuthbro providers login <provider>
Built-in BYOK providerEnvironment variable or stored keyExport its key or use bro providers login <provider> --api-key ...
Custom hosted APIAPI keyAdd a providers: entry
Local inference serverUsually loopback; optional keyAdd a providers: entry

Subscription providers do not need a YAML block. Other sources use the same minimal shape:

providers:
  my-source:
    api_base: https://example.com/v1
    api_key: ${MY_SOURCE_API_KEY}
    api_protocol:
      - "*": chat_completions
    models:
      - id: example/model

Use the upstream's actual served model id in models. Keep secrets in environment variables rather than committing them to the file.

Verify a source

bro config validate
bro models --provider my-source
bro route my-source:example/model
bro start
  • config validate catches malformed configuration and unsafe upstream URLs.
  • models confirms the source is in the resolved catalog.
  • route previews resolution without making an inference request.
  • The provider-qualified form pins one source; the bare model id lets BitRouter select among every source that serves it.

To combine sources, define a virtual model or fallback chain. A common pattern is local inference first and a hosted source second.

How is this guide?

On this page