Skip to main content
Codex CLI is OpenAI’s local coding agent. The commands and config.toml fields below follow the official Codex repository and custom-provider reference. NexusAPI supplies only the Base URL, API key, and model ID.

1. Install Codex CLI

Choose one official installation method.

Windows PowerShell

macOS, Linux, or WSL

With Node.js already installed

Verify installation:

2. Create a compatible key

In NexusAPI console → Token Management → Add token, select a group containing the exact Codex-compatible model you need. Use a recognizable name and a suitable project limit. Check the capability matrix rather than assuming a Claude-type channel works with Responses.

3. Configure a custom provider

Open the user configuration file:
Replace YOUR_MODEL_ID with the exact model ID available to the key. Do not put the actual key in this file.
Do not write a NexusAPI key to auth.json~/.codex/auth.json is Codex’s OpenAI login cache. The configuration above reads the key from env_key; keep NexusAPI credentials out of auth.json, source code, and screenshots.

4. Set the environment variable

Windows PowerShell

Open a new terminal after running this command.

macOS, Linux, or WSL

This affects only the current shell. For long-term storage, use your system’s credential or shell-environment management; never add the key to a repository.

5. Verify safely

For the first task, use a read-only instruction such as: Explain the repository layout without changing files. Then check the console usage log.

Troubleshooting

  1. Use a newly opened terminal so NEXUSAPI_API_KEY is available.
  2. Confirm the key is enabled, funded, and assigned to the right group.
  3. Recopy the exact model ID from the Model Marketplace or /v1/models.
  4. Save the complete error and Request ID, then use the self-check guide.
For editor use, install the Codex extension published by OpenAI. It uses the same user-level Codex configuration; do not add legacy chatgpt.apiBase settings.