Skip to content
Guides

Connect CheapLLM to Claude Code

Point Claude Code at the Messages API through the CheapLLM-compatible gateway.

1. Prepare your API key

Create a CheapLLM key. Claude Code reads the gateway token from ANTHROPIC_AUTH_TOKEN, so assign the value of CHEAPLLM_API_KEY to that variable. Note that the CheapLLM site is still a demonstration and the API does not accept requests yet; the configuration below is the target setup.

Bash or Zsh
export CHEAPLLM_API_KEY="YOUR_CHEAPLLM_API_KEY"
export ANTHROPIC_AUTH_TOKEN="$CHEAPLLM_API_KEY"

2. Set the API address

Give ANTHROPIC_BASE_URL the root server address without the /v1 suffix: Claude Code appends /v1/messages itself, so requests end up at https://api.cheapllm.com/v1/messages.

Bash or Zsh
export ANTHROPIC_BASE_URL="https://api.cheapllm.com"

3. Start Claude Code

Run claude from the same terminal where both variables are set. If your gateway expects an API key rather than a bearer token, use the ANTHROPIC_API_KEY setup documented by that gateway instead.

Terminal
claude

4. Verify the settings

Inside Claude Code run /status and check that the CheapLLM address and the credential source are shown. Then send a short prompt to confirm the model answers.

Claude Code
/status
All guides