Configure Codex CLI to use OpenDunes as its model provider, billed in DA.
Codex CLI is OpenAI's terminal-based coding agent. It accepts a custom base URL, so you can point it at OpenDunes and have all usage billed in Algerian Dinars while accessing any model in the catalog.
Codex CLI reads two variables — the API base URL and the key:
Because Codex CLI uses the OpenAI SDK internally, OPENAI_BASE_URL overrides the default api.openai.com endpoint. Set OPENAI_API_KEY to your OpenDunes key (not an OpenAI key).
Add both lines to your shell profile so they apply automatically:
Reload with source ~/.zshrc (or open a new terminal).
Pass the model flag when you invoke Codex:
Use the provider/model slug format from the OpenDunes catalog. Models with the tools capability flag work best with Codex's agentic loop (file reads, writes, shell commands).
You should see the model generate and optionally run a short script. Check Dashboard → Analytics to confirm the request was routed through OpenDunes.
Each Codex session can generate many sequential requests as the agent reads files and iterates on solutions. To avoid unexpected spend:
codex-cli key in Dashboard → Keys.OPENAI_API_KEY in your shell.When the budget is hit, Codex will receive a 402 insufficient_credits error and stop. Raise the cap or top up your balance to continue.
| Symptom | Likely cause | Fix |
|---|---|---|
401 invalid_api_key | Env var not exported in current shell | Re-run export OPENAI_API_KEY=... |
404 model_not_found | Wrong slug format | Use provider/model (e.g., openai/gpt-5.4) |
Codex ignores OPENAI_BASE_URL | Older Codex version | Update to the latest release |
402 insufficient_credits | Budget cap reached | Increase key budget or top up DA |