Claude Code with a custom API endpoint: ANTHROPIC_BASE_URL
Claude Code signs in with an Anthropic account by default. Two environment variables, ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY, point it at an Anthropic-compatible endpoint such as 6090ti, so you pay per call with an API key. This is the short version; the full steps are in the Claude Code guide.
Variables to set
| Variable | Value |
|---|---|
ANTHROPIC_BASE_URL |
https://api.6090ti.com (no /v1) |
ANTHROPIC_API_KEY |
An API key created in the 6090ti console. The first time Claude Code runs, it asks whether to use this key; approve it |
ANTHROPIC_MODEL (optional) |
The default model name, for example claude-sonnet-4-6 from the price table |
Put them in the settings file (recommended)
Edit ~/.claude/settings.json (Windows: %USERPROFILE%\.claude\settings.json):
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.6090ti.com",
"ANTHROPIC_API_KEY": "<your key>",
"ANTHROPIC_MODEL": "<model name>"
}
}
Save, open a new terminal and run claude. If claude -p "Reply with OK only" answers, the setup works.
Common issues
- It still asks you to log in to Anthropic: the settings file is not valid JSON or is in the wrong place; run
claude doctor. - Do not also set
ANTHROPIC_AUTH_TOKEN: two credentials at once can conflict; remove it if you set it before. - The key is set but ignored: if you declined it when asked, Claude Code ignores it; type
/configin Claude Code and turn on Use custom API key. - Different models for the opus / sonnet / haiku slots: set
ANTHROPIC_DEFAULT_OPUS_MODEL,ANTHROPIC_DEFAULT_SONNET_MODELandANTHROPIC_DEFAULT_HAIKU_MODEL. - 401 / 403 / 404 errors: see “Claude API errors: causes and fixes” under Articles.