Gateway

Edit ~/.codex/config.toml

Codex CLI and GPT-compatible clients read a custom provider from config.toml. Set base_url to the gateway /v1 path and keep the key in ZEROUTER_API_KEY.

Last updated 7 September 2026.

Codex CLI and GPT ยท config.toml

Edit ~/.codex/config.toml

Add a provider named zerouter. base_url must include /v1. Set ZEROUTER_API_KEY in the environment, then start Codex.

~/.codex/config.toml

model = "gpt-5.4"
model_provider = "zerouter"

[model_providers.zerouter]
name = "zerouter"
base_url = "https://api.zerouter.ai/v1"
env_key = "ZEROUTER_API_KEY"
wire_api = "responses"

Then export the key

export ZEROUTER_API_KEY="sk-xxxx"
codex