Overview
OpenAI Codex is an open-source command-line tool (CLI) that serves as a lightweight coding agent, capable of reading, modifying, and running code in the terminal. It’s built on GPT models and optimized for code generation.System Requirements
- OS: macOS, Linux (official support), Windows via WSL
- Node.js: Version 18+
- npm: Version 10.x.x or higher
Installation
Configuration
Step 1: Set API Key
Temporary (current session):~/.bashrc, ~/.zshrc, or ~/.bash_profile:
Step 2: Configure config.toml
Edit~/.codex/config.toml:
If the config file doesn’t exist, run
codex once to generate it, then edit the file.Basic Usage
Start interactive mode:Available Models
| Model | Best For |
|---|---|
gpt-4o | Complex coding tasks, architecture |
gpt-4o-mini | Quick fixes, simple tasks |
claude-sonnet-4-5 | Code review, documentation |
deepseek-r1 | Algorithm design, reasoning |
Interactive Commands
| Command | Description |
|---|---|
/help | Display help |
/exit or Ctrl+C | Exit |
/clear | Clear conversation |
/config | View configuration |
/model <name> | Switch model |
/tokens | View token usage |
Verify Configuration
Common Use Cases
Code review:Troubleshooting
Connection Error
Connection Error
- Verify
base_urlin config.toml is exactlyhttps://api.lemondata.cc/v1 - Check network connectivity
- Ensure no proxy interference
Authentication Failed
Authentication Failed
- Verify
OPENAI_API_KEYenvironment variable is set - Check that the key starts with
sk- - Ensure the key is active in LemonData dashboard
Model Not Found
Model Not Found
- Check model name matches exactly
- Verify model availability at lemondata.cc/en/models