Skip to content

Codex

Codex CLI reaches Inferray through the Responses API. That matters more here than for the other agents: since v0.122 Codex dropped wire_api = "chat", so a provider that only serves Chat Completions will not work with it at all. Inferray serves /v1/responses, so Codex works without a translating layer in between.

Add the provider

Codex is configured from ~/.codex/config.toml. Add a provider block and point the top-level settings at it:

model = "gpt-5.5"
model_provider = "inferray"

[model_providers.inferray]
name = "Inferray"
base_url = "https://api.inferray.com/v1"
env_key = "INFERRAY_API_KEY"
wire_api = "responses"

Then export the key that env_key names:

export INFERRAY_API_KEY="inferray_..."

env_key holds the name of the environment variable, not the key itself, so the config file stays safe to commit.

The fields that matter

  • wire_api = "responses" — required. It is also the default when omitted, but write it out: it is the line that explains why the provider id has to point somewhere that serves /v1/responses.
  • base_url — include the /v1. Codex appends /responses to it.
  • model_provider — must match the id in [model_providers.<id>]. The id is yours to pick, but it can't reuse a reserved built-in name such as openai, ollama, or lmstudio.
  • model — any id from the catalogue. Claude and Gemini ids work here too, since every model answers on the Responses endpoint.

Switch models per run

codex --model claude-opus-4-8

Or set a different default in config.toml. The /model picker lists what Codex knows about; entering the Inferray id directly is the reliable route.

Check it worked

Send one request straight at the endpoint first, so a failure points at the configuration rather than at Codex:

curl https://api.inferray.com/v1/responses \
  -H "Authorization: Bearer $INFERRAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-5.5", "input": "ship it"}'

A JSON body with an output array means the URL and key both work. Then run codex and send a prompt.

Stored responses

Codex sets store itself depending on how it is chaining turns, and Inferray forwards the flag as sent. Inferray exposes POST /v1/responses only, so the routes for fetching a stored response back are not available through it — if Codex is configured in a way that depends on retrieving stored responses by id, keep store off.