Codex Setup
To avoid touching your existing Codex / ChatGPT login, put the ShenwenAI test config in a separate folder and isolate it with CODEX_HOME.
This keeps your personal ~/.codex unchanged, and your original codex command will still work after testing.
Copy these model IDs into config files, API request bodies, or any OpenAI-compatible client that asks for a model name.
Prepare your API key first
1. Go to your account page
After logging in, create or copy an API key from your account page. It looks like sk-or-v1-xxxxxxxxxxxx. Treat it like a password.
Go to account page2. Create an API key and choose a channel
Select Create API Key, enter a recognizable name, then choose the channel that fits your use case:
- Stable · 0.22x (Pro pool)
- Prioritizes stability for OpenAI (Codex), OpenAI-compatible clients, and Claude Code. Recommended for long-running or important text workloads.
- Economy · 0.09x (Plus pool)
- Prioritizes price for OpenAI (Codex) and OpenAI-compatible clients. Recommended for everyday development, learning, testing, and cost-sensitive text workloads.
For images, create a separate OpenAI image key or Grok image key. Text and image purposes cannot be mixed in one key.
3. Confirm the Base URL
Codex uses the OpenAI-compatible endpoint, so this Base URL must include /v1.
Do not share your API key with others or commit it to GitHub, GitLab, or any public repository.
The commands below will switch based on your selected system.
Install and verify Codex CLI
When Ubuntu host is selected, the commands first use NVM to switch to Node.js 22 and confirm that node and npm come from the same environment. Run npm install only if Codex is not installed yet.
After npm finishes on an Ubuntu host, add npm's global executable directory to PATH and refresh the command cache. Otherwise npm can report success while the shell still cannot find codex.
If an Ubuntu host shows “Command 'codex' not found” and suggests installing a Snap package, do not run snap install codex yet. Select Ubuntu host, complete its PATH setup, and confirm that command -v codex resolves to the npm-installed executable.
node -v
npm -v
npm install -g @openai/codex@latest
hash -r
command -v codex
codex --versionCreate an isolated config folder
mkdir -p ~/.codex-shenwenOpen config.toml
Create or edit config.toml inside the isolated config folder.
nano ~/.codex-shenwen/config.tomlPaste config.toml
Paste the full content below into config.toml. In Windows Notepad, press Ctrl+S to save, then close the window.
model_provider = "OpenAI"
model = "gpt-5.6-sol"
model_reasoning_effort = "high"
disable_response_storage = true
[model_providers.OpenAI]
name = "OpenAI"
base_url = "https://api.shenwenai.com/v1"
wire_api = "responses"
requires_openai_auth = trueOpen auth.json
Create or edit auth.json inside the isolated config folder.
nano ~/.codex-shenwen/auth.jsonPaste auth.json
Replace the key with your own ShenwenAI API key. In Windows Notepad, press Ctrl+S to save, then close the window.
{ "OPENAI_API_KEY": "sk-or-v1-your-key" }Start Codex
CODEX_HOME="$HOME/.codex-shenwen" codexSwitch models inside Codex
After entering Codex, type /model to switch between the models currently supported by ShenwenAI.
/model
gpt-5.6-sol
gpt-5.6-terra
gpt-5.6-luna
gpt-5.5
gpt-5.4
gpt-5.4-miniOptional: create an alias
If typing CODEX_HOME every time is annoying, create the scodex alias. macOS writes it to ~/.zshrc, while an Ubuntu host uses ~/.bashrc. In Windows Notepad, paste the function at the end of the file, press Ctrl+S, then close the window.
echo 'alias scodex="CODEX_HOME=\"$HOME/.codex-shenwen\" codex"' >> ~/.zshrc
source ~/.zshrcAfter that, use scodex for testing. Your original codex command still uses your personal ChatGPT / Codex config.