Skip to main content
1

Check Node version

nodes -v
  • Node.js >= 18
2

Install Codex CLI

npm i -g @openai/codex
3

Set environment variables

echo 'export OPENAI_BASE_URL="https://domain name/v1"' >> ~/.zshrc
echo 'export OPENAI_API_KEY="Your API key"' >> ~/.zshrc
source ~/.zshrc
echo 'export OPENAI_BASE_URL="https://domain name/v1"' >> ~/.bash_profile
echo 'export OPENAI_API_KEY="Your API key"' >> ~/.bash_profile
source ~/.bash_profile
4

Start Codex

enters the interactive interface and follows the prompts to define your model and session configuration.
codex
  • Option 1 (Full Access): Codex can directly execute commands or modify files in the /root directory without confirming each time. Highest efficiency.
  • Option 2 (Ask for Approval): Every time you change a file or execute a command, you will be asked for confirmation first, which is more secure and suitable for operations on production machines or key directories.
5

Get started

  • /init: Create AGENTS.md in the current directory and place Codex instructions and configuration templates for easy reuse.
  • /status: View the current session configuration (model, token consumption, etc.).
  • /approvals: Set which operations require manual confirmation and which can be automatically executed (corresponding to the “approval mode” above).
  • /model: Select model and inference strength (e.g. GPT-4/GPT-5, fast or deep mode).
Recommended configuration: gpt-5 + high; select Full Access (full authorization) for approval to minimize interruptions.
Codex additional configuration (recommended) exist~/.codex/config.tomlAdd in:
disable_response_storage = true
This disables response storage, further improving privacy and security.