Clients

Codex

Run the Codex CLI through OpenLLM with openllm codex, pick a model with -m, or add OpenLLM as a custom model provider in ~/.codex/config.toml.

Commandopenllm codex
ModePer session. Nothing is installed.
Talks toOpenAI Responses API at <gateway>/v1
Default modelultra
Skip approvalsopenllm -d codex (adds --dangerously-bypass-approvals-and-sandbox)
RemoveNothing to remove. Run codex directly.

Before you begin

  • Install the OpenLLM CLI. See Install.
  • Install the Codex CLI so that codex is on your PATH. If it is missing, openllm codex prints the official installer, https://chatgpt.com/codex/install.sh.
  • Have at least one model available. See Providers.

For the ChatGPT desktop app, use ChatGPT for Mac instead.

Set up with openllm codex

openllm codex

Every argument after codex goes to Codex unchanged, so openllm codex exec "…" runs a non-interactive task. OpenLLM's own flags go before the client name: -d, --new, and --attach [id].

At launch, OpenLLM picks a gateway: your local daemon at http://127.0.0.1:8787 if it answers, otherwise https://www.openllm.sh. It then starts the real codex binary with -c key=value overrides layered on your own config:

OverrideValue
model_provideropenllm
modelultra
model_providers.openllm.base_url<gateway>/v1
model_providers.openllm.wire_apiresponses
model_providers.openllm.env_keyOPENLLM_API_KEY
model_catalog_json~/.openllm/run/codex/<pid>/models.json
mcp_servers.openllmopenllm mcp

Your key is passed in the OPENLLM_API_KEY environment variable of the Codex process, so it never appears in the command line. The model catalog is fetched from your account at each launch and deleted when Codex exits. If the fetch fails, Codex starts without it.

Your ~/.codex/config.toml, login, and history are untouched. Interactive sessions run in a background session host; run openllm --new codex to skip the offer to attach to a running session.

Set up without the CLI

openllm codex is the recommended path. To run Codex against OpenLLM without the OpenLLM CLI, add a custom model provider to ~/.codex/config.toml. These match the provider settings that the launcher passes with -c:

~/.codex/config.toml
model_provider = "openllm"
model = "ultra"

[model_providers.openllm]
name = "OpenLLM"
base_url = "https://www.openllm.sh/v1"
wire_api = "responses"
env_key = "OPENLLM_API_KEY"

Then export your key in the shell that starts codex:

export OPENLLM_API_KEY="sk-llm-YOUR_KEY"
codex
  • env_key names the variable that holds your key, so the key stays out of the config file.
  • To use the daemon on the same machine, set base_url = "http://127.0.0.1:8787/v1". See Use the local daemon.
  • Without the model catalog that openllm codex fetches, Codex can warn Model metadata for <slug> not found.
  • To go back to your usual provider, remove these lines.

A manual setup doesn't get the openllm MCP server. To add it yourself, see MCP server.

Choose models

Codex has one model setting, and OpenLLM sets it to ultra. The catalog lists ultra, plus, lite, and every model you have activated, with their context limits.

To pin a model, pass Codex's own flag: openllm codex -m plus or openllm codex -m <provider/model>. You can also switch with /model inside a session. To change what the aliases resolve to, edit the chains in Configuration. See Routing and fallback.

Codex sessions get OpenLLM memory tools through MCP. Automatic recall and save hooks are not added for Codex. See Memory.

Who pays for a request

The model that serves the request decides. A ChatGPT subscription hop runs on your own ChatGPT login through the daemon on one of your devices. An API-key hop bills your provider account. Included openllm/ models count against your plan's allowance. See Providers and Plans and limits.

Check that it works

openllm codex exec "Reply with OK"

The reply prints to your terminal. Open Overview in the app: the request appears with the model that served it.

Common problems

SymptomCauseFix
Codex is not installedcodex is not on your PATHInstall Codex, then run openllm codex again
No models are available for your OpenLLM account.Nothing in your model listConnect a provider on Providers
Codex warns Model metadata for <slug> not foundThe catalog fetch failed at launchCheck your connection and launch again
Compaction fails with subscription_requires_daemon/v1/responses/compact is served only by a device signed in to ChatGPTStart the daemon on that device. See Devices
OpenLLM could not authorize the model-list check.Key is invalid or revokedSave a new key with openllm login

For anything else, see Troubleshooting.

Remove it

There is nothing to uninstall. Exit Codex and run codex directly to use it without OpenLLM. Temporary files are deleted on exit.

Last updated on

On this page