CodeBuddy Code
CodeBuddy's base URL override speaks the Anthropic protocol — which decides both the URL shape and which models you can pick.
CodeBuddy Code's endpoint override is an Anthropic-protocol override. That single fact decides everything else on this page.
Configure
export CODEBUDDY_API_KEY="sk-..." # your RouteMux key
export CODEBUDDY_BASE_URL="https://api.routemux.com"
export CODEBUDDY_MODEL="anthropic/claude-sonnet-5"codebuddy --model anthropic/claude-sonnet-5The documented variables:
| Variable | What the docs say |
|---|---|
CODEBUDDY_BASE_URL | Overrides the API endpoint, normally used together with CODEBUDDY_API_KEY |
CODEBUDDY_API_KEY | The API key for model calls; always used in non-interactive mode (-p) |
CODEBUDDY_MODEL | Overrides the default agent model |
CODEBUDDY_BIG_SLOW_MODEL | Overrides the reasoning-heavy variant |
CODEBUDDY_SMALL_FAST_MODEL | Overrides the lightweight/fast variant |
CODEBUDDY_CONFIG_DIR | Where CodeBuddy stores its config and data |
The same variables can go in settings.json under env, which applies them to every session —
convenient for a team.
Pick Claude models here, not OpenAI ones
Because the override is Anthropic-protocol, the models you name must be served on Anthropic
Messages. anthropic/claude-* are. openai/*, google/gemini-* and xai/grok-* are not all
available there — see the compatibility matrix before
picking a slug. Naming a model that is not on the protocol returns
400 MODEL_PROTOCOL_UNSUPPORTED.
The base URL shape
CodeBuddy's own docs show both forms — a generic example with /v1 and a provider example
without it — and state no rule, so the suffix follows whatever the provider expects. For
RouteMux, use the bare origin https://api.routemux.com: the Anthropic client appends
/v1/messages itself. If your build appends differently and you end up at
/v1/v1/messages, that still routes correctly on our side.
The BIG_SLOW / SMALL_FAST split matters for cost
CodeBuddy runs background and lightweight work on the small-fast model. If you leave it
pointing at a large model, routine housekeeping turns are billed at that model's rate. Set
CODEBUDDY_SMALL_FAST_MODEL to something cheap explicitly.
A note on CODEBUDDY_INTERNET_ENVIRONMENT
The docs describe it as a network-environment selector, with internal for the China edition
and ioa for the iOA enterprise edition. Neither of the third-party endpoint examples in the
docs sets it, and the docs give no guidance about combining it with a third-party endpoint. If
you have it set and requests are not reaching us, try unsetting it — but treat that as
something to test, not as documented behaviour.
OpenAI-compatible models take a different route
For models that are not on the Anthropic protocol, CodeBuddy uses a local
models.json declaration rather than the base URL override — a per-model entry carrying the
full URL, key and context limits. That path is not covered here; if you want OpenAI-protocol
models, a client with a first-class OpenAI provider is less work.
Troubleshooting
| Symptom | Cause |
|---|---|
400 MODEL_PROTOCOL_UNSUPPORTED | The model you named is not served on Anthropic Messages. |
| 404 on every request | Base URL shape. Try the bare origin. |
| Unexpected spend on trivial turns | CODEBUDDY_SMALL_FAST_MODEL still points at a large model. |
| Non-interactive runs use the wrong key | -p mode always takes CODEBUDDY_API_KEY, regardless of an interactive login. |
422 BILLING_INSUFFICIENT_CREDITS | Wallet lacks credit. Failed requests are not billed. |