Goal of this guide: install OpenAI Codex CLI on Windows and connect it to your own MYAI168 API, using gpt-5.6-sol.
Codex speaks the OpenAI format, so it connects to the MYAI168 "OpenAI-compatible endpoint" with gpt-5.6-sol.
Endpoint https://www.myai168.com/en/api/openai/v1
Model gpt-5.6-sol
First check: run node --version and npm --version in PowerShell. If they print version numbers, skip to "1. Install Codex"; if you get "command not recognized", install Node as follows:
winget install OpenJS.NodeJS.LTS, then reopen PowerShell.Note: if Node was originally bundled by another tool (such as Hermes), it disappears together with that tool when it is removed. Installing Node independently is more stable.
If the execution policy blocks scripts, allow them first:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
This page teaches the npm install; the official docs also offer other install methods — see https://developers.openai.com/codex/cli/ for the latest guidance.
Install (the package name must include the @openai/ prefix):
npm install -g @openai/codex
Open a new PowerShell and check:
codex --version
If you see Missing optional dependency @openai/codex-win32-x64:
$v = npm view @openai/codex version
npm install -g "@openai/codex@$v" "@openai/codex-win32-x64@npm:@openai/codex@$v-win32-x64"
cc-switch has good support for Codex. (For installation, see the "cc-switch Windows" page in the Developer Center.)
MYAI168; API Key = your key; API Request URL = https://www.myai168.com/en/api/openai/v1Set the environment variable (Codex reads it via env_key):
[Environment]::SetEnvironmentVariable("MYAI168_API_KEY", "your-key", "User")
No output means success; verify with:
[Environment]::GetEnvironmentVariable("MYAI168_API_KEY", "User")
Confirm cc-switch wrote it into config.toml:
Get-Content $env:USERPROFILE\.codex\config.toml
Create the config folder and open the config file with Notepad:
mkdir $env:USERPROFILE\.codex -Force
notepad $env:USERPROFILE\.codex\config.toml
Paste in (env_key takes the environment variable NAME, not the key itself):
model = "gpt-5.6-sol"
model_provider = "myai168"
[model_providers.myai168]
name = "MYAI168"
base_url = "https://www.myai168.com/en/api/openai/v1"
env_key = "MYAI168_API_KEY"
wire_api = "responses"
Save. Then set the environment variable (same SetEnvironmentVariable as Method A).
Open a new PowerShell (so the environment variable takes effect):
mkdir $env:USERPROFILE\cc-test -Force
cd $env:USERPROFILE\cc-test
codex
Verify: once inside codex, ask a question that requires actual computation:
What is 123456 times 789? Reply with the number only.
If it answers 97406784 and the status bar shows gpt-5.6-sol, the connection works.
(Do not verify with "who are you" — model self-identification is unreliable; the API call records in the MYAI168 dashboard are authoritative.)
npm prefix -g and add it to PATH. (On macOS: source ~/.zshrc / reopen the terminal.)[Environment]::GetEnvironmentVariable("MYAI168_API_KEY","User") has a value, and open a new window. (On macOS: check echo "[$MYAI168_API_KEY]" has a value; if needed add requires_openai_auth = false to the provider block.)Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSignedUpdate Codex (use install @latest, not npm update -g — it respects the semver range from the original install and may not move you to the newest release):
npm install -g @openai/codex@latest
Run the command below and open a new PowerShell; or update the cc-switch card and Enable it again:
[Environment]::SetEnvironmentVariable("MYAI168_API_KEY", "new-key", "User")
%USERPROFILE%\.codex\config.toml