Codex connects to Guard through your user config.toml. It also needs a local model catalog for a reliable cold start: without it, the first request can be built before Codex finishes fetching /v1/models, leaving some tools disabled.
Mac / Linux:
mkdir -p ~/.codex
curl -fsSL https://docs.guardrelay.ai/assets/guard-codex-models.json \
-o ~/.codex/guard-codex-models.jsonWindows (PowerShell):
New-Item -ItemType Directory -Force "$HOME\.codex" | Out-Null
Invoke-WebRequest https://docs.guardrelay.ai/assets/guard-codex-models.json `
-OutFile "$HOME\.codex\guard-codex-models.json"Open (or create) the file ~/.codex/config.toml — on Windows that's %USERPROFILE%\.codex\config.toml — and paste:
model = "claude-sonnet-5"
model_provider = "guard"
model_catalog_json = "~/.codex/guard-codex-models.json"
[model_providers.guard]
name = "Guard AI"
base_url = "https://api.guardrelay.ai/v1"
env_key = "GUARD_API_KEY"
wire_api = "responses"The Codex catalog contains six Claude models: claude-sonnet-5, claude-opus-5, claude-opus-4-8, claude-haiku-4-5, claude-fable-5-1 and claude-fable-5. Put the desired ID in model; Sonnet 5 is the default. Fable works without an actually applied server prompt. If a suitable prompt would apply, a Fable request is rejected before billing.
Windows (PowerShell):
$env:GUARD_API_KEY = "gd-your-key-from-bot"
codexMac / Linux:
export GUARD_API_KEY="gd-your-key-from-bot"
codex$env:GUARD_API_KEY = "gd-your-key-from-bot"
codexA one-off run without interactive mode:
codex exec "check connection: reply 'ok'"The configuration above uses wire_api = "responses", that is POST /v1/responses.
| Family | On /v1/responses |
|---|---|
| Kimi | available: it accepts model, input, instructions, stream, tools, tool_choice, parallel_tool_calls, max_output_tokens, reasoning, text, temperature, top_p, prompt_cache_key, include, store, truncation and metadata |
| Composer, Grok | Available: model, input, instructions, max_output_tokens, stream and client tools. Supported additional compatibility fields are listed below. |
model = "cursor-grok-4.6-high"
model_provider = "guard"
[model_providers.guard]
name = "Guard AI"
base_url = "https://api.guardrelay.ai/v1"
env_key = "GUARD_API_KEY"
wire_api = "responses"Codex calls the Responses surface, and Kimi serves it. The configuration is the Claude one with two differences: an exact Kimi id in model, and no model catalog. The downloaded guard-codex-models.json describes Claude models only, so leave the model_catalog_json line out for Kimi: with a foreign catalog Codex treats the model as unknown.
model = "k3"
model_provider = "guard"
[model_providers.guard]
name = "Guard AI"
base_url = "https://api.guardrelay.ai/v1"
env_key = "GUARD_API_KEY"
wire_api = "responses"The key is passed through the GUARD_API_KEY variable. Mac / Linux:
export GUARD_API_KEY="gd-your-key-from-bot"
codex$env:GUARD_API_KEY = "gd-your-key-from-bot"
codexWindows (PowerShell):
$env:GUARD_API_KEY = "gd-your-key-from-bot"
codexA one-off connection check without interactive mode:
codex exec "check connection: reply 'ok'"No catalog download is needed, simply leave the model_catalog_json line out. Put an exact id in model: Composer has composer-2.5; Grok has cursor-grok-4.6-low, -medium, -high, -xhigh. Every id also has a -fast variant: the same answer, faster and more expensive.
The key is passed through the same GUARD_API_KEY variable. Mac / Linux:
export GUARD_API_KEY="gd-your-key-from-bot"
codex$env:GUARD_API_KEY = "gd-your-key-from-bot"
codexWindows (PowerShell):
$env:GUARD_API_KEY = "gd-your-key-from-bot"
codexA one-off connection check without interactive mode:
codex exec "check connection: reply 'ok'"