Skip to main content
Claude Code is Anthropic’s agentic coding assistant. By pointing it at A2Agent, you replace the default Anthropic backend with models like DeepSeek, Kimi, or GLM — at a fraction of the official price — without changing how you use Claude Code day-to-day.

Prerequisites

Setup

1

Install Claude Code

If you haven’t already, install Claude Code globally via npm:
npm install -g @anthropic-ai/claude-code
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:
mkdir -p ~/.claude && touch ~/.claude/settings.json
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
{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "sk-your-a2agent-key",
    "ANTHROPIC_BASE_URL": "https://api.a2agent.me",
    "CLAUDE_CODE_MAX_OUTPUT_TOKENS": "32000"
  },
  "permissions": { "allow": [], "deny": [] }
}
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.
Setting CLAUDE_CODE_MAX_OUTPUT_TOKENS to 32000 allows Claude Code to produce longer, more complete responses. Lower this value if you want to keep individual completions shorter.
4

Start Claude Code and verify the connection

Launch Claude Code from your terminal:
claude
Send a short prompt to confirm it responds correctly. If you see a reply, A2Agent is handling your requests successfully.
For coding tasks, these A2Agent models deliver the best results:
ModelBest for
deepseek-v4-proComplex refactoring and architecture
glm-5.1General-purpose coding assistance
kimi-k2.7-codeCode generation and debugging
minimax-m2.5Long-context code analysis

Troubleshooting

Claude Code is sending your request but A2Agent is rejecting the credentials. Open ~/.claude/settings.json and confirm that ANTHROPIC_AUTH_TOKEN contains your full A2Agent key with no extra spaces or quotes.
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.
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.
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.