Codex CLI

OpenAI Codex CLI

OpenAI Codex CLI uses the Responses API (/v1/responses). On Nexotao this endpoint serves the GPT-5.6 family (gpt-5.6-terra, gpt-5.6-sol, gpt-5.6-luna). Other models keep using /v1/messages or /v1/chat/completions.

Just created an API key in the dashboard? The “Key created” dialog already shows Codex setup commands with your key filled in.

1. Install Codex CLI

Codex CLI needs Node.js LTS. If npm is not recognized, install Node.js first and open a new terminal.

npm install -g @openai/codex

2. Save the API key and config

Replace sk-nexo-... with your own API key. These commands store the key as an environment variable, back up an existing config.toml to config.toml.bak, and write the Nexotao config.

Open PowerShell (not Command Prompt) and paste:

setx NEXOTAO_API_KEY "sk-nexo-..." | Out-Null
$env:NEXOTAO_API_KEY = "sk-nexo-..."
 
$dir = Join-Path $env:USERPROFILE ".codex"
New-Item -ItemType Directory -Force -Path $dir | Out-Null
$file = Join-Path $dir "config.toml"
if (Test-Path $file) { Copy-Item $file "$file.bak" -Force }
$body = @'
model = "gpt-5.6-terra"
model_provider = "nexotao"
model_reasoning_effort = "none"
 
[model_providers.nexotao]
name = "Nexotao"
base_url = "https://api.nexotao.com/v1"
env_key = "NEXOTAO_API_KEY"
wire_api = "responses"
'@
[System.IO.File]::WriteAllText($file, $body)
Write-Host "Nexotao config saved to $file"
⚠️

Still on the trial balance? Change gpt-5.6-terra to gpt-5.6-luna in the commands above. The trial balance only works with specific models; others are refused with billing.trial_model_restricted until you top up.

3. Run it

Open a new terminal in your project folder and run:

codex

Use gpt-5.6-terra for stronger coding quality or gpt-5.6-luna for fast, lightweight work — change the model line in config.toml. Do not paste the API key directly into the config; env_key makes Codex read it from the environment.

Troubleshooting

  • npm or codex is not recognized — install Node.js LTS, then close and reopen the terminal.
  • Codex asks you to sign in to OpenAI — make sure model_provider = "nexotao" is in config.toml and the terminal was opened after NEXOTAO_API_KEY was saved.
  • Error 401 — the API key is wrong or revoked; rerun step 2 with a new key.
  • Error 403 billing.trial_model_restricted — switch the model to gpt-5.6-luna or top up.