Skip to main content

๐Ÿค– CodeX Setup

CodeX is OpenAI's GPT-based AI coding assistant CLI tool. By routing through this platform, you can access CodeX with a unified API key. Official docs

๐Ÿ“‹ Prerequisites

โšก Installation

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

โš™๏ธ Configuration

CodeX stores configuration in ~/.codex/. You need to create two files:

Step 1: Create Config Directory

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.

โš ๏ธ Important

Ensure your token has access to CodeX / GPT models. Different models may require different token group permissions.

๐Ÿš€ Start Using

cd your-project
codex

โ“ Troubleshooting

Connection Failed

  • Verify base_url is set to https://api.tokenreply.com/v1
  • Verify the API key is valid and the account has in-plan usage available; once in-plan usage runs out, paid models fall through to the wallet balance, so make sure it is sufficient
  • Check config file paths and format

Config File Locations

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

๐Ÿ”— Related Links