Codex CLI

Connect OpenAI Codex CLI through the OpenAI - compatible Model Gate API

Codex CLI

Codex CLI is an open-source terminal coding agent from OpenAI. It can use any enabled model through Model Gate.

Configuration

Edit ~/.codex/config.toml on Linux/macOS or C:\Users\%USERNAME%\.codex\config.toml on Windows.

model = "gpt-5.4"
model_provider = "modelgate"
model_reasoning_effort = "high"

[model_providers.modelgate]
name = "modelgate"
base_url = "https://api.model-gate.com/v1"
wire_api = "responses"
requires_openai_auth = true

For Codex CLI, the base URL includes /v1.

Add the key to ~/.codex/auth.json or C:\Users\%USERNAME%\.codex\auth.json:

{ "OPENAI_API_KEY": "mg_live_..." }

Usage

codex

Reasoning effort

  • low: faster, shorter answers
  • medium: balanced speed and quality
  • high: deeper reasoning for complex work