halfoff.devDocs
Get a key
Integrations

Codex CLI

Run Codex CLI on GPT models at half the official price: add Half Off Dev as a model provider in config.toml, set the key, and pick a model.

Codex CLI lets you register extra model providers in ~/.codex/config.toml. Add Half Off Dev as one and Codex sends its OpenAI Responses API calls here, where GPT models cost half the official rate. Everything else in your Codex setup stays as it is. Create an API key first.

Register the provider#

Add this to ~/.codex/config.toml:

~/.codex/config.toml
model = "gpt-6.1-sol"
model_provider = "halfoff"

[model_providers.halfoff]
name = "Half Off Dev"
base_url = "https://halfoff.dev/v1"
env_key = "HALFOFF_API_KEY"
wire_api = "responses"

The key itself doesn't go in the file. Codex reads it from the environment variable that env_key names:

Shell
export HALFOFF_API_KEY="ho-..."
codex

Old configs

Recent Codex releases reject wire_api = "chat". If your config came from an older guide, set it to "responses".

Or import it from the dashboard#

On API keys, choose Use in tools → Codex CLI for this config with your key filled in. Import with CC Switch adds Half Off Dev as a provider in the CC Switch desktop app, with models preset (CC Switch has to be installed). A new key is already in the dialog; for an existing one, paste the full key, because Half Off Dev stores only a hash.

Models#

The Responses API here serves GPT models, so use a gpt-* id. model in config.toml is the default; codex -m <model> overrides it for one session. All ids are on the model list.

Prompt caching#

Each Codex session sends a prompt_cache_key. Half Off Dev uses it to keep all turns of the session on the channel that holds the cache, so repeated context is billed at the cached-input rate. See Prompt caching.

Fixing errors#

What you seeWhat to do
401 Missing API keyNo key is reaching Half Off Dev. Export HALFOFF_API_KEY in the shell that runs codex, and make sure env_key holds that exact name.
401 Invalid or revoked API keyThe key was mistyped, cut short or revoked. Paste it again or make a new one.
404 not served in responses formatOnly GPT models are served over the Responses API. Set model to a gpt-* id.
404 Unknown endpoint /responsesbase_url lacks /v1. Set it to https://halfoff.dev/v1.
Codex refuses wire_api = "chat"Use wire_api = "responses".
402The balance is empty or the key has hit its spend cap. See Billing.

Any other status is explained in Errors.