Use 4Router in Claude Code

Prices and modelsEndpoint verified 2026-11-09

Generate a Claude Code config from the Anthropic-compatible endpoint in 4Router's docs. The API key in the config is a placeholder; replace it with a key you create at 4Router.

Endpoints

  • Pay as you gohttps://4router.netThe token must be in the AppClaude group.Docs · verified 2026-11-09

Generate the config

Pick from the 30 models this provider sells, or type another model name.

Save to ~/.claude/settings.json; merge it in if the file already exists
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://4router.net",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
    "ANTHROPIC_API_KEY": "",
    "ANTHROPIC_MODEL": "claude-opus-5",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-5",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-opus-5",
    "ANTHROPIC_DEFAULT_FABLE_MODEL": "claude-opus-5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5-20251001"
  }
}

Models and prices

ModelInputOutputRatio
Claude Fable 5.2claude-fable-5-2ccMax-saleSubscription pool$1.44$7.200.18×
GPT-6.1 Terragpt-6.1-terraGptHyperSubscription pool$0.075$0.3750.075×
Gemini 4 Argongemini-4-argonGeminiApi$0.60$3.000.30×
Claude Haiku 5.5claude-haiku-5-5ccMax-saleSubscription pool$0.018$0.0900.18×
GPT-6.1 Solgpt-6.1-solGptHyperSubscription pool$0.15$0.750.075×
Claude Sonnet 5.5claude-sonnet-5-5ccMax-saleSubscription pool$0.36$1.800.18×
Claude Opus 5.5claude-opus-5-5ccMax-saleSubscription pool$0.72$3.600.18×
GPT-6 Lunagpt-6-lunaGptHyperSubscription pool$0.0075$0.0370.075×
GPT-6 Solgpt-6-solGptHyperSubscription pool$0.15$0.750.075×
DeepSeek V4.1 Flashdeepseek-v4.1-flashopenLLM$0.12$0.480.80×
GPT-6 Astragpt-6-astraGptHyperSubscription pool$0.75$3.750.075×
Gemini 3.8 Flashgemini-3.8-flashGeminiApi$0.225$1.120.30×
Claude Fable 5.1claude-fable-5-1ccMax-saleSubscription pool$1.80$8.990.18×
Gemini 3.7 Flashgemini-3.7-flashGeminiApi$0.225$1.120.30×
Grok 4.6grok-4.6Grok$0.30$0.8990.15×
Claude Opus 5claude-opus-5ccMax-saleSubscription pool$0.899$4.500.18×
Gemini 3.6 Flashgemini-3.6-flashGeminiApi$0.45$2.250.60×
GPT-5.6 Lunagpt-5.6-lunaGptHyperSubscription pool$0.015$0.0900.075×
GPT-5.6 Solgpt-5.6-solGptHyperSubscription pool$0.30$1.500.075×
GPT-5.6 Terragpt-5.6-terraGptHyperSubscription pool$0.15$0.8990.075×
Grok 4.5grok-4.5Grok$0.30$0.8990.15×
Claude Sonnet 5claude-sonnet-5ccMax-saleSubscription pool$0.36$1.800.18×
Claude Fable 5claude-fable-5ccMax-saleSubscription pool$1.80$8.990.18×
Claude Opus 4.8claude-opus-4-8ccMax-saleSubscription pool$0.899$4.500.18×
Gemini 3.5 Flashgemini-3.5-flashGeminiApi$0.45$2.700.30×
GPT-5.5gpt-5.5GptApiOfficial API$2.10$12.590.42×
Claude Opus 4.7claude-opus-4-7ccMax-saleSubscription pool$0.899$4.500.18×
Gemini 3.1 Pro Previewgemini-3.1-pro-previewGeminiApi$0.60$3.600.30×
Claude Sonnet 4.6claude-sonnet-4-6ccMax-saleSubscription pool$0.54$2.700.18×
Claude Opus 4.6claude-opus-4-6ccMax-saleSubscription pool$0.899$4.500.18×
$ per 1M tokens. Each model uses the provider's cheapest group; the ratio uses the output price

How to check it works

Restart Claude Code and send a message. If it replies and the request shows up in 4Router's console, it is using this endpoint.

FAQ

settings.json or environment variables?

settings.json applies every time Claude Code starts, for long-term use; the environment variables apply to the current terminal only, for a quick try.

How do I switch back to Anthropic?

Remove these variables from settings.json (or close the terminal where you set them), then restart Claude Code.

Does my key pass through this site?

No. The page only generates config text and never asks for your key; the key only goes into the config file or terminal on your own machine.

Claude Code configs for other providers