Codex CLI
Point OpenAI's Codex CLI at Linkex with a custom model provider in config.toml.
Codex CLI only speaks the OpenAI Responses API, and it can't override the built-in openai provider's base URL directly — so Linkex is added as its own custom provider in ~/.codex/config.toml.
Prerequisites: Codex CLI installed; a Linkex API key.
Configure
Edit ~/.codex/config.toml (user-level — project-local .codex/config.toml is not allowed to set provider config):
model_provider = "linkex"
model = "gpt-5.1-codex"
[model_providers.linkex]
name = "Linkex"
base_url = "https://linkex.ai/v1"
env_key = "LINKEX_API_KEY"
wire_api = "responses"Then export the key in the shell that launches Codex:
export LINKEX_API_KEY="sk-YOUR_LINKEX_KEY"wire_api = "responses" is required — Codex dropped support for the older Chat Completions wire format, and Linkex's /v1/responses endpoint speaks the Responses API natively, so no translation layer is needed.
Pick a model
Use an OpenAI-family model id from linkex.ai/pricing — Codex's tool-calling behavior is tuned for that family. Update the top-level model value in config.toml to switch.
First run
codex
# then ask anything; verify usage appears in Console → Usage LogsTroubleshooting
| Symptom | Fix |
|---|---|
| 401 Unauthorized | LINKEX_API_KEY isn't exported in the shell that launched codex, or the key is disabled |
Startup error about wire_api | Missing or wrong wire_api value — it must be "responses" |
| Codex still talks to the default OpenAI endpoint | model_provider = "linkex" missing from config.toml, or the setting was placed in a project-local .codex/config.toml (provider config is user-level only) |
| "model not found" | The model id isn't served — copy the exact id from the pricing page |
| Insufficient balance error | Top up: Buying Credits |