Claude Code

Run Claude Code with any model on AivoKey.

Use Claude Code with any model on AivoKey — Claude, GPT, Gemini, DeepSeek, GLM and more.

Before you start

  • Claude Code is installed (claude --version works).
  • You have an AivoKey API key and some credit (Quickstart).
  • You picked a model id with the tools badge on Models.

Option A — Settings file (recommended)

This works on macOS, Linux and Windows and survives new terminals. Open (or create) the file ~/.claude/settings.json — on Windows it is %USERPROFILE%\.claude\settings.json — and add:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.aivokey.dev",
    "ANTHROPIC_AUTH_TOKEN": "sk-aivo_...",
    "ANTHROPIC_MODEL": "deepseek-v4-pro",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-v4-pro",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4-pro",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4-pro",
    "CLAUDE_CODE_SUBAGENT_MODEL": "deepseek-v4-pro"
  }
}

If the file already has content, merge the env block into it instead of replacing the file. Then start Claude Code:

claude

Option B — Environment variables

Quick to try in one terminal session.

macOS / Linux:

export ANTHROPIC_BASE_URL="https://api.aivokey.dev"
export ANTHROPIC_AUTH_TOKEN="sk-aivo_..."
export ANTHROPIC_MODEL="deepseek-v4-pro"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-v4-pro"
claude

Windows PowerShell:

$env:ANTHROPIC_BASE_URL="https://api.aivokey.dev"
$env:ANTHROPIC_AUTH_TOKEN="sk-aivo_..."
$env:ANTHROPIC_MODEL="deepseek-v4-pro"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-v4-pro"
claude

What each setting does

SettingMeaning
ANTHROPIC_BASE_URLWhere Claude Code sends requests. No /v1 at the end — Claude Code adds it.
ANTHROPIC_AUTH_TOKENYour AivoKey key.
ANTHROPIC_MODELThe main model.
ANTHROPIC_DEFAULT_OPUS_MODEL / ..._SONNET_MODELWhat Claude Code uses when you pick "Opus" or "Sonnet" in /model.
ANTHROPIC_DEFAULT_HAIKU_MODELThe model for small background jobs (titles, summaries). A cheaper model is fine here.
CLAUDE_CODE_SUBAGENT_MODELThe model for sub-agents.

Set the Haiku model too. Claude Code quietly runs small background requests on its "Haiku" model. If you leave it unset, those requests ask for a model id that may not be in your plan and fail with model_not_in_plan or not_found.

Check that it works

Inside Claude Code, run:

/status

It should show your AivoKey base URL and model. Ask a question; the request appears within seconds in Console → Usage.

Switching models

Change ANTHROPIC_MODEL (or type /model deepseek-v4-pro inside Claude Code) to any id from Models. Restart Claude Code after editing the settings file.

Common problems

  • "Invalid API key" / 401 — the key is mistyped or revoked. Copy it again from the console.
  • Auth conflict warning, or Claude Code still uses your Claude.ai account — run /logout inside Claude Code, then restart it so it reads ANTHROPIC_AUTH_TOKEN.
  • 404 on every request — the base URL ends with /v1. Remove it.
  • model_not_in_plan — one of the model settings above points to a model your plan does not include. Set all of them.
  • The agent talks but never edits files — the model has no tool support. Pick one with the tools badge.

More fixes: Troubleshooting.

Prompt caching and web search

Both work automatically: Claude Code's session id keeps each conversation on a cache-friendly route, and its WebSearch tool is served by AivoKey for every model (Web search & fetch).