Use ZhiFlo in Codex
This is the manual path for people who want a separate long-term ZhiFlo setup without overwriting the default Codex configuration.
If you are connecting for the first time, the CC Switch quickstart is faster.
Gather the required values
Section titled “Gather the required values”- Install Codex 0.134.0 or later from the official Codex project. Run
codex --versionto check; update Codex before continuing if the version is older. - Create a Token dedicated to this device.
- Copy a complete model ID from your account.
On Windows, open PowerShell from Start. On macOS or Linux, open Terminal. The ~ below means your user home directory; on Windows, that directory is %USERPROFILE%.
1. Create a separate profile file
Section titled “1. Create a separate profile file”- Open the
.codexfolder in your home directory; create it if it does not exist. - Create
zhiflo.config.toml, giving the full path~/.codex/zhiflo.config.toml. - Add the following content and replace
<MODEL_FROM_ZHIFLO>with the complete model ID from your account.
model_provider = "zhiflo"model = "<MODEL_FROM_ZHIFLO>"
[model_providers.zhiflo]name = "ZhiFlo"base_url = "https://api.zhiflo.com/v1"env_key = "ZHIFLO_API_TOKEN"wire_api = "responses"Save the file. Do not put the Token in TOML, and do not copy this user-level provider configuration into a project repository.
2. Load the Token in the current terminal
Section titled “2. Load the Token in the current terminal”These commands keep the Token in the current terminal environment. Closing the window removes it.
macOS, Linux, or Bash
Section titled “macOS, Linux, or Bash”Run the commands, paste the Token, and press Enter. The input stays hidden.
read -s ZHIFLO_API_TOKENexport ZHIFLO_API_TOKENPowerShell
Section titled “PowerShell”Run the commands and paste the Token when prompted:
$secureToken = Read-Host "Paste your ZhiFlo Token" -AsSecureString$env:ZHIFLO_API_TOKEN = [System.Net.NetworkCredential]::new("", $secureToken).PasswordKeep the Token out of shared terminal logs, command history, and screenshots.
3. Start the ZhiFlo profile
Section titled “3. Start the ZhiFlo profile”In the same terminal where you set the environment variable, run:
codex --profile zhifloThen send:
Do not modify any files. Reply with OK only.An OK reply means the manual path is complete: Codex read the profile file, loaded the Token, recognized the model ID, and sent a real request through ZhiFlo.
If Codex does not reply
Section titled “If Codex does not reply”- Profile or configuration not found: check the exact filename and the active
CODEX_HOME. WithoutCODEX_HOME, the default is~/.codex. If the file is still not recognized, update Codex; do not switch to the legacy[profiles.zhiflo]syntax. - Missing
ZHIFLO_API_TOKEN: load the Token again and launch Codex from that same terminal window. 404response: setbase_urltohttps://api.zhiflo.com/v1andwire_apitoresponses.- Model unavailable: copy the complete current ID again, update
model, and reopen Codex.