Skip to main content
Codex CLI can use custom model providers through the user-level config.toml. For HiLinkup, use the OpenAI-compatible base URL and the Responses wire API.
Codex configuration uses ~/.codex/config.toml for user-level settings. A named profile loads ~/.codex/config.toml first, then overlays ~/.codex/<profile>.config.toml. Provider settings should be kept in user-level config or a profile, not in project .codex/config.toml.
Examples use the HiLinkup platform model aliyun/kimi-k3, a Chinese model example. Confirm available code models with /v1/models and the console.

Codex uses Responses only

For current Codex CLI custom providers, responses is the only supported wire_api value and is also the default when omitted.
Do not configure wire_api = "chat". It is not a supported current Codex protocol and does not make a Chat-Completions-only model usable in Codex. Verify that the selected model and HiLinkup channel support POST /v1/responses.

Verify the API first

Option 1: edit user config

Recommended for long-term use.
Paste:
Save with Ctrl + O, press Enter, then exit with Ctrl + X.Store the key:
Add:
Reload:
Run:

Option 2: profile config

Paste:
Run:

Option 3: one-off command

Verify

Common issues

Check that model_provider = "hilinkup" is in the active user-level config. When using --profile hilinkup, the file must be ~/.codex/hilinkup.config.toml, or %USERPROFILE%\.codex\hilinkup.config.toml on Windows.
Confirm env_key = "HILINKUP_API_KEY" and verify that the same terminal can read it. Use echo $HILINKUP_API_KEY on macOS/Linux or echo $env:HILINKUP_API_KEY in PowerShell.
Codex custom providers use Responses. Verify https://api.hilinkup.com/v1/responses with the Responses example. If a model only supports Chat Completions, select a model that supports Responses; do not set wire_api to "chat".
Codex project-level .codex/config.toml cannot override model_provider, model_providers, and provider authentication settings. Put them in user-level ~/.codex/config.toml or ~/.codex/hilinkup.config.toml.
Do not define [model_providers.openai]. openai is a reserved built-in provider ID. Use a custom ID such as hilinkup.
Last modified on August 12, 2026