Short answer
Codex CLI is OpenAI’s local command-line coding agent. It runs in your terminal, reads the selected workspace, edits files, runs commands, and follows your sandbox and approval settings while working on development tasks. It is useful when you want an agent to help with code changes, code review, test fixes, scripts, and multi-step engineering work inside a local repository. Codex CLI is different from a normal ChatGPT conversation. It does not only suggest code. It works with the current directory, project instructions, tool results, and local execution permissions.When this matters
- You are installing
@openai/codexfor the first time - You are comparing Codex CLI, Codex App, and Codex Web
- You want an agent to edit files in a local project
- You need to configure a custom API provider, Base URL, or model
- You want to understand sandbox, approval, and
AGENTS.md
Core concepts
Recommended workflow
- Start Codex CLI inside the project directory you want to change.
- Ask it to inspect relevant files or instructions before making broad edits.
- For complex work, ask for a plan before letting it change files.
- Pick sandbox and approval settings based on the risk of the task.
- Put durable project rules in
AGENTS.mdand one-time requirements in the current conversation.
model_provider, base_url, wire_api, and model fields in config.toml. Codex and other OpenAI-compatible tools usually use an OpenAI-compatible endpoint, which is https://www.bettertoken.ai/v1 in this documentation.
Common mistakes
- Treating Codex CLI as a chat-only assistant.
- Assuming Codex CLI, Codex App, and Codex Web run in the same environment.
- Changing only
modelwithout configuring the matching provider and Base URL. - Relaxing sandbox and approval settings without tests, review, or command boundaries.
- Mixing OpenAI-compatible and Anthropic-compatible Base URLs.
About BetterToken
When you use a custom OpenAI-compatible provider, BetterToken can act as the model API layer for Codex CLI. It handles the API Key, Base URL, model routing, balance, and usage records. BetterToken does not replace Codex CLI’s local sandbox, approvals,AGENTS.md, or command execution policy.
Related docs
- Codex BetterToken setup guide
- Codex CLI vs Codex App vs Codex Web
- How to configure Codex CLI config.toml
- OpenAI-compatible API vs Anthropic-compatible API