Skip to main content

Codex setup

Codex is OpenAI’s coding assistant for the terminal. Connect it to TokenReply and use it with your TokenReply key. Official documentation

Before you start

Installation

npm install -g @openai/codex@latest
codex --version

Configuration

Codex reads its settings from ~/.codex/. You’ll create two files there:

Step 1: create the config folder

macOS / Linux

mkdir -p ~/.codex && cd ~/.codex

Windows (PowerShell)

mkdir $env:USERPROFILE\.codex
cd $env:USERPROFILE\.codex

Step 2: create config.toml

model_provider = "custom"
model = "codex-mini-latest"
approval_policy = "on-request"

[model_providers.custom]
name = "TokenReply"
base_url = "https://api.tokenreply.com/v1"
wire_api = "responses"
requires_openai_auth = true

Step 3: create auth.json

{
  "OPENAI_API_KEY": "sk-xxx"
}

Replace sk-xxx with your API key.

Check the model

Set model in config.toml to a model your key can call. You’ll find model IDs on the Models page.

Start Codex

cd your-project
codex

Troubleshooting

Connection failed

  • Check that base_url is https://api.tokenreply.com/v1
  • Check that the key works and you have usage allowance or wallet balance left
  • Check where the config files are and that they’re valid

Where the config files live

  • macOS / Linux: ~/.codex/
  • Windows: %USERPROFILE%\.codex\

Related guides