Use AnyAPI in Claude Code
Claude Code is Anthropic’s terminal-native AI coding agent — it edits files, runs commands, and handles multi-step refactors from your terminal. Claude Code speaks the Anthropic Messages API, and AnyAPI serves that API athttps://api.anyapi.ai, so you can point it at AnyAPI with no local proxy.
Install Claude Code
macOS / Linux / WSL:Get Your API Key
Go to API Keys in the AnyAPI Dashboard and create a new key.Configure Claude Code
Run this in your terminal to write the AnyAPI settings into~/.claude/settings.json. Replace sk-your-anyapi-key with your own key.
Start Claude Code
https://api.anyapi.ai.
Recommended Models
AnyAPI uses
provider/model format for model IDs. Bare names like claude-sonnet-4.6 without the vendor prefix won’t work.Troubleshooting
Claude Code asks you to log in
Claude Code asks you to log in
A cached Anthropic session takes priority over your settings. Run
/logout inside Claude Code, quit, and relaunch claude.403 access denied
403 access denied
Your key has no access to that model, or the model ID is wrong. Check your balance and plan at dash.anyapi.ai, and verify the ID against
/v1/models.Settings seem to be ignored
Settings seem to be ignored
Claude Code reads
~/.claude/settings.json, not a project .env file. Confirm the file is valid JSON — a trailing comma silently breaks it.Next Steps
CC Switch
Switch models in Claude Code from a GUI
All Integrations
Browse all supported tools