Claude Code
Run Claude Code on Half Off Dev at half the official Claude price: two environment variables or settings.json, model choice, and prompt caching.
Claude Code reads its endpoint and credentials from environment variables, and it talks the Anthropic Messages API, which Half Off Dev serves without translation. Point those variables at Half Off Dev and the same terminal coding assistant keeps working, billed at 50% of Anthropic's list price. Create an API key before you start.
Configure it#
For a quick try, export three variables and launch claude in the same shell:
export ANTHROPIC_BASE_URL=https://halfoff.dev
export ANTHROPIC_AUTH_TOKEN=$HALFOFF_API_KEY
export ANTHROPIC_MODEL=claude-sonnet-5.5
claudeTo make it permanent, put the values in ~/.claude/settings.json, using your full key:
{
"env": {
"ANTHROPIC_BASE_URL": "https://halfoff.dev",
"ANTHROPIC_AUTH_TOKEN": "ho-...",
"ANTHROPIC_MODEL": "claude-sonnet-5.5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4.5"
}
}Leave /v1 off the base URL: Claude Code adds it.
Or import it from the dashboard#
On API keys, choose Use in tools → Claude Code. You get the setup above with your key in place, and Import with CC Switch creates a Half Off Dev provider in the CC Switch desktop app with the models preset (CC Switch has to be installed). A key you just created is already filled in; for an older one, paste the full key, since Half Off Dev only keeps its hash.
Models#
Claude Code uses two slots. ANTHROPIC_MODEL is the model you work with; ANTHROPIC_DEFAULT_HAIKU_MODEL handles small background jobs, so a fast, cheap model fits there. Any Claude id from GET /v1/models is valid, claude-opus-5.5 for instance. All ids are on the model list.
Prompt caching#
Claude Code relies heavily on prompt caching, and it keeps working here. Half Off Dev pins each session to the channel that holds its cache, so the large, repeated context of a coding session is billed at the cached-input rate turn after turn. Details in Prompt caching.
Fixing errors#
| What you see | What to do |
|---|---|
401 Missing API key | No key is reaching Half Off Dev. Export ANTHROPIC_AUTH_TOKEN in the shell that runs claude, or set it in ~/.claude/settings.json. |
401 Invalid or revoked API key | The key was mistyped, cut short or revoked. Paste it again or make a new one. |
404 Model '...' is not available | That id doesn't exist. Copy a Claude id from GET /v1/models or the model list. |
404 with /v1/v1/ in the path | ANTHROPIC_BASE_URL ends in /v1. Change it to https://halfoff.dev. |
402 | The balance is empty or the key has hit its spend cap. See Billing. |
Any other status is explained in Errors.