Use 4Router in Codex

Prices and modelsEndpoint verified 2026-11-09

Generate a Codex config from the Responses-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.net/v1The token must be in the AppCodex group.Docs · verified 2026-11-09

Generate the config

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

Save to ~/.codex/config.toml; merge it in if the file already exists
model = "gpt-5.6-luna"
model_provider = "4router"

[model_providers.4router]
name = "4Router"
base_url = "https://4router.net/v1"
env_key = "API_KEY_4ROUTER"
wire_api = "responses"

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 Codex and send a message. If it replies and the request shows up in 4Router's console, it is using this endpoint.

FAQ

Why is the key in an environment variable?

config.toml only holds the variable's name, so the key never goes into the config file and does not leak when you share or sync it. To keep it, add the export line to ~/.zshrc or ~/.bashrc.

How do I switch back to OpenAI?

Remove the model_provider line from config.toml, then restart Codex.

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 terminal or environment variables on your own machine.

Codex configs for other providers