Use Claude Opus 5, GPT-5.6 Sol and more with $175+ free credits.
One API key. Works with Cline, Cursor, Claude Code CLI and more.
AgentRouter is a free API gateway that unifies multiple AI providers (Anthropic, OpenAI, DeepSeek, etc.) behind a single endpoint. You get $125 welcome bonus on sign-up + $25 daily just for logging in.
The catch: AgentRouter uses a WAF (Web Application Firewall) that blocks requests from unauthorized clients. This proxy solves that.
This repo includes:
| File | Purpose |
|---|---|
agentrouter_proxy.py |
Main proxy — WAF bypass, auto-retry, streaming, live dashboard |
format_bridge.py |
Anthropic ↔ OpenAI format translation (enables GPT models) |
- WAF Bypass — Automatic header masking to pass through AgentRouter's firewall
- Dual Format Support — Use both Claude and GPT models from the same client
- Bridge Mode — Translates Anthropic-format requests to OpenAI format (and back)
- Smart Text Bypass — Evades content filters via Cyrillic character substitution without breaking Russian text
- Live Dashboard — Monitor requests, model usage, and logs from your browser
- Auto Retry — Automatically retries on 502/503/504 gateway errors
- SSE Streaming — Responses arrive chunk-by-chunk with zero buffering
- Tool Call Support — Full function calling compatibility
Go to agentrouter.org/register and sign in with your GitHub account.
You'll receive $125 bonus instantly. Log in daily for an extra +$25.
After signing up, go to API Keys → Create Key → copy your token (starts with sk-...).
- Python 3.10+ (pre-installed on macOS)
- Node.js 18+ (for Cline / Claude Code)
- VS Code + Cline extension
Install Python dependencies:
pip3 install fastapi uvicorn httpxgit clone https://github.com/justbiar/agent-router.git
cd agent-routerOr download manually — just make sure both .py files are in the same folder.
python3 agentrouter_proxy.pyYou should see:
Proxy started: http://127.0.0.1:8318 → https://agentrouter.org
Bridge: gpt-5.6-sol | WAF bypass: on | Dashboard: http://127.0.0.1:8318/dashboard
Keep this terminal open! The proxy needs to stay running.
Visit http://127.0.0.1:8318/dashboard in your browser.
You'll see:
- Total request count
- Success / failure rates
- Model usage breakdown
- Live log stream (real-time via WebSocket)
- Install the Cline extension in VS Code
- Open Cline panel → ⚙️ Settings
- Enter these values:
| Field | Value |
|---|---|
| API Provider | Anthropic |
| API Key | sk-... (your AgentRouter key) |
| Use custom base URL | ✅ check |
| Base URL | http://127.0.0.1:8318 |
| Model | claude-opus-5 or claude-opus-4-8 |
Tip: If you can't find the model in the dropdown, type it manually.
Set environment variables in your terminal:
macOS / Linux:
# Add to ~/.zshrc or ~/.bashrc:
export ANTHROPIC_BASE_URL="http://127.0.0.1:8318"
export ANTHROPIC_API_KEY="sk-YOUR_KEY"
export ANTHROPIC_AUTH_TOKEN="sk-YOUR_KEY"Restart your terminal, then run:
claudeWindows (PowerShell):
[System.Environment]::SetEnvironmentVariable('ANTHROPIC_BASE_URL', 'http://127.0.0.1:8318', 'User')
[System.Environment]::SetEnvironmentVariable('ANTHROPIC_API_KEY', 'sk-YOUR_KEY', 'User')
[System.Environment]::SetEnvironmentVariable('ANTHROPIC_AUTH_TOKEN', 'sk-YOUR_KEY', 'User')If you get "Not logged in" error:
New-Item -ItemType Directory -Force -Path "$HOME\.claude"
Set-Content -Path "$HOME\.claude\.credentials.json" -Value '{"hasCompletedOnboarding": true}'- Settings → Models
- Disable
Cursor Tab - Enable Override Base URL →
http://127.0.0.1:8318 - Enter your API key and save
Cmd/Ctrl+Shift+P → Open User Settings (JSON) → add:
{
"claudeCode.environmentVariables": [
{ "name": "ANTHROPIC_AUTH_TOKEN", "value": "sk-YOUR_KEY" },
{ "name": "ANTHROPIC_BASE_URL", "value": "http://127.0.0.1:8318" },
{ "name": "ANTHROPIC_MODEL", "value": "claude-opus-5" }
],
"claudeCode.disableLoginPrompt": true
}Want to use these models inside OpenCode? There's a full, beginner-friendly, step-by-step guide here:
This fork also includes SSE compatibility fixes for OpenCode: it filters malformed data: null chunks that OpenCode's AI SDK rejects, and auto-corrects a missing /v1 prefix in the base URL — so the stream always arrives clean.
| Model | Provider | Pricing (Input / Output) |
|---|---|---|
claude-opus-5 |
Anthropic | $5 / $25 per M tokens |
claude-opus-4-8 |
Anthropic | Higher |
claude-sonnet-4-20250514 |
Anthropic | Lower |
gpt-5.6-sol |
OpenAI (via bridge) | Varies |
With bridge mode enabled, you can use GPT models from any Anthropic-compatible client.
Customize proxy behavior with these environment variables:
| Variable | Default | Description |
|---|---|---|
AGENTROUTER_UPSTREAM |
https://agentrouter.org |
Upstream server URL |
AGENTROUTER_HOST |
127.0.0.1 |
Listen address |
AGENTROUTER_PORT |
8318 |
Listen port |
AGENTROUTER_BRIDGE |
true |
Bridge mode (GPT support) |
AGENTROUTER_BRIDGE_MODEL |
gpt-5.6-sol |
Bridge target model |
AGENTROUTER_MODEL |
(empty) | Force a specific model for all requests |
AGENTROUTER_WAF |
true |
WAF text bypass |
AGENTROUTER_RETRY |
true |
Auto retry on gateway errors |
AGENTROUTER_RETRY_MAX |
2 |
Max retry attempts |
AGENTROUTER_LOGLEVEL |
INFO |
Log level |
Example: Force claude-opus-5 for all requests:
AGENTROUTER_MODEL=claude-opus-5 python3 agentrouter_proxy.pyExample: Disable bridge mode (Claude models only):
AGENTROUTER_BRIDGE=false python3 agentrouter_proxy.pyQ: python command not found?
Use python3 on macOS. Use pip3 instead of pip.
Q: format_bridge.py not found warning? Make sure both files are in the same folder. Without the bridge, only Claude models work — GPT models won't.
Q: 401 Unauthorized error? Check your API key. Generate a new one from the AgentRouter dashboard.
Q: Connection drops?
Make sure the proxy terminal is still open. Restart with python3 agentrouter_proxy.py if you closed it.
Q: Is it safe? The proxy runs on localhost only — it's not accessible from outside. However, all requests pass through AgentRouter's servers — don't use it for sensitive or NDA-protected code.
agentrouter.org/register — Sign in with GitHub, get $125 instantly. +$25 daily login bonus.
MIT — Use it, modify it, share it. Free forever.