User GuideAPI ReferenceAI Applications

Codex CLI

Codex CLI is the official terminal AI coding assistant (CLI Agent) from OpenAI. It autonomously inspects code repositories, runs terminal commands, and edits files cleanly with atomic patch operations.

✨ AI One-Click Setup

Copy the prompt below and send it to your AI assistant to automatically detect your environment and configure Codex CLI:

AI 配置提示词 (Prompt)
点击卡片任意位置复制
Please help me configure Codex CLI referencing OpenRely official docs (https://openrely.ai/en/docs/apps/codex-cli):
1. Obtain API Key:If not provided, remind me to create one at OpenRely Console (https://api.openrely.ai/keys)
2. Install Environment:Check if Codex CLI is installed. If not, run npm install -g @openai/codex
3. Config File:Create ~/.codex directory and config file ~/.codex/config.toml:
model_provider = "custom"
disable_response_storage = true
[model_providers.custom]
name = "custom"
base_url = "https://api.openrely.ai/v1"
wire_api = "responses"
Write {"OPENAI_API_KEY": "<MY_API_KEY>"} into ~/.codex/auth.json (permissions: 600).
Model selection: You can dynamically switch models with /model inside Codex sessions (refer to https://api.openrely.ai/pricing).
4. Verify:Run codex --version and prompt me to run codex to start coding

🔑 Prerequisites


🚀 Steps

Install CLI Globally

Install the official package globally via npm:

npm install -g @openai/codex

Configure Endpoint & Key

Create the configuration file at ~/.codex/config.toml:

model_provider = "custom"
disable_response_storage = true

[model_providers.custom]
name = "custom"
base_url = "https://api.openrely.ai/v1"
wire_api = "responses"

Then create ~/.codex/auth.json containing your key:

{
  "OPENAI_API_KEY": "sk-your-token"
}

Launch Codex

Run the following command to start Codex:

codex

❓ FAQ

For more questions, visit our FAQ & Support.

Was this page helpful?

Codex CLI | OpenRely Docs