Skip to main content
Codex CLI is OpenAI’s official command-line AI coding tool that lets you complete code generation, execution, and debugging tasks directly from your terminal using natural language.

Installation & Setup

1

Check Node.js Version

node -v
Requires Node.js 18+.
2

Install Codex CLI

npm install -g @openai/codex
3

Set Environment Variables

echo 'export OPENAI_BASE_URL="https://api.ephone.ai/v1"' >> ~/.zshrc
echo 'export OPENAI_API_KEY="sk-your-api-key"' >> ~/.zshrc
source ~/.zshrc
echo 'export OPENAI_BASE_URL="https://api.ephone.ai/v1"' >> ~/.bash_profile
echo 'export OPENAI_API_KEY="sk-your-api-key"' >> ~/.bash_profile
source ~/.bash_profile
[Environment]::SetEnvironmentVariable("OPENAI_BASE_URL", "https://api.ephone.ai/v1", "User")
[Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "sk-your-api-key", "User")
4

Start Codex

codex
On first launch, choose an approval mode:
  • Full Auto: Codex executes commands and modifies files without confirmation — highest efficiency
  • Ask for Approval: Prompts for confirmation before each action — safer for important directories or production environments

Common Commands

CommandDescription
codexStart interactive mode
codex "task description"Run a one-off task directly
/initCreate an AGENTS.md config template in the current directory
/statusView current model and token usage
/modelSwitch the model
/approvalsAdjust the operation approval policy
Add the following to ~/.codex/config.toml:
model = "gpt-4o"
disable_response_storage = true
Codex CLI’s autonomous mode calls the model frequently and executes system commands — token usage can be significant. We recommend using a Tier 2 account to avoid hitting rate limits.