Codex CLI setup
Codex CLI is OpenAI’s coding agent for the terminal; it calls models through the Responses API.
Before you start
- Create an account and top up, then create a key on the API Keys page of the dashboard.
- Find an available model ID with your key; see API reference: Find an available model.
- Replace the green-highlighted
<your key>in the examples with your own key, and model placeholders with actual model IDs.
Setup steps
Install from each product’s official download or release page. Choose the Windows package on Windows and the correct Apple Silicon or Intel package on macOS. Existing users can proceed directly to configuration. Labels may vary by version.
- Follow the official installation and gateway guide. With a supported npm environment, you can use
npm install -g @openai/codex. - Check
codex --version, then set theP6090TI_API_KEYenvironment variable in the current terminal. Codex reads the key from it, and the configuration file in the next step refers to it:
# Windows PowerShell
$env:P6090TI_API_KEY = "<your key>"
# macOS / Linux
export P6090TI_API_KEY="<your key>"
- Back up and edit
%USERPROFILE%\.codex\config.tomlon Windows or~/.codex/config.tomlon macOS / Linux. Merge the following configuration; update existing matching keys and tables rather than duplicating them or overwriting the file.
model_provider = "p6090ti"
model = "<Responses model>"
[model_providers.p6090ti]
name = "6090ti"
base_url = "https://api.6090ti.com/v1"
env_key = "P6090TI_API_KEY"
wire_api = "responses"
- Run
codexin your project, check/status, and send a short request.
Codex requires Responses. Setting only OPENAI_BASE_URL should not replace this provider configuration.
Troubleshooting
For 401, 404, 429 and other errors, see API reference: Troubleshooting. If that does not solve it, contact us as described in the support and issue-reporting guide. Never send full keys, passwords or verification codes.
QQ user group: 1109931264