Skip to main content

OpenAI Codex

Overview​

OpenAI Codex is OpenAI's terminal coding agent, the same capability behind ChatGPT Codex. It runs coding tasks asynchronously from the terminal, VS Code, or GitHub Actions: automatically opening PRs, refactoring files, and writing tests. Through a custom provider in ~/.codex/config.toml, TokenPlus can serve as its OpenAI-compatible backend.

Installation​

  1. Make sure Node.js 20+ (recommended) and Git 2.23+ are installed
  2. Run npm install -g @openai/codex in the terminal
  3. Run codex --version to verify the install

Configure TokenPlus​

Edit ~/.codex/config.toml, set model_provider to custom, base_url to the TokenPlus address with /v1, env_key to the environment variable holding the key, and wire_api must be responses.

# ~/.codex/config.toml
model = "gpt-4o"
model_provider = "custom"

[model_providers.custom]
name = "TokenPlus"
base_url = "https://tokenplus.net/v1"
env_key = "OPENAI_API_KEY"
wire_api = "responses"
# Write the key (temporary)
export OPENAI_API_KEY="sk-your-TokenPlus-key"

# Permanent (example: PowerShell user-level)
[Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "sk-your-TokenPlus-key", "User")
tip

The new Codex uses the Responses API exclusively, so wire_api must be responses; base_url must include /v1. The Claude series does not support the /v1/responses route, so use Codex's GPT-class models.

Quick start (up and running in 5 minutes)​

  1. Install codex (npm i -g @openai/codex) and prepare a Git repo
  2. Write ~/.codex/config.toml with the TokenPlus /v1 address and provider
  3. Export OPENAI_API_KEY and enter your project directory
  4. Run codex and type "Reply only OK" to verify connectivity

FAQ​

  • Model not replying? Confirm the selected model supports tool calling, otherwise it returns text only and will not touch the repo
  • 401 / invalid Key? Check that OPENAI_API_KEY is the TokenPlus key with no spaces
  • URL has an extra /v1? It is already in base_url, so do not repeat it in the model call
Online Service