cheapaimodel

Claude Code

Run Claude Code on your cheapaimodel balance.

Copy

Not available yet. No model in the catalog currently lists the Anthropic Messages endpoint (/v1/messages), so Claude Code has no model to run on. For a coding agent today, use Codex CLI, Cursor or Cline. This guide applies once a model's catalog page lists /v1/messages.

Claude Code talks to the Anthropic Messages API, so it only needs a base URL and a key.

Set it up

Add these to your shell profile (~/.zshrc, ~/.bashrc), then open a new terminal and run claude:

~/.zshrc
export ANTHROPIC_BASE_URL="https://api.cheapaimodel.ai"
export ANTHROPIC_AUTH_TOKEN="sk-..."

ANTHROPIC_AUTH_TOKEN is sent as Authorization: Bearer. If you are signed in to a Claude subscription, run /logout inside Claude Code first so it uses the key.

Use settings.json instead

To keep the configuration with Claude Code rather than your shell, put it in ~/.claude/settings.json:

~/.claude/settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.cheapaimodel.ai",
    "ANTHROPIC_AUTH_TOKEN": "sk-..."
  }
}

Choosing models

Claude Code resolves its sonnet, opus and haiku aliases to model IDs; haiku also runs background tasks. Point the aliases at model IDs from the catalog that list /v1/messages:

~/.zshrc
export ANTHROPIC_DEFAULT_SONNET_MODEL="<model-id>"
export ANTHROPIC_DEFAULT_OPUS_MODEL="<model-id>"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="<model-id>"

ANTHROPIC_MODEL sets the starting model; /model switches during a session.

Give Claude Code its own API key with a budget so an agent run can never spend more than you planned.