~/.codex/config.toml, so setting up one sets up all of them.
OpenAI models get Codex’s requests as they are. Other models (Claude, Gemini
and the rest) work too: AI Gateway translates for them, including the app’s own
tools.
Set it up (macOS)
Create a key in My Library › Models and pick Codex app under Start using this key. Already have a key? Open its menu and select Set up.-
Save the key in the Keychain. An app opened from the Dock doesn’t
always see variables from your shell profile, so the app reads the key from
the macOS Keychain instead. Run this in Terminal:
-Ureplaces a key saved earlier, so run it again to change the key. -
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. Provider settings only work in this file, not in a project’s.codex/config.toml. It looks like this: -
Quit ChatGPT completely with ⌘Q (closing the window isn’t enough),
then open it again. The app reads the key and
config.tomlwhen it starts. - Pick your model in the model menu under Codex’s message box.
codex app-server daemon restart after changing
config.toml.
Already set up the Codex CLI?
If you followed the Codex CLI steps (the key in~/.zshrc and echo $OPENWORK_API_KEY in the auth block), the app can use
them as they are: it loads your shell profile for Codex when it starts. Quit it
with ⌘Q and open it again after changing the key. If the app answers
401 Unauthorized, switch to the Keychain steps above.
On Windows
Set the key withsetx OPENWORK_API_KEY "<your API key>", sign out of Windows
and back in (so apps started from the Start menu see it), and use this auth
block in %USERPROFILE%\.codex\config.toml:
What works
- Chat, running commands, editing files, and multi-turn conversations, on OpenAI and other models. You can switch models in the same conversation.
- The app’s own tools (threads, automations, artifacts and the rest) are offered to every model.
- Web search isn’t available through AI Gateway: it runs on OpenAI’s side.
- The app names conversations with its own OpenAI model. That request isn’t one of your models, so AI Gateway refuses it; conversations may keep a default title.