Codex¶
Add one provider entry to Codex's configuration and every call it makes is governed: checked against your policies, charged to your team and recorded in Request logs. Codex speaks the OpenAI Responses API, and the gateway translates that API to every provider, so Codex can work with Claude, Gemini, Bedrock or Vertex AI models as well as GPT.
What it is¶
Codex is OpenAI's coding agent for the terminal and the IDE. It reads and edits the files in your repository and runs
commands, calling a model through the Responses API (POST /v1/responses), streamed. It calls the gateway from your
machine.
The settings¶
In ~/.codex/config.toml, add a provider that points at the gateway and choose it:
model = "gpt-4.1"
model_provider = "vidai"
[model_providers.vidai]
name = "Vidai"
base_url = "https://<your-gateway>/v1"
env_key = "VIDAI_API_KEY" # the environment variable that holds your Vidai key
wire_api = "responses"
Then set the key in your shell:
export VIDAI_API_KEY="vk_…"
The gateway's address is under Connect your app on the Keys page and in System › Settings › Gateway; the
key comes from Keys › Issue a key (its secret is shown once). The key starts vk_; never use a provider's key.
A minimal call¶
codex exec "Reply with exactly: ok"
Other models¶
Set model to any model approved under Models that your key may call, in the config or for one run:
codex --model claude-sonnet-4-5
codex --model gemini-3.5-flash
The gateway translates each Responses call to the provider's own format and the answer back to Responses events, so Codex's tool loop (reading files, running commands, applying patches) works the same whichever model answers. Reasoning comes back as a reasoning summary Codex can show.
Streaming¶
Codex always streams. A stream from Claude or Gemini arrives as Responses events; tokens and cost are recorded from the provider's own counts. A run you stop part-way is still billed by the provider: it shows in Request logs as Left early, priced.
Reading what the gateway did¶
Look the calls up in Request logs: filter on Key, Model or Path (/v1/responses). Each turn of the
agent's loop is a call of its own, so you can see what a task cost. A call translated for another provider says
Translated, and what had to change.
Errors¶
Codex prints the gateway's error message. Common ones while setting up: 401 invalid_api_key (the key is wrong, or a
provider's key), 403 model_not_allowed (your key may not call that model), 404 model_not_found (check model), 429
(a limit on the key or team). The full list is in Headers and errors.
Live sessions¶
Codex can also open a live session over WebSocket. The gateway can't read one, so it's refused unless an
organisation admin allows it for your key or for everyone: see
Allow or refuse live sessions. Checking live sessions is in
active development; streamed POST /v1/responses, as configured above, has every control in place.
Good to know¶
- Codex's own state kept at OpenAI (
previous_response_id, stored conversations) works with OpenAI models only. On another provider the gateway sends the full conversation each turn, as Codex does withstore: false. - OpenAI's hosted tools that another provider doesn't have are left out and named in
x-vidai-adapted(Any SDK to any provider).