WRAITHERIX
Home / Blog
Guide · tested 2026-12-02

Codex CLI with a custom API provider: config.toml setup and a first fix

WRAITHERIX team
A glowing command-line prompt on a circuit board with one thin trace leading to a gateway block and onward to the right

Short version: Codex CLI talks to any API that speaks the Responses format. Add a provider block to ~/.codex/config.toml, export your key as an environment variable, and run codex exec. Below are the exact files, commands and output from a clean run on December 2, 2026.

What you need

Install

npm install -g @openai/codex
codex --version

We got codex-cli 0.173.0. If npm fails with EACCES, reinstall Node.js from nodejs.org or with Homebrew (brew install node), which sets permissions correctly.

Get a key

Sign in at wraitherix.com, open "API keys" in the left menu, click "Create API key", name it and save. The key starts with sk- so copy it with the copy icon in the key's row and keep it safe.

The API keys page in the WRAITHERIX dashboard
The API keys page. The key is hidden in the screenshot.

Configure the provider

Codex reads ~/.codex/config.toml. Create the folder if it is missing (mkdir -p ~/.codex), then run nano ~/.codex/config.toml (it creates the file if needed), paste the text below, press Ctrl+O and Enter to save, then Ctrl+X to exit:

model_provider = "wraitherix"
model = "gpt-5.6-sol"

[model_providers.wraitherix]
name = "WRAITHERIX"
base_url = "https://api.wraitherix.com/v1"
wire_api = "responses"
env_key = "WRAITHERIX_API_KEY"
The config.toml file in a terminal
The file we used for every run below.

The fields:

Set the variable in the same terminal window:

export WRAITHERIX_API_KEY="sk-your-key"

It lasts until you close the window. To make it permanent on a Mac, add the same line to ~/.zshrc.

First request

codex exec --skip-git-repo-check 'What is 17*23? Reply with the number only.'

codex exec runs one task and exits. --skip-git-repo-check is needed outside a git repository: without it Codex prints Not inside a trusted directory and does nothing. The answer came back in 3 seconds. The lines Reading additional input from stdin... and tokens used are normal. The header printed by Codex shows provider: wraitherix and model: gpt-5.6-sol, which confirms the request went through the gateway.

Codex answering 391
The header confirms the provider and the model.

Let it fix a bug

In an empty folder we created two files with nano calc.py and nano test_calc.py. calc.py has a function that subtracts instead of adding, and the test checks it:

# calc.py
def add(a, b):
    return a - b
# test_calc.py
from calc import add

assert add(2, 3) == 5
print("ok")

The test fails with AssertionError. Then:

codex exec --skip-git-repo-check -s workspace-write 'add in calc.py is broken. Fix it and run test_calc.py.'

-s workspace-write lets the agent edit files in the working folder; the default sandbox is read-only. Codex read both files, changed a - b to a + b, ran the test and printed ok. It took 47 seconds. We checked afterwards: calc.py returns a + b and python3 test_calc.py passes.

Codex patching calc.py and running the test
The agent made the edit and ran the test itself.

The usage log in the dashboard shows five requests for this task, 3.5 cents in total. The plain arithmetic question cost 1.7 cents: Codex adds a long built-in instruction to the request: on gpt-5.6-sol the input was about 9,500 tokens, and more on the other models. The tokens used figure Codex prints at the end is counted differently, so it is lower.

Other models

Add -m <model>:

Model Result
gpt-5.5 answered 391 in 5 s
gpt-5.4-mini answered 391 in 4 s; Codex warned it has no metadata for this model
gpt-5.3-codex 429 Too Many Requests after 1 s

The Model metadata ... not found warning means Codex does not know that model's parameters. It is harmless: Codex falls back to defaults. A 429 means "too many requests". We got it after retries and did not dig into the cause. Retry later or switch models.

Troubleshooting

We triggered these on purpose.

Prefer not to edit files?

Every key in the dashboard has a "⋯" menu item that sends it to CC Switch, which writes the Codex config for you. See our CC Switch guide.

How we tested

December 2, 2026, macOS, Node v24.16.0, codex-cli 0.173.0. Everything ran in an isolated home folder with no other settings, on a test key. Costs come from the WRAITHERIX request log. The run log is saved.

One key for 400+ models

Pay as you go, below list price.

Get a keyCatalog