Docs / Clients / Codex

Codex

Codex speaks the OpenAI Responses protocol. Configure a custom model provider that points at the /oss/v1 base URL (which includes /v1).

~/.codex/config.toml

toml
model = "claude-sonnet-4-7"
model_provider = "opengateway-oss"

[model_providers.opengateway-oss]
name = "OpenGateway OSS"
base_url = "https://api.opengateway.one/oss/v1"
env_key = "OPENGATEWAY_API_KEY"
wire_api = "responses"
bash
export OPENGATEWAY_API_KEY="YOUR_KEY"
Don't rely on the models list

Codex's background catalog refresh expects {"models":[…]}, not the OpenAI {"data":[…]} shape, and can error on startup if it parses the gateway list. Set model explicitly (above), and if your build still refreshes, add a local model_catalog_json so the network refresh is disabled.

Effort & context

  • model_reasoning_effort (none|minimal|low|medium|high|xhigh) maps to the Responses reasoning.effort field — see Effort levels.
  • model_context_window is client-side: Codex truncates prompts to it, so set it to match the model you target. See 1M context.

If a Codex build has trouble with wire_api = "responses" for a model, add a second provider with wire_api = "chat" and use /v1/chat/completions semantics.