Prerequisites
- Claude Code installed (see Step 1 if you haven’t installed it yet)
- An A2Agent API key — sign up at a2agent.me/register to get one
Setup
1
Install Claude Code
If you haven’t already, install Claude Code globally via npm:
2
Locate or create the config file
Claude Code reads environment and permission settings from
~/.claude/settings.json. Create the file if it doesn’t exist:3
Add the A2Agent configuration
Open
~/.claude/settings.json in your editor and paste the following, replacing the placeholder with your actual A2Agent key:~/.claude/settings.json
ANTHROPIC_AUTH_TOKEN must be your A2Agent API key — not a key from Anthropic. A2Agent accepts requests in the Anthropic API format and handles routing to the underlying model for you.4
Start Claude Code and verify the connection
Launch Claude Code from your terminal:Send a short prompt to confirm it responds correctly. If you see a reply, A2Agent is handling your requests successfully.
Recommended models
For coding tasks, these A2Agent models deliver the best results:Troubleshooting
Connection refused or network error
Connection refused or network error
Verify that
ANTHROPIC_BASE_URL is set to exactly https://api.a2agent.me — no trailing slash, no extra path segments. Any deviation will cause the connection to fail.Model not found
Model not found
If you are specifying a model explicitly, the model name must match an A2Agent model ID exactly — for example,
deepseek-v4-pro, kimi-k2.7-code, glm-5.1, or minimax-m2.5. Check the A2Agent model list for the full catalogue of available IDs.Config changes not taking effect
Config changes not taking effect
Claude Code reads
~/.claude/settings.json at startup. If you edited the file while Claude Code was already running, quit and relaunch it for the new settings to take effect.