integrations/coding agent/Codex CLI
CX

Codex CLI + AIgateway

OpenAI's terminal coding agent, pointed at any of our models.

Codex is OpenAI's CLI coding agent. Define AIgateway as a custom model provider in ~/.codex/config.toml and Codex runs on any of our models — Claude, GPT, Gemini, Kimi, GLM — through one OpenAI-compatible endpoint.

Codex CLI homepage →
Setup

Three steps or fewer.

STEP 01

Add the provider

Register AIgateway as a model provider in ~/.codex/config.toml (wire_api "chat" — the OpenAI Chat Completions shape the gateway serves), then point Codex at it.

# ~/.codex/config.toml
[model_providers.aigateway]
name = "AIgateway"
base_url = "https://api.aigateway.sh/v1"
env_key = "AIGATEWAY_API_KEY"
wire_api = "chat"

model = "zai-org/glm-5.3-flash"
model_provider = "aigateway"
STEP 02

Set the key and run

Codex reads the key from the env var named above. Any model in the catalog works — swap the slug to change models.

export AIGATEWAY_API_KEY="sk-aig-..."
codex

# any model in the catalog:
#   model = "anthropic/claude-opus-4.7"
#   model = "openai/gpt-5.4"
#   model = "moonshot/kimi-k2.7-code"
Notes
  • Model IDs are provider/slug pairs — see the full catalog at https://aigateway.sh/models.
More integrations

Same key. Every other tool.