Codex CLI
Codex CLI is OpenAI's official terminal coding assistant. Editing two config files routes it through Tokensmart and gives you gpt-5.5 / gpt-5.4 / gpt-5.4-mini and more on a single key.
π‘ One-click config: on the API Keys page, use the Config Guide β Codex CLI menu β you can copy the
config.tomlandauth.jsoncontents with your real key pre-filled.
Install
npm install -g @openai/codex
Configure (macOS / Linux)
~/.codex/config.toml:
model_provider = "OpenAI"
model = "gpt-5.4-mini"
[model_providers.OpenAI]
name = "OpenAI"
base_url = "https://api.tokensmart.ai/v1"
wire_api = "responses"
requires_openai_auth = true
~/.codex/auth.json:
{
"OPENAI_API_KEY": "pk_live_xxxxxxxxxxxxxxxx"
}
Configure (Windows)
Same content, but paths become:
%USERPROFILE%\.codex\config.toml%USERPROFILE%\.codex\auth.json
Create the .codex folder manually if it does not exist.
Verify
codex "list files in this folder"
Switch models
Change model = "gpt-5.4-mini" inside config.toml to any OpenAI model (e.g. gpt-5.5, gpt-5.4).
Tokensmart tips
- One key per tool: keep the Codex key separate from other projects. If
auth.jsonever leaks into a public repo, you revoke one key instead of bricking everything. - Guard against cost runaway: reasoning is now built into the gpt-5.x family, and high reasoning effort burns noticeably more tokens. Restrict Allowed Models to cheaper models like
gpt-5.4-mini/gpt-5.4, and cap the key with a daily limit (e.g. $10/day). - Automatic failover: Tokensmart has built-in redundancy β transient capacity issues are automatically retried on backups transparently.
- Transparent pricing: GPT models on Tokensmart are billed at 24% of official (2.4ζ) β Tokensmart passes the wholesale discount through directly, see Pricing.
Troubleshooting
- Unauthorized β the JSON key name must be
OPENAI_API_KEY, notapi_key - wire_api error β it must be
responses; that is the protocol Codex CLI speaks - Permission denied (Windows) β check that the
.codexfolder is not read-only