Codex CLI
Prerequisites
- Node.js 22+
- Codex CLI installed:
npm install -g @openai/codex - A Chuizi.AI account with an API key (starts with
ck-)
Configuration
Set environment variables to configure Codex CLI to use Chuizi.AI as its backend:
terminal
bash
export OPENAI_BASE_URL=https://api.chuizi.ai/v1 export OPENAI_API_KEY=ck-your-key-here
To make this permanent, add the variables to your shell configuration file (~/.zshrc or ~/.bashrc):
terminal
bash
echo 'export OPENAI_BASE_URL=https://api.chuizi.ai/v1' >> ~/.zshrc echo 'export OPENAI_API_KEY=ck-your-key-here' >> ~/.zshrc source ~/.zshrc
Usage
Once configured, use Codex CLI as normal:
terminal
bash
# Analyze the current codebase codex "explain this codebase" # Generate code codex "add error handling to the main function" # Specify a model codex --model openai/gpt-4.1 "refactor this file"
Next Steps
- Choose a Model — compare models for code generation
- Responses API — API reference for Codex models
- Cost Optimization — reduce costs with model tiering