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 model you need. Use a recognizable name and a suitable project limit. Then check /v1/models and the capability matrix to confirm that supported_endpoint_types includes openai-response.

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.
Keep the NexusAPI key in an environment variableThe configuration above reads the key from NEXUSAPI_API_KEY through env_key. auth.json can contain Codex credential state; there is no need to put a NexusAPI key in it. Keep the key out of source code and screenshots as well.

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:
Then check the console usage log.

VS Code / Cursor

Install the Codex extension published by OpenAI from the extension marketplace. It uses the same user-level Codex configuration; do not add the legacy chatgpt.apiBase or chatgpt.config settings to VS Code.

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.

Official sources