Troubleshooting
Twelve concrete failure modes we see week-in, week-out. Symptom → cause → one-line fix.
curl -s https://api-ai.app/v1/models -H "x-api-key: $ANTHROPIC_API_KEY". If it returns a non-empty JSON model list, your network reach and auth are fine — whatever you’re hitting is request-specific, not infrastructure.Top questions
Do I need to log into Claude Code?
No. The API key works without logging into a Claude Code account. If Claude Code shows a login prompt, you can skip it or sign in with any account — it does not affect your API-AI key. Requests go through ANTHROPIC_BASE_URL + ANTHROPIC_API_KEY, not the OAuth token.
To suppress the login prompt entirely, clear the OAuth token in your current shell:
# macOS / Linux
unset ANTHROPIC_AUTH_TOKEN
# Windows PowerShell
Remove-Item Env:\ANTHROPIC_AUTH_TOKEN
# Windows cmd
set ANTHROPIC_AUTH_TOKEN=Then restart Claude Code. If the login screen still appears, the variable is also set in your shell rc — check and clean it up:
grep -nE 'ANTHROPIC_AUTH_TOKEN' ~/.zshrc ~/.bashrc 2>/dev/nullDo I need to log into ChatGPT for Codex CLI?
No. Codex CLI reads OPENAI_BASE_URL and OPENAI_API_KEYfrom the environment. When both point to API-AI, Codex bypasses the ChatGPT sign-in entirely and talks to our endpoint. So you can skip the auth screen.
If a stale token or shell-rc export gets in the way:
unset OPENAI_API_KEY
rm -f ~/.codex/auth.lock
# then re-export the values for your key and restart codex
export OPENAI_BASE_URL="https://api-ai.app/v1"
export OPENAI_API_KEY="mdf-..."
codexFull walkthrough on the Codex (OpenAI) page.
Do I need a VPN? Any regional restrictions?
No VPN is needed — API-AI has no regional restrictions. The endpoint api-ai.app does not block any country.
Worse, VPN / VLESS proxies often break the API connection in two ways:
- SSE streaming is buffered inside the proxy — the stream gets cut off mid-token.
- HTTP/2 + ALPN negotiation breaks at relay hops — the client sees
connection reset.
If you’re seeing cut-off streams, connection reset, or random timeouts, disable the VPN / VLESS proxy and retry. Our gateway does no buffering.
JSON parse error in config (or a 429)
The most common cause is “smart” quotes (“ ”) in your JSON config. They appear when you copy from a messenger, Notion, Google Docs, or a browser that auto-replaces ASCII quotes with typographic ones. JSON parsers only accept plain ASCII ".
Sometimes a broken config doesn’t surface as “JSON parse error” but as a 429 — the client interprets upstream silence as a rate limit. Same fix:
- Replace every
“”with"by hand. - Copy configs directly from this documentation — the quotes are already correct here.
- Validate with
cat -v config.jsonorjq . config.json— both flag the bad byte.
# Quick check: jq fails on the first smart quote
jq . ~/.claude/settings.json
# Auto-replace smart quotes with straight quotes
sed -i.bak