Codex CLI (Server)
Deploy the Codex CLI on a WSL2 or SSH server and connect to the LMU AI API: install Node 20 with volta, then write config.toml in one command.
For configuring the Codex CLI in a WSL2 or SSH remote server environment.
Configuration steps
Step 1 — Install the Node.js environment (with volta)
In the server terminal, run:
curl https://get.volta.sh | bashStep 2 — Install Node 20
Note
After volta installs successfully, you must open a new terminal window before running the following command:
volta install node@20Step 3 — Install the Codex CLI
volta install @openai/codexStep 4 — Create the config files
Run the following in the server terminal to write ~/.codex/config.toml in one go (remember to replace "your sk- key generated in the console" on the last line with your sk- key, keeping one space after Bearer):
mkdir -p ~/.codex
cat > ~/.codex/config.toml <<'EOF'
model = "gpt-5.4"
model_reasoning_effort = "xhigh"
disable_response_storage = true
sandbox_mode = "danger-full-access"
windows_wsl_setup_acknowledged = true
approval_policy = "never"
file_opener = "vscode"
model_provider = "codex"
web_search = "cached"
suppress_unstable_features_warning = true
[history]
persistence = "save-all"
[tui]
notifications = true
[shell_environment_policy]
inherit = "all"
ignore_default_excludes = false
[sandbox_workspace_write]
network_access = true
[features]
plan_tool = true
apply_patch_freeform = true
view_image_tool = true
unified_exec = false
streamable_shell = false
rmcp_client = true
elevated_windows_sandbox = true
[profiles.auto-max]
approval_policy = "never"
sandbox_mode = "workspace-write"
[profiles.review]
approval_policy = "on-request"
sandbox_mode = "workspace-write"
[notice]
hide_gpt5_1_migration_prompt = true
[model_providers.codex]
name = "codex"
base_url = "https://api.lmuai.ai"
wire_api = "responses"
[model_providers.codex.http_headers]
Authorization = "Bearer your sk- key generated in the console"
EOFThe config contents are identical to the Codex CLI (Mac/Linux) guide — you can also create it by hand with vim / nano. Newer Codex versions no longer need ~/.codex/auth.json; an old one left in place is harmless.
Step 5 — Launch the Codex CLI
codex --dangerously-bypass-approvals-and-sandboxOr:
codex --yoloEnabling the 1M context (optional)
gpt-5.4 supports a 1M-token long context, but it's off by default. Edit ~/.codex/config.toml, add two lines at the top level of the file (before any [section]), and re-enter Codex:
model_context_window = 1000000
model_auto_compact_token_limit = 900000For field meanings, how to verify, and caveats, see Enabling the 1M context in Codex.
Last updated:
Still have questions? Ask in the LMU AI Community (in Chinese) and sign in with your console account.
Get an LMU AI key and start using Claude, Codex and more
Free sign-up, flexible plans, one key across Claude Code, Codex CLI, Cursor, VS Code, OpenCode, Cherry Studio and other AI tools.
Sign up