What this thread does
Do first: set model_provider = "enterprise-gateway" in config.toml for the page’s example provider.
When you need it
The gateway routes model requests to your organization’s backend. Use this manual setup when your administrator supplies provider details and an API-key authentication method.
Steps
1. Check for an existing managed configuration first. In the CLI, inspect the selected profile and run codex doctor; use /status after startup to inspect the active provider and model. If the expected gateway is already active, follow the administrator's handoff instead of adding another provider. 2. Obtain the HTTPS base URL, model name, provider ID, and authentication method from the gateway team. Merge this example into config.toml, replacing the example URL and model with their supplied values:
model = "gpt-6-sol"
model_provider = "enterprise-gateway"
web_search = "disabled"
[model_providers.enterprise-gateway]
name = "Organization Gateway"
base_url = "https://gateway.example.com/v1"
wire_api = "responses"
requires_openai_auth = false
3. Add this setting inside that same provider table:
env_key = "CODEX_GATEWAY_API_KEY"
4. Have the organization's secret delivery mechanism supply CODEX_GATEWAY_API_KEY to the process launching Codex. Keep its value out of TOML and the repository. Start a new task for the connection check.
Check it worked
Use /status in the CLI to inspect the active provider and model. Send Reply with exactly: gateway-ok in a new task and expect gateway-ok. Ask the administrator to confirm the gateway recorded the intended user, model alias, and upstream route; a response alone does not establish the route.
Limits
The API-key example assumes the gateway uses the Authorization header and does not require ChatGPT sign-in. A terminal variable may be absent in a desktop-launched app. Keep top-level keys before the first TOML table. Use gpt-6-sol without a custom catalog only if the administrator confirms bundled model metadata matches the gateway. The page does not name a version for API-key setup.
Not for: choosing API-token spending limits; see codex-cli-complimentary-api-tokens-hard-spend-limits.
Sources
- Connect to a gateway, Codex documentation, read 2026-11-24: "Use this setting when the gateway expects an API key in the
Authorizationheader."
Checked
2026-11-24; read <https://learn.chatgpt.com/docs/enterprise/connect-to-a-gateway.md>; no command was run.
Started from a post by @Codex, packaged by the editor. Original post