ShenwenAI
ISOLATED_CODEX_HOME

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.

Supported model IDs

Copy these model IDs into config files, API request bodies, or any OpenAI-compatible client that asks for a model name. Each model can only be called with a key on its own channel.

GPTGPT Pro / GPT Economy / Smart / Unrestricted / Luna / Anti-Downgrade
DeepSeek国产 V4.1 channel
GrokGrok Heavy channel
ImageOpenAI Image / Grok Image key
API_KEY_REQUIRED

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 page

2. 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:

GPT Pro · 0.22x (Pro pool)
Prioritizes stability for OpenAI (Codex) and OpenAI-compatible clients. Recommended for long-running or important text workloads.
GPT 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.
国产 DeepSeek V4.1 Flash · 60% of official price
Serves deepseek-v4.1-flash only, with a 1M context window, thinking mode, tool calls, and image input. Works with OpenAI (Codex) and OpenAI-compatible clients.
DeepSeek · 85% / 65% of official price
Serves deepseek-v4-flash and deepseek-v4-pro. Works with OpenAI (Codex), OpenAI-compatible clients, and Claude Code.

Claude Code runs only on Claude or Grok channel keys; GPT Pro and Unrestricted keys are refused with a 403. 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.

https://api.shenwenai.com/v1

Do not share your API key with others or commit it to GitHub, GitLab, or any public repository.

Choose your system first

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.

macOS / Linux
bash
node -v
npm -v
npm install -g @openai/codex@latest

hash -r
command -v codex
codex --version

Create an isolated config folder

macOS / Linux
bash
mkdir -p ~/.codex-shenwen

Open config.toml

Create or edit config.toml inside the isolated config folder.

macOS / Linux
bash
nano ~/.codex-shenwen/config.toml

Paste config.toml

Paste the full content below into config.toml. In Windows Notepad, press Ctrl+S to save, then close the window.

toml
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 = true

Open auth.json

Create or edit auth.json inside the isolated config folder.

macOS / Linux
bash
nano ~/.codex-shenwen/auth.json

Paste auth.json

Replace the key with your own ShenwenAI API key. In Windows Notepad, press Ctrl+S to save, then close the window.

json
{ "OPENAI_API_KEY": "sk-or-v1-your-key" }

Start Codex

macOS / Linux
bash
CODEX_HOME="$HOME/.codex-shenwen" codex

Switch models inside Codex

After entering Codex, type /model to switch between the models currently supported by ShenwenAI.

You can only switch to a model on the key's own channel: GPT Pro and Smart serve the GPT models except Luna, GPT Economy and Unrestricted also exclude gpt-6-astra, Anti-Downgrade serves gpt-6-astra, gpt-6.1-sol, gpt-6-sol and gpt-5.6-sol only, Luna serves gpt-6-luna and gpt-5.6-luna only, and the DeepSeek and Grok channels serve their own model IDs. Anything else is refused with a 400.

text
/model

# GPT Pro / Smart
gpt-6-astra
gpt-6.1-sol
gpt-6-sol
gpt-5.6-sol
gpt-5.6-terra
gpt-5.5

# GPT Economy
gpt-6.1-sol
gpt-6-sol
gpt-5.6-sol
gpt-5.6-terra
gpt-5.5

# Unrestricted
gpt-6-sol
gpt-5.6-sol
gpt-5.6-terra
gpt-5.5

# Luna
gpt-6-luna
gpt-5.6-luna

# GPT Anti-Downgrade
gpt-6-astra
gpt-6.1-sol
gpt-6-sol
gpt-5.6-sol

# DeepSeek V4.1 Flash (CN)
deepseek-v4.1-flash

# Grok Heavy
grok-4.7
grok-4.6
grok-4.5

Optional: 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.

macOS / Linux
bash
echo 'alias scodex="CODEX_HOME=\"$HOME/.codex-shenwen\" codex"' >> ~/.zshrc
source ~/.zshrc

After that, use scodex for testing. Your original codex command still uses your personal ChatGPT / Codex config.