Skip to content

OpenAI Codex CLI Integration

OpenAI Codex (or @openai/codex) is a powerful CLI utility that enables automated file editing, code generation, and project management directly from your terminal.

By routing Codex through KoboiLLM, you can leverage any supported model with real-time usage monitoring and local payment processing.


Step 1: Install OpenAI Codex CLI

Ensure Node.js and npm/yarn are installed on your machine, then install the Codex CLI globally:

Terminal window
npm install -g @openai/codex

Step 2: Configure Environment Variables

Codex reads standard OpenAI environment variables. Export the following parameters in your terminal session:

Linux / macOS (Bash/Zsh):

Terminal window
# Point base URL to KoboiLLM gateway
export OPENAI_BASE_URL="https://api.koboillm.com/v1"
# Set your secret KoboiLLM key
export OPENAI_API_KEY="sk-x...env:OPENAI_BASE_URL="https://api.koboillm.com/v1"
$env:OPENAI_API_KEY="sk-x...
## Step 3: Run Codex with KoboiLLM
Launch Codex CLI with your selected model:
```bash
# Using GPT-4o
codex --model openai/gpt-4o
# Using Claude 3.5 Sonnet
codex --model anthropic/claude-3-5-sonnet