Skip to content

Codex CLI

OpenAI's official terminal coding agent. Same trick as Claude Code: install the real thing, point it at the gateway.

Install

bash
npm install -g @openai/codex

Configure

Codex reads OPENAI_BASE_URL and OPENAI_API_KEY from your environment.

bash
export OPENAI_BASE_URL="https://luckyapi.chat/v1"
export OPENAI_API_KEY="sk-..."        # your luckyapi key
powershell
[Environment]::SetEnvironmentVariable("OPENAI_BASE_URL", "https://luckyapi.chat/v1", "User")
[Environment]::SetEnvironmentVariable("OPENAI_API_KEY",  "sk-...",                   "User")

The /v1 suffix matters for OpenAI-shape endpoints. Anthropic-shape endpoints don't need it. Both are supported on the same key.

Run it

codex

Pick a model when prompted — gpt-5 for the full thing, gpt-5-mini if you want to be frugal. See pricing.

Switching between Codex and Claude Code

Both can coexist on the same machine and the same key. Codex reads OPENAI_* env vars; Claude Code reads ANTHROPIC_*. Set both and use whichever fits the task.

Independent. Not affiliated with Anthropic or OpenAI.