OpenAI Codex — Best API Configuration Guide
OpenAI Codex CLI installation and configuration notes.
Requirements
- macOS 12+, Ubuntu 20.04+/Debian 10+, or Windows 11 via WSL2
- Node 22+
Install
bash
npm i -g @openai/codex
# or on macOS via Homebrew
brew install codexConfigure
Create ~/.codex/config.toml and set provider and model, for example:
toml
model_provider = "vapi"
model = "gpt-5.1"
[model_providers.vapi]
name = "VAPI"
base_url = "https://api.morphogen.top/v1"
env_key = "V_API_KEY"
wire_api = "responses"Set environment variable
export V_API_KEY="sk-xxxxxx"Usage
bash
codex "hello"