Goal of this guide: install OpenAI Codex CLI on a Linux desktop (Ubuntu / Debian as the example) 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 whether node --version and npm --version print version numbers. If not, install (Ubuntu / Debian):
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs
Or use nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
source ~/.bashrc
nvm install --lts
echo $SHELL
/bash → use ~/.bashrc/zsh → use ~/.zshrcWherever this guide says "shell config file" below, substitute yours.
Officially preferred: the standalone installer (no Node.js needed — you can skip the Node install in "0.5"; official docs https://developers.openai.com/codex/cli/):
curl -fsSL https://chatgpt.com/codex/install.sh | sh
Alternative: npm (requires Node.js). Do not use sudo (it causes permission problems); if you hit an npm permission error, point the npm global directory to your own home directory before installing:
npm install -g @openai/codex
Check:
codex --version
cc-switch is a cross-platform GUI; the Linux desktop interface is the same as on other platforms. (Prerequisite: cc-switch is installed — for installation, see the "cc-switch Linux" 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; write it into your shell config file — use ~/.zshrc for zsh):
echo 'export MYAI168_API_KEY="your-key"' >> ~/.bashrc
source ~/.bashrc
Confirm cc-switch wrote it into config.toml:
cat ~/.codex/config.toml
If cc-switch did not write the file successfully (config.toml does not exist), write it manually with a heredoc (paste the whole block and press Enter):
mkdir -p ~/.codex
cat > ~/.codex/config.toml << 'EOF'
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"
EOF
Also confirm the key environment variable is set (the same export line as in Method A).
cd into a test folder before starting (not your home directory):
mkdir -p ~/cc-test
cd ~/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.)
source ~/.bashrc (or source ~/.zshrc) or reopen the terminal; or the npm bin directory is not on PATH — find it with npm prefix -g and add it to PATH. (On Windows: open a new PowerShell.)echo "[$MYAI168_API_KEY]" has a value; if needed add requires_openai_auth = false to the provider block. (On Windows: confirm [Environment]::GetEnvironmentVariable("MYAI168_API_KEY","User") has a value, and open a new window.)/model inside a conversation; or change the model line in config.toml. One-off temporary switch: codex -c model='"model-name"'Update Codex (standalone-installer installs: rerun the official install command; npm installs: use install @latest, not npm update -g):
curl -fsSL https://chatgpt.com/codex/install.sh | sh
# npm installs: npm install -g @openai/codex@latest
~/.codex/config.toml