Codex
OpenAI
OpenAI's coding agent for the terminal. A custom model provider in config.toml points it at Actualyze.
Codex connects to Actualyze as a custom model provider. You point it at the OpenAI-compatible endpoint and give it your Actualyze API key through an environment variable. Codex speaks the OpenAI Responses API, so the model you use must be served over that API.
Before you start
- An Actualyze API key with the inference scope and read-write permission. Workspace Admins, Members and FinOps Managers who belong to a team can create one: in the Actualyze app, select API Keys under ADMIN in the sidebar (every role that can hold keys sees this page, not only admins), then select Create API Key. Keep the default Read & Write permission. The key's budget is the one your Codex usage draws down.
- A model in your workspace that your key can call and that is served over the OpenAI Responses API. See Choose a model.
Tip
Right after you create a key, the Connect your app picker shows this setup with your key already filled in. You can reopen it later with App Setup Guide in the API Keys page header.
Install
If Codex isn't installed yet, use OpenAI's standalone installer. On macOS and Linux:
curl -fsSL https://chatgpt.com/codex/install.sh | shOn Windows, from PowerShell:
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"Codex also installs with npm install -g @openai/ or brew install --cask codex. The Codex repository lists the release binaries.
Connect to Actualyze
Option 1: config.toml
Add Actualyze as a model provider and make it the default:
model_provider = "actualyze"
[model_providers.actualyze]
name = "Actualyze"
base_url = "https://app.actualyze.ai/openai/v1"
env_key = "ACTUALYZE_API_KEY"Then set the key and start Codex:
export ACTUALYZE_API_KEY="<your-actualyze-api-key>"
codexenv_names the environment variable that holds your key. Codex reads the key from it and sends it as a bearer token. The namekey ACTUALYZE_is a convention; any name works if both places match.API_ KEY - If the file already has other settings, keep
model_(andprovider model, below) above the first[table]header. A key placed after a table header belongs to that table, so Codex won't read it as a top-level setting. - Put this in your user-level
~/. Codex ignores.codex/ config.toml model_andprovider model_in a project'sproviders .codex/.config.toml - To keep the key across sessions, add the
exportline to your shell profile (~/or.zshrc ~/)..bashrc
Inside Codex, run / to check that the provider is actualyze and see which model is active.
Option 2: command-line overrides
To try Actualyze without editing config.toml, pass the same settings with -c on each run:
export ACTUALYZE_API_KEY="<your-actualyze-api-key>"
codex \
-c 'model_providers.actualyze={ name = "Actualyze", base_url = "https://app.actualyze.ai/openai/v1", env_key = "ACTUALYZE_API_KEY" }' \
-c model_provider="actualyze"- Keep the whole
model_value on one line. A backslash inside single quotes is literal, so a wrapped value hands Codex a string it can't parse.providers.actualyze={ … } - The provider name after
model_must match theproviders. model_value. Both areprovider actualyzehere.
Choose a model
Codex uses its own built-in default model unless you set model. If your workspace doesn't serve that name, set one explicitly:
model = "<model-id>"
model_provider = "actualyze"
[model_providers.actualyze]
name = "Actualyze"
base_url = "https://app.actualyze.ai/openai/v1"
env_key = "ACTUALYZE_API_KEY"With command-line overrides, add -c model="<model-id>", or pass -m <model-id>.
- Use a catalog model ID or a Virtual Model slug, written exactly as Actualyze lists it, without adding a
provider/prefix of your own. - The model must be served over the OpenAI Responses API. Codex asks for encrypted reasoning on every request, which only a same-protocol Responses route can return, so any other model fails with a
400. - In the Actualyze app, the Connect app dialog on each model in the Model Catalog dims Codex for models that aren't served over the Responses API. Use it to check a model before you set it.
- Codex doesn't discover models from Actualyze: its
/picker keeps showing Codex's own built-in list. Name the model inmodel config.toml, with-c, or with-m.
Troubleshooting
402: a spend limit stopped the request before any model ran, so nothing was charged. The message says which limit: usually the key's budget, or the key's own monthly limit.401: the key was rejected. Check thatACTUALYZE_holds the right key; an unset variable fails in Codex before any request is sent. The key may also be revoked or expired, lack the inference scope, or belong to someone who is no longer on the key's team.API_ KEY 403: the request was refused. If the message says read-write permission is required, the key is read-only; create a read-write key. Otherwise your team can't use the model you asked for; check its access in the Model Catalog or pick another.402sayingBudget required: the key's budget was deleted, archived or retired, or you no longer have access to it. Create a new key bound to a budget you can use.- Codex says
Missing environment variable: `ACTUALYZE_: the variable named inAPI_ KEY`. env_is unset or empty in the shell that runs Codex, so no request was sent. Export it and start Codex again.key - Codex says
Model provider `actualyze` not found: themodel_value doesn't match the name underprovider [model_. They must be identical.providers.…] 400with the codeno_, saying the request needs a same-protocol Responses endpoint: the model isn't served over the Responses API. Pick one that is, or ask your administrator which models are.fidelity_ preserving_ route 404sayingModel "<model-id>" not found: themodelvalue doesn't match a catalog model or Virtual Model your workspace serves.- Codex warns
Model metadata for `<model-id>` not found. Defaulting to fallback metadata: Codex doesn't recognize the name (common for a Virtual Model slug) and assumes a 272,000-token context window. Requests still go through. If the model's context window is smaller, setmodel_near the top ofcontext_ window config.tomlto that size, so Codex compacts the conversation before it overflows.
Reference
| Setting | Value |
|---|---|
model_ | actualyze |
model_ | https:// |
model_ | ACTUALYZE_ |
ACTUALYZE_ | Your Actualyze API key |
model | Optional. A catalog model ID or Virtual Model slug served over the Responses API |
model_ | Optional. The model's context window in tokens, for names Codex doesn't recognize |
Requests you cancel mid-stream still draw down the usage they consumed. Actualyze labels this traffic as Codex in the Client column of the Observability Activity tab, which Workspace Admins, FinOps Managers and Auditors can see.
For everything config.toml accepts and the -c override syntax, see OpenAI's Codex configuration reference. OpenAI's guide to connecting Codex through a gateway covers the same provider setup from Codex's side.