Codex CLI
Connect OpenAI’s Codex CLI to ShuYou and call GPT and other OpenAI-compatible models from the terminal with one API key.
Prerequisites
- Install Node.js LTS (v20+). Verify with
node -v and npm -v.
- Create a ShuYou API key in the console.
ShuYou OpenAI-compatible base URL: https://api.shuyou.ai/v1
Step 1: Install Codex CLI
Edit ~/.codex/config.toml (Windows: %USERPROFILE%\.codex\config.toml):
Set your API key:
Add the same line to ~/.zshrc or ~/.bashrc for persistence. Or set a persistent user variable in System Environment Variables.
Step 3: Verify
FAQ
401 / 403: Check OPENAI_API_KEY and that the model slug exists on ShuYou.
Config not applied: Restart the terminal and validate TOML syntax in config.toml.
Switch models: Change the model field in config.toml and restart Codex.
Use Codex in a dedicated project folder. Avoid directories with secrets or system files.