
On Windows, the step that fails most is the key. setx saves the variable, but only the windows opened afterwards see it. This article shows the whole path, from PowerShell to the first answer.
1. Install Codex
The official README gives, in PowerShell:
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
If you already have Node.js, you can also use npm install -g @openai/codex.
2. Save the key with setx
setx INTERWEB_API_KEY "prod_..."
setx saves the variable in your Windows account. The window where you typed it does not get it: only the ones you open next.
3. Close and reopen
|
|
|
In PowerShell:
if ($env:INTERWEB_API_KEY) { "OK" } else { "missing" }
In Command Prompt:
if defined INTERWEB_API_KEY (echo OK) else (echo missing)
4. The config.toml file
The file goes in %USERPROFILE%\.codex\config.toml. In PowerShell:
New-Item -ItemType Directory -Force "$HOME\.codex"
notepad "$HOME\.codex\config.toml"
Paste the configuration from Codex CLI with All in One AI and save. If you use Save as, choose All files (*.*): otherwise Windows adds .txt to the name and Codex does not read the file.
For one window only
To test without saving anything, set the variable in the open terminal only. When you close the window, the variable is gone. In PowerShell:
$env:INTERWEB_API_KEY = "prod_..."
In Command Prompt:
set INTERWEB_API_KEY=prod_...
| Changed your key? Run setx again with the new key and open a new terminal. The old window keeps the old key, and a revoked key gives 401. |
|
Want to code with AI in Codex? Visit the Coding with AI page. See Coding with AI |
RECOMMENDED PRODUCT Web hosting with cPanel Domain and SSL included, daily backups and the panel you already know. from 5.940,00 Kz/mo (3-year plan, with coupon) See plans |











