Codex CLI

To connect Codex CLI to a third-party API you need an OpenAI-compatible base URL, an API Key and a model. You can manage providers through CC Switch or edit the config file directly.

Install

npm install -g @openai/codex@latest
codex --version
The Codex CLI version

Recommended: connect with CC Switch

  1. Open CC Switch, switch to the Codex page, then click the + in the top right.
Adding a Codex provider in CC Switch
  1. Choose Custom Config.
The Codex provider form
  1. Paste the API Key you just created and set the API request URL to https://api.himodels.ai/v1.
Choosing a model and saving the Codex provider
  1. Click the fetch button next to the default model and select the model you want to use. Keep the upstream format as Responses (native), then click Add.
Enabling the HiModels provider in CC Switch
  1. When the provider is added, go back to the CC Switch home screen and click In Use on the HiModels entry.
Verifying the Codex CLI connection

Verify that the connection works

codex
Codex CLI replying normally

Once you get a normal reply, open HiModels → Model Management and check the request time, model and group to confirm the call went through HiModels. For 401, 403 or 429 errors, see the FAQ.