Skip to main content

Codex with OpenCheese

/ API docs

← API quickstartView as Markdown

Codex speaks the OpenAI Responses API, which OpenCheese serves at https://api.opencheese.dev/v1. Codex 0.120 or newer is required: older builds use a chat wire protocol that OpenAI has removed, and their configuration will not load. Codex 0.161 or newer also lists your OpenCheese models in /model.

The Codex CLI, the Codex desktop app and the Codex IDE extension (VS Code, Cursor and other VS Code forks) read the same ~/.codex/config.toml, so one setup serves all three.

The fastest way: the generated file

Sign in, open Configuration, choose the Codex tab, pick an API key and confirm your password, then merge the generated file into your user configuration:

System File
macOS and Linux ~/.codex/config.toml
Windows %USERPROFILE%\.codex\config.toml
Codex inside WSL ~/.codex/config.toml in your WSL home directory

Manual setup

toml
model = "MODEL_ID"
model_provider = "opencheese"
model_reasoning_summary = "auto"

[model_providers.opencheese]
name = "OpenCheese"
base_url = "https://api.opencheese.dev/v1"
model_catalog_url = "https://api.opencheese.dev/v1/models"
wire_api = "responses"
env_key = "OPENCHEESE_API_KEY"
request_max_retries = 4
stream_max_retries = 5
stream_idle_timeout_ms = 300000

Then export the key in the shell that starts Codex, in single quotes (the key contains $ characters that double quotes would expand):

bash
export OPENCHEESE_API_KEY='YOUR_OPENCHEESE_API_KEY'
  • base_url must end in /v1: Codex appends /responses itself.
  • model_catalog_url is the list of your OpenCheese models that /model shows.
  • wire_api must be "responses"; current Codex refuses "chat".
  • Every root key (model, model_provider, ...) must come before the first [table] header, or the file will not parse.
  • The generated file stores the key as experimental_bearer_token. env_key keeps it out of the file instead. Use one or the other, never both: Codex rejects the combination.
  • Keep this in your user configuration. Codex ignores model_provider in a project-local .codex/config.toml and prints a startup warning.

Models and reasoning effort

/model inside Codex lists the OpenCheese models your key can use. To start Codex with another model for one session:

bash
codex -m MODEL_ID

Each model starts at its default reasoning level: the GPT-6 models at Codex's own (Low for GPT 6.2 Sol, Medium for GPT 6 Luna), the others at Medium or the nearest level they offer. Change it in /model, or step it down and up with Alt+, and Alt+.. On the GPT-6 models Codex itself sends Ultra as Xhigh. model_reasoning_effort in config.toml sets one level for every model instead; a level the model does not offer is refused with a message naming the levels it does. Codex reads config.toml only at startup, so restart it after every edit.

Codex's Fast mode (/fast) switches to the model's Fast version where one exists: replies come sooner and cost more. Where a model has no Fast version, the normal one answers.

Usage and costs

Every request appears under Transactions in the dashboard, grouped as one session per conversation, with its token usage and cost.

Troubleshooting

  • The configuration does not load: update Codex to 0.120 or newer, and check that no root key appears after a [table] header.
  • "Invalid or disabled OpenCheese API key": check the key on the API keys page, and that OPENCHEESE_API_KEY is set in the shell that starts Codex.
  • The website answers instead of the API: base_url must use api.opencheese.dev.
  • /model is empty or shows only OpenAI models: update Codex to 0.161 or newer, and check that model_catalog_url is set under [model_providers.opencheese].
The cheese has holes. Your infrastructure should not.