Skip to content
← Back to guides

Codex CLI setup

Codex CLI is OpenAI’s coding agent for the terminal; it calls models through the Responses API.

Before you start

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.

  1. Follow the official installation and gateway guide. With a supported npm environment, you can use npm install -g @openai/codex.
  2. Check codex --version, then set the P6090TI_API_KEY environment 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>"
  1. Back up and edit %USERPROFILE%\.codex\config.toml on Windows or ~/.codex/config.toml on 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"
  1. Run codex in 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