Use AnyAPI in Claude Code
Claude Code is Anthropic’s official terminal-native AI coding agent. It lets you delegate complex coding tasks — file edits, multi-step refactors, test generation, and more — directly from your terminal.
AnyAPI works with Claude Code via the Anthropic Messages API (/v1/messages). No local proxy required.
Quick Start
1. Get your API key
Sign up at anyapi.ai and create an API key in the dashboard.2. Install Claude Code
macOS / Linux / WSL:3. Configure environment variables
Add these lines to your shell profile (~/.zshrc or ~/.bashrc):
Important:
ANTHROPIC_API_KEY must be set to an empty string "", not just unset. If it has any value, Claude Code will try to authenticate with Anthropic directly instead of using AnyAPI.Note: Do not put these in a project-level
.env file — Claude Code does not read standard .env files.4. Clear any cached Anthropic login
If you previously logged in to Claude Code with an Anthropic account, run this inside Claude Code:claude.
5. Start Claude Code
6. Verify
Run/status inside Claude Code:
Model Format
AnyAPI uses thevendor/model format. Always include the vendor prefix:
Configuration Examples
DeepSeek:Troubleshooting
403 RBAC: access denied
Your key doesn’t have access to the requested model, or the model name is wrong.
- Check your balance and plan at dash.anyapi.ai
- Verify the model name using the
/v1/modelsendpoint above - Make sure you’re using
vendor/modelformat
Please run /login on startup
Claude Code is ignoring your environment variables.
- Make sure
ANTHROPIC_API_KEY=""is explicitly set to empty string - Run
/logoutinside Claude Code, then restart - Confirm variables are in your shell profile, not a
.envfile
Auth conflict warnings / unexpected model-not-found errors
Usually caused by a cached Anthropic OAuth session conflicting withANTHROPIC_AUTH_TOKEN.
- Run
/logoutinside Claude Code - Quit and relaunch
claude - Verify with
/statusthat the base URL showshttps://api.anyapi.ai
Browser opens for login unexpectedly
ANTHROPIC_API_KEY is either unset or has a real value. Set it to an empty string:
Support
- AnyAPI Dashboard: dash.anyapi.ai
- AnyAPI Discord: Discord community
- AnyAPI Email: support@anyapi.ai
- Claude Code Docs: docs.anthropic.com/en/docs/claude-code
Next Steps
All Integrations
Browse all supported tools
Model Catalog
Browse 300+ available models