A short, copy-paste guide to using Claude Opus models with Claude Code, Cursor, Cline, and Claude Desktop by pointing them at AgentRouter — a third-party API gateway that currently provides promotional/free credits for AI-coding tools.
📚 Cross‑checked against AgentRouter's official docs: https://agentrouter.org/docs/index.html
⚠️ Heads up (read this): AgentRouter is an unofficial, third‑party gateway. It is not Anthropic and is not affiliated with Anthropic. Free-credit promotions, eligibility, model names, limits, and uptime can change often and may disappear or change without notice. Great for experimenting and learning — don't push private, proprietary, or client code / secrets through it, and use the official Anthropic API or a Claude subscription for anything production or confidential. See Good to know.
👉 Sign up here: https://agentrouter.org/register?aff=kgU5
If AgentRouter's referral program is active and you are eligible, registering through a referral link may give both you and the referrer bonus credits. Using the link above supports the person who shared this guide.
- Register:https://agentrouter.org/register?aff=kgU5
- Claim promotional credit: if your account is eligible, complete the dailycheck-in . At the time of writing, AgentRouter shows a**+$25 check-in credit** . You may need tolog out and back in for the balance to update.
- Create an API key:https://agentrouter.org/console/token
- Point your tool at AgentRouter: - Claude Code / Cline (Anthropic mode) → Base URL
https://agentrouter.org(no/v1)
- Cursor / Cline (OpenAI mode) → Base URL
https://agentrouter.org/v1(with/v1)
- Claude Code / Cline (Anthropic mode) → Base URL
- Pick a model:
claude-opus-4-8(orclaude-opus-5). - Ask it to "reply with only OK" to confirm it works. 🎉
AgentRouter is a free API gateway that exposes popular large models behind Anthropic‑compatible and OpenAI‑compatible endpoints, so tools that already speak those protocols (Claude Code, Cursor, Cline, Codex, Roo Code, and more) can use it with zero code changes. You can receive promotional credits through mechanisms such as daily check-ins and referrals. Availability of credits, top-up options, and program rules are controlled by AgentRouter and may change.
At the time of writing, the following Opus models are available through AgentRouter's promotional/free-credit offering:
| Model ID | Notes |
|---|---|
claude-opus-4-8 |
Recommended default, very capable |
claude-opus-5 |
Newest Opus |
It also serves other free models such as glm-5.3, deepseek-v4-flash, and gpt-5.6-sol.
🔁 Model IDs change over time. New Opus versions ship and old IDs get retired. AgentRouter's own per‑tool docs sometimes lag (they may still mention claude-opus-4-5, claude-opus-4-6, or claude-opus-4-7). Always treat the model list in your console as the source of truth: open https://agentrouter.org/console and use whatever Opus IDs are live. If a model ID errors out, it was probably renamed — swap in the current one.
- Go to https://agentrouter.org/register?aff=kgU5 .
- Sign in with GitHub (or LinkDo). Email verification is not required.
🇨🇳 Can't reach the site (e.g. mainland China)? Use the official backup domain https://ps.air-outer.com — it mirrors both the site and the API and works identically. Everywhere this guide says agentrouter.org, you can substitute ps.air-outer.com.
- Daily check‑in: click the check‑in / sign‑in button in the console for**+$25 credit** . You mustlog out and log back in for the credit to show up.
- Referrals: share your own referral link (find it in the console) — you and each new user both get bonus credit.
💡 If your balance shows $0 right after claiming, it's usually just a display glitch — wait a moment and refresh.
- Open the token page: https://agentrouter.org/console/token
- Create a new token
- Click on create token
- Provide a name for example claude_token
- Enable Unlimited quota
- Click on submit
- Click on
- Copy the Key (looks like
sk-...). Treat it like a password.
You'll paste this key into whichever tool you use below.
The one thing to get right: the base URL depends on which protocol the tool speaks.
Protocol Base URL Used by Anthropic‑compatible https://agentrouter.org Claude Code, Cline (Anthropic provider) OpenAI‑compatible https://agentrouter.org/v1 Cursor, Cline (OpenAI Compatible provider) ❗ For the Anthropic endpoint, do not add /v1. Mixing these up is the #1 cause of errors.
Claude Code uses the Anthropic‑compatible config.
1. Make sure you have Node.js 18+
node --version
2. Install Claude Code
npm install -g @anthropic-ai/claude-code@latest
3. Verify the install
claude --version
4. Set the AgentRouter environment variables
macOS / Linux:
export ANTHROPIC_AUTH_TOKEN="YOUR_AGENTROUTER_API_KEY"
export ANTHROPIC_BASE_URL="https://agentrouter.org"
export ANTHROPIC_MODEL="claude-opus-4-8" # or: claude-opus-5
Windows (PowerShell):
$env:ANTHROPIC_AUTH_TOKEN="YOUR_AGENTROUTER_API_KEY"
$env:ANTHROPIC_BASE_URL="https://agentrouter.org"
$env:ANTHROPIC_MODEL="claude-opus-4-8" # or: claude-opus-5
To make it stick across terminal sessions, add the three export lines to your ~/.zshrc or ~/.bashrc (macOS/Linux), or on Windows run setx ANTHROPIC_BASE_URL "https://agentrouter.org" (and the others) once, then reopen the terminal.
5. Launch and test
claude
If it replies OK, you're connected. If the first launch asks whether to use the API key from your environment, confirm yes.
⚠️ Already logged into Claude Pro / Max / Team? These environment variables override your subscription login. To go back to your subscription, unset them and restart:
unset ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL
claude
Cursor talks to the OpenAI‑compatible endpoint.
- Download, install, and log in to Cursor (model settings are locked until you sign in).
- Go to Cursor Settings → Models .
- Under OpenAI API Key , paste your AgentRouter API key and enable the toggle.
- Enable Override OpenAI Base URL and set it to
https://agentrouter.org/v1. - Test by sending "reply with only OK" in chat.
⚠️ Cursor limitation: on Cursor's free tier, a custom third‑party API often can't pick a specific model — you may be stuck in Auto mode. If you specifically want to choose Opus, Claude Code or Cline give you far more control.
Cline supports both protocols. For Claude Opus, use the Anthropic path.
- In VS Code, open Extensions , searchCline , and install it.
- Get your API key from https://agentrouter.org/console/token .
- Open the Cline panel → Settings / API Configuration .
For Claude Opus (recommended):
- API Provider:
Anthropic - Check Use custom base URL
- Custom Base URL:
https://agentrouter.org←no/v1 - API Key: your AgentRouter key
- Model:
claude-opus-4-8(orclaude-opus-5) - Save, then send "reply with only OK" to test.
For OpenAI‑style models (e.g. gpt-5.6-sol, glm-5.3):
- API Provider:
OpenAI Compatible - Base URL:
https://agentrouter.org/v1←with/v1 - API Key: your AgentRouter key
- Model ID: e.g.
gpt-5.6-solorglm-5.3
Keep the two methods separate — don't mix the Anthropic base URL with the OpenAI provider or vice‑versa.
Beyond the three above, AgentRouter documents setups for: Codex, Qwen Code, Roo Code, Kilo Code, GitHub Copilot, OpenCode, OpenClaw, Hermes Agent, Pi, Trae, Claude App, and Gemini CLI. See https://agentrouter.org/docs/index.html.
| Symptom | Likely cause & fix |
|---|---|
| 401 Unauthorized | Wrong base URL for the protocol, or an unsupported client. Double‑check Anthropic = https://agentrouter.org (no/v1 ), OpenAI =.../v1 . Use an officially supported client. |
| 400 content blocked | Your request contains an unsupported language. AgentRouter currently only allows Chinese, English, French, German, Russian . Rewrite the prompt and retry. |
| Model not found / errors on a model ID | The ID was probably renamed. Open https://agentrouter.org/console and use a currently‑listed Opus ID (e.g.claude-opus-4-8 /claude-opus-5 ). |
| Balance shows $0 | Usually a display glitch — wait and refresh. Also make sure you logged out/in after the check‑in. |
| Claude Code complains about a background/"small/fast" model | Optionally set ANTHROPIC_SMALL_FAST_MODEL to a model that's actually available (e.g.claude-opus-4-8 ). |
| Can't open the site | Use the backup domain https://ps.air-outer.com . |
- It's unofficial. AgentRouter is a third‑party gateway, not Anthropic. Your prompts pass through their servers —never send secrets, credentials, or confidential/proprietary code.
- Reliability varies. The service has had upstream outages and has temporarily lost Claude models in the past. If it's down, that's normal for a free service — check their status/announcements.
- Free credits & models can change or end at any time. Don't build anything you depend on around it.
- For serious/production use, use the officialAnthropic API or a Claude Pro/Max subscription.
AgentRouter bans abuse and will ban accounts for it. Don't: mass‑register or farm credits, run automated arbitrage/scraping, resell or share accounts/credits, do fake‑invite fraud, or try to bypass limits. Full terms: https://agentrouter.org/docs/terms.html.
- Official AgentRouter docs: https://agentrouter.org/docs/index.html
- Sign up (referral): https://agentrouter.org/register?aff=kgU5
This guide is provided as‑is for educational purposes. Model availability and platform terms are controlled by AgentRouter and may change.
-
Sign in with GitHub (or LinkDo). Email verification is not required.
-
Open the token page: https://agentrouter.org/console/token
-
Create a new token
- Click on create token
- Provide a name for example claude_token
- Enable Unlimited quota
- Click on submit
-
Click on
-
Copy the Key (looks like
sk-...). Treat it like a password. -
Open the Claude Desktop application
-
Ensure Developer Mode isactive (found viaHelp →Troubleshooting →Enable Developer Mode )
-
Locate the new Developer tab in your top application menu bar
-
Click Configure Third-Party Inference ... to open the setup window
- Set the Connection or Provider type asGateway
- Credential kind asStatic API key
- Gateway base URL as**https://agentrouter.org/**
- Gateway API key asyour token you created in step2
- Gateway auth scheme asbearer
- Set the
- Click on Save Changes thenApply Changes
- Restart popup will come so restart it
- Tada now you are good to use Claude