Codex CLI

Prerequisites

ItemValue
Commandcodex
Config file~/.codex/config.toml
Provider idjoytoken
Model nameauto
JoyToken Base URLJOY_TOKEN_OPENAI_BASE_URL from Environments
API key envJOY_TOKEN_API_KEY

Step 1: Install

Follow the Codex CLI installation instructions from the Codex repository, then confirm it is available:

$codex --version

Step 2: Configure Codex

Codex can point directly at JoyToken’s OpenAI-compatible endpoint. No local bridge service is required.

Replace jt_xxx with your JoyToken API key, then run:

Configure Codex CLI
$export JOY_TOKEN_API_KEY="jt_xxx"
$export JOY_TOKEN_OPENAI_BASE_URL="https://api-dev.joytokens.ai/openai/v1"
$mkdir -p ~/.codex
$cat > ~/.codex/config.toml <<EOF
$model_provider = "joytoken"
$model = "auto"
$
$[model_providers.joytoken]
$name = "JoyToken"
$base_url = "$JOY_TOKEN_OPENAI_BASE_URL"
$env_key = "JOY_TOKEN_API_KEY"
$EOF

For persistent use, add the API key to your shell profile:

$printf '\nexport JOY_TOKEN_API_KEY="%s"\n' "$JOY_TOKEN_API_KEY" >> ~/.zshrc

Step 3: Start Codex

Run Codex from your project directory:

$cd /path/to/your/project
$codex

Step 4: Verify

$codex exec \
> --skip-git-repo-check \
> --sandbox read-only \
> --ask-for-approval never \
> "Reply with exactly: pong"

A successful response includes pong.

JoyToken Check

PlaceExpected result
LogsRequest path is /openai/v1/chat/completions
API keyRequest is attributed to the key used by Codex CLI
UsageTokens and credits are recorded
ModelRequested model is auto

Common Errors

ErrorFix
401 UnauthorizedCheck that JOY_TOKEN_API_KEY exists and is complete
Codex still uses another providerCheck model_provider = "joytoken" in ~/.codex/config.toml
Model not foundUse model = "auto" or a JoyToken-supported model
No JoyToken logsCheck that base_url matches the selected JoyToken environment

Resources