opendunes
Coding agents
Copy page ▾

Codex CLI

Set Codex CLI up on OpenDunes once, with a profile for each kind of work.

Codex sends every request to POST /v1/responses, in the Responses shape: it speaks no other. Coding agents shows its provider block; this recipe adds the key it reads, a second profile, and a run from a script.

  1. Install Codex CLI.
  2. Add OpenDunes as a provider.
  3. Add a profile for harder work.
  4. Check the connection.
  5. Run it from a script.

1. Install Codex CLI

WithInstall line
npmnpm install -g @openai/codex
Homebrewbrew install --cask codex

Run codex --version to see it answer.

2. Add OpenDunes as a provider

Create an API keyAPI keyThe key you create and send with every request that calls a model.More on API keys → for Codex alone, and cap it on API Keys: an agent sends many requests for one task, and the cap stops this key alone (API keys shows how). Put it in your shell profile, ~/.zshrc or ~/.bashrc:

Shell
export OPENDUNES_API_KEY="…"

Then write the provider into ~/.codex/config.toml:

TOML
model = "anthropic/claude-sonnet-4.5"
model_provider = "opendunes"

[model_providers.opendunes]
name = "OpenDunes"
base_url = "https://opendunes.com/v1"
env_key = "OPENDUNES_API_KEY"
wire_api = "responses"
supports_websockets = false
request_max_retries = 4
KeyHolds
modelthe model IDModel IDThe name a request calls a model by, lab/model, copied from Models.More on Models → Codex starts on
model_providerthe provider it sends to: the name of the block below it
base_urlthe address, with /v1
env_keythe variable Codex reads the key from: no codex login is needed
wire_apiresponses, the one shape Codex speaks
supports_websocketsfalse: Codex sends each request over HTTPS
request_max_retrieshow often Codex tries a request again after a failure
Watch out

The provider goes in ~/.codex/config.toml, in your home folder. Codex ignores model_provider and model_providers in a project's .codex/config.toml.

3. Add a profile for harder work

A profile is a file of its own, ~/.codex/‹name›.config.toml, whose keys win over config.toml when you start Codex with it. This one keeps the OpenDunes provider and changes the model and how long it thinks. Save it as ~/.codex/deep.config.toml:

TOML
model = "openai/gpt-5.5"
model_reasoning_effort = "high"

Start Codex with it for a hard change, and without it for the day's work:

Shell
codex --profile deep

Each model is charged at its own rate, shown on its page in Models. Thinking longer writes more tokens, and each one is charged.

4. Check the connection

Start codex in your project and run /status: it shows the provider and the model of the session. /model switches the model for the session.

The request is on Activity, in the app, with its charge in DADAThe Algerian dinar, the one currency the docs show.More on Balance and charges →.

5. Run it from a script

codex exec runs one task without the interface, prints the result and exits: a script, a git hook or a CI job can call it.

Shell
codex exec "List the functions in src/ that have no test."

It reads the same config.toml, so it runs on OpenDunes with the same key. In CI, set OPENDUNES_API_KEY from the CI's secrets, and give that job a key and a cap of its own.

Errors

StatusMeansDo
401the key is missing, wrong, paused, revoked or expiredcheck OPENDUNES_API_KEY is set in the terminal Codex starts from
402the balanceBalanceWhat you can spend, in DA.More on Balance and charges → is at zero or below, cannot pay the request's hold, or the key's cap is spentmake a depositDepositMoney entering your balance, by CIB or Edahabia card.More on Balance and charges →, or raise the cap
404the model ID is not on salecopy the ID from Models

Every other status: Errors and retries.

Next: Codex Desktop · Automatic code review

Last modified on