CodeRouterCLI and Troubleshooting
CodeRouter

CodeRouter CLI and Troubleshooting

CodeRouter has two command sets. cr, also installed as coderouter, signs you in, manages subscriptions, and launches agents. cmux coderouter manages the team's Claude accounts and Cloud machine usage through the signed-in cmux app, and passes every other verb to cr.

Install and sign in

The installer downloads a checksum-verified binary to ~/.coderouter/bin, links cr to it, and adds that directory to your shell's PATH. Run it again to update. It supports macOS and Linux on arm64 and x64. The same CLI is published to npm and PyPI.

curl -fsSL https://cmux.com/coderouter/install.sh | sh
npm install -g coderouter
uv tool install coderouter

cr login opens your browser and prints a fallback link. Without a local browser, use --device-auth and open the link on another device, or cr login --code to paste a code or magic link.

cr login
cr login --device-auth
cr login --code [code-or-url]
cr logout

cr

With no command, cr shows your accounts and their usage. Agent routing is always explicit: plain codex, opencode, and pi keep working without CodeRouter.

cr                             # account and usage summary
cr codex [arguments...]
cr opencode [arguments...]
cr pi [arguments...]           # experimental
cr naked [arguments...]        # plain Codex, CodeRouter bypassed (alias: direct)
cr add                         # choose a provider
cr add codex
cr add claude [--label <name>] [--stdin]
cr add opencode
cr remove [account] [--yes]
cr transfer [account] [--to <team>] [--yes]
cr accounts [--watch] [--json] # aliases: list, ls, usage
cr org current | list | switch <name-or-id>
cr login [--api-key <key>] [--device-auth] [--code [code-or-url]]
cr logout
cr doctor
cr upgrade

A personal and a team ChatGPT workspace can share one email. Run cr add codex once per workspace and pick the workspace in the browser; CodeRouter keeps them as separate accounts.

cmux coderouter

These verbs run through the cmux app, which must be running and signed in (cmux auth login). Add --json for machine-readable output and --team <id> to target a team other than the selected one.

cmux coderouter status
cmux coderouter machines
cmux coderouter claude list
cmux coderouter claude add oauth-token [--label <name>] [--stdin]
cmux coderouter claude add api-key [--label <name>] [--stdin]
cmux coderouter claude add bedrock [--label <name>] [--region <region>] [--model <claude-id>=<bedrock-id>]...
cmux coderouter claude disable <account>
cmux coderouter claude enable <account>
cmux coderouter claude remove <account>
cmux coderouter claude clear
cmux coderouter agent <claude|codex|opencode|pi> [vm-agent-options] -- <prompt>

claude add oauth-token reads CLAUDE_CODE_OAUTH_TOKEN or --stdin. In a terminal with neither, it runs claude setup-token and reads the token that command prints. claude add api-key reads ANTHROPIC_API_KEY, --stdin, or a hidden prompt. claude add bedrock reads AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and the optional AWS_SESSION_TOKEN, and takes the region from --region, AWS_REGION, or AWS_DEFAULT_REGION.

An <account> can be its id, its label, or its masked identifier. disable takes an account out of rotation until you enable it again.

Every other cmux coderouter verb, and every cmux cr command, runs cr unchanged. When cr is missing, cmux offers to run the installer. cmux does not pass its own environment variables or sign-in to cr.

cmux cr accounts
cmux coderouter login

Inside a Cloud machine

Each Cloud machine has its own cmux with CodeRouter verbs that need no sign-in. Account management stays on your Mac, so claude, login, and logout are refused inside a machine.

cmux auth status [--json]
cmux coderouter status [--json]
cmux coderouter usage [--json|--tsv] [--days <n>]
cmux coderouter models
cmux coderouter accounts [--json]
cmux coderouter org current [--json]
cmux coderouter agent <claude|codex|opencode|pi> [--timeout <seconds>] [args...]
cr use [own|team|auto] [claude|codex|opencode] [--json]   # your own sign-in or the team's accounts

Troubleshooting

Messages in the first column are what the agent, cr, or cmux prints.

Message or symptomFix
Sign in with `cr login` and retry. (Also: Missing coderouter route token.)Run cr login. For an API client, check that the key is set and starts with crk_.
Your coderouter session expired or was revoked.Run cr login again. A revoked API key stops working at once; create a new one.
No healthy Codex subscription is currently available.Run cr to see each account's state. Add an account with cr add, or wait for a cooldown to end. For an organization's Cloud machines, share the account with the team.
No Claude upstream account is configured for this team.Add one with cr add claude or cmux coderouter claude add. For an organization's Cloud machines, share it with the team.
Every Claude upstream account of this team is cooling down or disabled.Retry after the cooldown, enable a disabled account with cmux coderouter claude enable, or add another account.
not_found_error from a Bedrock accountThe model has no Bedrock mapping. Remove the account and add it again with --model <claude-id>=<bedrock-id>.
The team's Bedrock account is missing a region.Remove the account and add it again with --region, or with AWS_REGION set.
CodeRouter CLI is not installed.Run the installer, or answer y when cmux cr offers to install it.
Codex is not installed or is not on PATH (or OpenCode, or Pi).Install the agent. cr launches the copy it finds on your PATH.
`codex` resolves back to coderouter.Your codex command points at cr. Put the real Codex executable first on your PATH.
`<model>` is not a coderouter OpenCode model.Pick a model from your OpenCode Go accounts, or run plain opencode for another provider.
cmux: OpenCode provider configuration is unavailable; retry in one minute.The machine could not download the OpenCode provider list. Wait a minute and start OpenCode again.
CodeRouter: TLS edge unreachable, or route rejected, in cmux auth status inside a machine.The machine cannot reach CodeRouter, or CodeRouter refused the machine's credential. Retry in a moment. If it persists, contact support with the machine name and the output of cmux auth status --json.
coderouter is temporarily unavailable. Retry shortly.CodeRouter or the account store is briefly unavailable. Retry; if the error persists, report it with the request ID.

Diagnose

cr doctor prints whether cr is signed in and which CodeRouter endpoints it uses. cmux coderouter status shows the cmux sign-in, the selected team, and that team's Claude accounts.

cr doctor
cmux coderouter status

Get help

When you report a failed request, include the value of the x-coderouter-request-id response header. It identifies that one request in CodeRouter's records.