Skip to content
kenari.

Codex

Codex CLI talks to kenari through a custom provider in ~/.codex/config.toml. Recent Codex versions only use the Responses API format, so the provider must point at kenari’s /v1/responses endpoint. See Responses for the endpoint itself.

Create or edit ~/.codex/config.toml:

model = "step-3-7-flash:free"
model_provider = "kenari"
[model_providers.kenari]
name = "kenari"
base_url = "https://kenari.id/v1"
wire_api = "responses"
env_key = "KENARI_API_KEY"
requires_openai_auth = false
SettingValue
modelA model id from Models and pricing. step-3-7-flash:free runs with zero balance.
base_urlhttps://kenari.id/v1. Unlike Claude Code, Codex needs the /v1.
wire_apiresponses. Codex no longer accepts chat.
env_keyThe name of the environment variable that holds your key.

Then export your key in the shell that runs Codex:

Terminal window
export KENARI_API_KEY=kn-...

Create the key under API Keys in the dashboard. See Authentication and API keys.

If you would rather keep the key in ~/.codex/auth.json, set requires_openai_auth = true and remove the env_key line. Then store the kenari key in that file by running this command, which reads the key from the environment variable and writes it to auth.json:

Terminal window
printenv KENARI_API_KEY | codex login --with-api-key

The file should then hold the kenari key and nothing else:

{ "OPENAI_API_KEY": "kn-..." }

The field is named OPENAI_API_KEY because Codex uses that name for any API key. The value is your kenari key.

Start Codex and send a short prompt:

Terminal window
codex

A reply means the connection works.

SymptomCauseFix
401 with invalid key or missing authorizationKENARI_API_KEY is not set in this shell, or the key does not start with kn-.Export the key again, then restart Codex.
400 with model_not_foundThe model id is misspelled or not in the catalog.Copy the id from Models and pricing.
402 with insufficient_balanceThe model is paid and your balance is empty.Use a :free model, or top up. See How billing works.
405base_url has a doubled /v1 or is missing it.Set base_url to exactly https://kenari.id/v1.