Set it up
Create a key in My Library › Models and pick OpenAI Codex under Start using this key. Already have a key? Open its menu and select Set up.-
Put the key in your shell profile. Add this line to
~/.zshrc(or~/.bashrc), then open a new terminal: -
Add the provider to Codex. Choose a model (and a thinking level, for
models that have levels) on the page, then put the configuration it shows at
the top of
~/.codex/config.toml, replacing anymodelormodel_providerlines already there. It looks like this: -
Restart Codex’s background server. In a new terminal (one that has the
key), run:
Codex runs a background server that keeps going after you quit Codex or close the terminal. It reads the key and
config.tomlwhen it starts, so without this step it keeps using what it had before, even in a new terminal. Run it again whenever you change the key orconfig.toml. -
Start Codex in your project with
codex. -
Check it. Run
/status: it should show theopenworkprovider./modellists your models and their thinking levels.
auth block) rather than env_key:
only then does Codex load your models from AI Gateway, with their context
windows and thinking levels, for /model.
On Windows
Set the key withsetx OPENWORK_API_KEY "<your API key>", open a new
terminal, run codex app-server daemon restart, and use this auth block
instead:
Model names
Each of your models has a name for Codex:/model.
- Thinking level:
model_reasoning_effort(or the level you pick in/model) sets it. A level at the end of the name (openwork/gpt-5.5-k3f9:high) wins over it. - OpenAI models (including Azure OpenAI) get Codex’s requests as they are, so reasoning carries across turns as it does with OpenAI.
- Other models are translated. Codex’s tools (running commands, editing
files with
apply_patch, sub-agents) work on them too. - Web search isn’t available through AI Gateway: it runs on OpenAI’s side. Codex works without it.
/modelalso lists Codex’s own OpenAI models, after yours. They only work when your organization offers that model.