Codex
Add opengateway as a Codex CLI provider profile in ~/.codex/config.toml — run codex --profile opengateway, your default provider stays untouched.
codex --profile opengateway profile and saves it as the opengateway-codex skill.Run it once, nothing saved#
Not ready for either? Copy the command instead — the whole provider goes
in as -c overrides, nothing is written anywhere, and the next plain
codex run is exactly as before:
OPENGATEWAY_API_KEY="YOUR_OPENGATEWAY_API_KEY" codex \-c 'model_provider="opengateway"' \-c 'model="z-ai/glm-5.2-ultrafast"' \-c 'model_providers.opengateway.name="opengateway"' \-c 'model_providers.opengateway.base_url="https://apis.opengateway.ai/v1"' \-c 'model_providers.opengateway.env_key="OPENGATEWAY_API_KEY"' \-c 'model_providers.opengateway.wire_api="responses"'
Set it up by hand#
1. Get an API key#
opengateway.ai → API Keys → Create Key.
Export it in your shell profile (~/.zshrc or ~/.bashrc):
export OPENGATEWAY_API_KEY="YOUR_OPENGATEWAY_API_KEY"
2. Add the profile#
Add to ~/.codex/config.toml — any model ID from the
catalog works; z-ai/glm-5.2-ultrafast
is just the example:
# opengateway-codex:start[model_providers.opengateway]name = "opengateway"base_url = "https://apis.opengateway.ai/v1"env_key = "OPENGATEWAY_API_KEY"wire_api = "responses"# opengateway-codex:end
Then put the profile in its own file, ~/.codex/opengateway.config.toml:
model_provider = "opengateway"model = "z-ai/glm-5.2-ultrafast"
The marker comments make the config.toml block ours — undoing the setup
is deleting everything between them plus the profile file, nothing else
changes. On an old Codex that errors on the separate profile file, use a
[profiles.opengateway] table inside the markers instead — recent Codex
rejects that legacy table, which is why the file is the default.
wire_api = "responses" matters — Codex talks the Responses API
(/v1/responses), which opengateway serves natively. To make opengateway
the default, set top-level model and model_provider too.
3. Verify#
codex --profile opengateway exec "Reply with OK"
A response means it works — the call is already on the dashboard with tokens, cost, and latency.