Claude Code
Anthropic's CLI on the API-AI endpoint. Setup is two env vars and a verify call.
Install
bash
brew install anthropic/claude-code/claude
# or:
npm i -g @anthropic-ai/claude-codeOption 1: environment variables (current session)
The fastest path is to set the variables only in the current terminal. They won’t persist across sessions — see “Make persistent” at the bottom if you want them to survive a reboot.
bash
export ANTHROPIC_BASE_URL=https://api-ai.app
export ANTHROPIC_API_KEY=mdf-your-keyOption 2: persistent settings
Claude Code reads user settings from settings.json. The default model and family aliases below come from the catalog’s current active models.
File path: ~/.claude/settings.json
json
{
"env": {
"ANTHROPIC_BASE_URL": "https://api-ai.app",
"ANTHROPIC_API_KEY": "mdf-your-key",
"ANTHROPIC_MODEL": "claude-sonnet-5-5",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-8",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5-5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5"
},
"model": "claude-sonnet-5-5"
}Verify
bash
claude ask "say hi in one sentence"You should see a single-sentence reply within a second or two. If you see 401, the key is wrong; 400 invalid_request_error means the model name doesn’t match the canonical list (the response lists the supported ids).
Common issues
Claude Code asks me to log in — what now?
You don’t need to log in. The API key works without OAuth. Skip the login screen or sign in with any account — it does not affect your API-AI key. If the prompt gets in the way, clear the OAuth token:Then restart Claude Code. Full write-up: Troubleshooting · Claude Code login.
bash
# macOS / Linux
unset ANTHROPIC_AUTH_TOKEN
# Windows PowerShell
Remove-Item Env:\ANTHROPIC_AUTH_TOKENJSON parse error in settings.json (or an unexplained 429)
The most common cause is “smart” quotes (
“ ”) in ~/.claude/settings.json. They appear when you paste from messengers or Notion, and the JSON parser rejects them. Sometimes a broken config surfaces as a 429 because the client interprets upstream silence as a rate limit. One-line fix:bash
# validate the file
jq . ~/.claude/settings.json
# auto-replace smart quotes with ASCII
sed -i.bak