Use Token Plan with Codex
Codex is a coding agent from OpenAI.
This topic applies to earlier versions of Codex (such as 0.80.0) that support the Chat/Completions API. Newer versions of Codex use the Responses API, which Token Plan currently supports only for the qwen3.6-plus model.
Verify installation:
Skip the update prompt if it appears.
Cause: Newer versions of Codex use the Responses API and do not support the
Causes:
Cause: The
Applicability
This topic applies to earlier versions of Codex (such as 0.80.0) that support the Chat/Completions API. Newer versions of Codex use the Responses API, which Token Plan currently supports only for the qwen3.6-plus model.
Install Codex
- Install or update Node.js (v18.0 or later).
- Install Codex 0.80.0 or earlier (required for Chat and Completions APIs support):
The latest version of Codex no longer supports the Chat/Completions API. To use all models in Token Plan, run the following command to install an earlier version of Codex.
Set up Token Plan
- Modify the config file
~/.codex/config.toml (for model, choose a supported model):
Text models, such as qwen3.6-plus and glm-5, can be used directly. Image generation models use a separate API and must be integrated through extension mechanisms. See Integrate multimodal generation models.
-
Set the environment variable
Set
OPENAI_API_KEYto your Token Plan API key. ReplaceYOUR_API_KEYwith your actual key.
- macOS/Linux
- Windows
Use Codex
FAQ
Error: 'wire_api = chat' is no longer supported
Cause: Newer versions of Codex use the Responses API and do not support the wire_api = "chat" configuration.
Solution: Change the wire_api parameter to responses and ensure that the base_url is configured correctly:
Currently, only the qwen3.6-plus model in Token Plan supports the Responses API. To use other models, you must install an earlier version of Codex.
Error: unexpected status 401 Unauthorized
Causes:
- This error can occur if the API Key is from a different plan, such as a Coding Plan or a pay-as-you-go plan.
- Your Token Plan subscription has expired.
- The API Key is incomplete, contains spaces, or has a typo.
- Ensure you use the API Key for Token Plan. The API Keys for Token Plan, Coding Plan, and the pay-as-you-go plan are not interchangeable.
- Go to the Token Plan page to check if your subscription has expired.
- Copy the API Key again and make sure it is complete and contains no spaces.
- If the issue persists, reset your API Key and configure Codex with the new key.
Error: unexpected status 404 Not Found
Cause: The base_url value in your configuration file is incorrect.
Solution: Ensure that your base_url and wire_api are configured correctly: