For the complete documentation index, see llms.txt. This page is also available as Markdown.

OpenAI Codex

Codex is OpenAI’s coding agent that helps you write, review, and ship code faster. Use it side-by-side in your IDE or delegate larger tasks to the cloud.

You can view Help Guide for more details.

Install Codex

You can install Codex using one of the following methods.

Option 1: Install via Homebrew

brew install codex

Option 2: Install via npm

npm install -g @openai/codex

Configure Codex

Codex reads its settings from a local configuration file written in TOML format.

Step 1: Open the configuration file

vim ~/.codex/config.toml

Step 2: Define the default model and provider

# Default model used by Codex
model = "o3"

# Default model provider
model_provider = "openai-chat-completions"

Step 3: Configure the model provider

Set the API Key

Set your API key as an environment variable:

This key is generated when you create an AI Gateway instance.

Use Codex

After configuration, you can start using Codex immediately.

Start an interactive session

Send a one-off request

All requests will be forwarded through the AI Gateway, allowing centralized authentication, routing, and usage tracking.

Notes

  • Codex requires an OpenAI-compatible API. AI Gateway provides this interface.

  • API keys should always be stored as environment variables, not hard-coded in config files.

  • You may change the default model or provider at any time without reinstalling Codex.

Last updated