OpenAI Codex CLI is the agentic coding assistant that runs in your terminal — it plans features, writes code across your entire repo, runs shell commands, and ships.
Unlike GitHub Copilot (which suggests inline), Codex CLI operates autonomously. You describe an outcome. It reads your codebase, plans the implementation, writes the files, runs the tests, and reports back. The whole loop, in terminal.
Here's everything you need to know about Codex CLI in 2026 — install, configure, extend, and integrate.
What Is OpenAI Codex CLI?
Codex CLI is OpenAI's agentic coding tool, launched in April 2025 and continuously updated through 2026. It differs from earlier "Codex" offerings (the API model) in one key way: it takes actions, not just suggestions.
What Codex CLI does:
- Reads your entire repo as context (not just the open file)
- Plans multi-step implementations before writing a line
- Executes shell commands (
npm test,git commit,make build) - Writes, edits, and refactors files across directories
- Loops until tests pass or a blocking issue surfaces
What it doesn't do natively:
- Generate images or video
- Search the web
- Store or share files in the cloud
- Call external APIs without custom integration
These gaps are intentional — and pluggable. More on that below.

How to Install Codex CLI
Requirements: Node.js 18+, an OpenAI API key, macOS or Linux (Windows via WSL). Node.js 20 LTS is recommended for best compatibility.
npm i -g @openai/codex
Set your API key:
export OPENAI_API_KEY=sk-...
Or add it to your shell profile (~/.zshrc, ~/.bashrc) to persist across sessions.
Verify the install:
codex --version

How to Configure Codex CLI
Codex CLI reads from ~/.codex/config.json. Create or edit this file:
{
"model": "gpt-4.5",
"notify": true,
"approvalMode": "suggest"
}
Key config options:
| Option | Values | Effect |
|---|---|---|
model |
gpt-4.5, o3, o4-mini |
Model used for planning and code generation |
approvalMode |
suggest, auto-edit, full-auto |
How aggressively Codex acts without your approval |
notify |
true / false |
Desktop notifications when tasks complete |
context |
path or auto |
Additional context files to include |
approvalMode explained:
suggest— Codex proposes each change; you approve manually. Safe for production repos.auto-edit— Codex edits files without approval but asks before running shell commands.full-auto— Codex plans and executes the full loop autonomously. Best for isolated tasks or clean branches.
Core Codex CLI Capabilities
Here's what Codex does out of the box — before any extensions:
1. Agentic Code Implementation
codex "Add a rate limiter middleware to the Express API — 100 req/min per IP, return 429 with Retry-After header"
Codex reads your project structure, identifies the right files, writes the middleware, wires it into app.js, and adds the test.
2. Repo-Wide Refactoring
codex "Migrate all fetch() calls in /src to use the axios wrapper in lib/http.js"
Codex finds every instance across your repo, rewrites them consistently, and runs the test suite.
3. Test Generation
codex "Generate Jest tests for every exported function in /src/utils — aim for 80% branch coverage"
4. Shell Command Chaining
Codex chains commands naturally:
npm run build && anycap video generate --prompt "product demo" --model veo-3.1 -o demo.mp4 && git add . && git commit -m "add demo"
It knows the output of each command and adapts. If npm run build fails, it diagnoses the error rather than continuing.
5. Documentation Generation
codex "Write a README for this project — setup instructions, API reference, and examples"
Extending Codex CLI: The Capability Layer
Codex is deliberately scoped to coding tasks. Video generation, image creation, web search, and cloud storage are not built in — they live in a capability layer that Codex calls via skills or MCP servers.
MCP Servers
Model Context Protocol servers let Codex invoke external tools as if they were built in. Each MCP server handles one capability — a video API, a database, a browser automation tool.
The tradeoff: each server requires its own setup, auth, and maintenance. If you need video + image + search + storage, that's four servers.
Skills (CLI-based)
Skills are CLI tools that Codex recognizes and calls via shell commands. The simplest extension model: install a CLI, and Codex can call it.
AnyCap is the skill that covers the full capability gap in one install — and it takes under 60 seconds to set up:
- Video generation (Veo 3.1, Sora 2 Pro, Kling 3.0, Seedance 2.0)
- Image generation (GPT Image 2, Seedream 5, Flux)
- Web search with citations
- Cloud storage and file sharing
npm i -g anycap
anycap login
anycap skill install --target ~/.codex/skills/anycap-cli/
After install, Codex recognizes all anycap commands as available actions.
What You Can Do With Codex + AnyCap
Generate a Product Demo Video
anycap video generate \
--prompt "a smooth walkthrough of a SaaS dashboard, clean UI, soft lighting" \
--model veo-3.1 \
-o demo.mp4
Codex implements the feature. AnyCap generates the demo. Same terminal session.
→ Full guide: How to Generate Video with Codex
Generate Images for Your Build
anycap image generate \
--prompt "product hero shot, dark UI, floating interface, product photography" \
--model gpt-image-2 \
-o hero.png
→ Full guide: How to Generate Images with Codex
Search the Web for Current Information
anycap search --prompt "best practices for API rate limiting 2026" --citations
Codex gets back cited, structured results — factual grounding for code generation.
→ Full guide: Codex Web Search Guide 2026
Store and Share Generated Files
anycap drive upload demo.mp4
Returns a shareable link. Codex can embed this in documentation it generates.
Codex CLI vs Claude Code vs Cursor
| Codex CLI | Claude Code | Cursor | |
|---|---|---|---|
| Primary interface | Terminal | Terminal | IDE (VS Code) |
| Model | GPT-4.5 / o3 / o4-mini | Claude 3.7 / 4 | GPT-4o / Claude |
| Repo context | Full repo | Full repo | File/folder scope |
| Shell execution | Yes | Yes | Limited |
| Ecosystem | OpenAI-native | Anthropic-native | Multi-model |
| AnyCap support | ✅ ~/.codex/skills/ |
✅ ~/.claude/skills/ |
✅ ~/.cursor/skills/ |
| Best for | OpenAI ecosystem, autonomous loops | Long reasoning tasks, subagent parallelism | In-IDE editing + generation |
Same anycap commands work across all three — different install path, identical capability.
Codex CLI + OpenAI Ecosystem: The Full Stack
If you're building with OpenAI end-to-end:
# 1. Research (web-grounded)
anycap search --prompt "competitor features for project management SaaS 2026" --citations
# 2. Plan + implement (Codex)
codex "Add the top 3 missing features identified in the research to our roadmap page"
# 3. Generate visuals (GPT Image 2, via AnyCap)
anycap image generate --prompt "roadmap hero, timeline graphic, product UI" --model gpt-image-2 -o roadmap-hero.png
# 4. Generate demo video (Sora 2 Pro, via AnyCap)
anycap video generate --prompt "product roadmap walkthrough" --model sora-2-pro --mode image-to-video --param images=./roadmap-hero.png -o demo.mp4
# 5. Store and share
anycap drive upload demo.mp4
Codex + GPT Image 2 + Sora 2 Pro + AnyCap search — all OpenAI-native or OpenAI-compatible, routed through one CLI.
FAQ
Is Codex CLI free?
Codex CLI is free to install. You pay for API usage on your OpenAI account. Costs depend on model choice — o4-mini runs typical tasks at ~$0.003–0.01 per session, while o3 is better suited for complex reasoning tasks at ~$0.05–0.15 per session. AnyCap offers 250 free credits for new users — enough for ~22 image generations or 5 short videos to try the capability layer.
What's the difference between Codex CLI and the Codex API?
The Codex API (available 2021–2023) was a code completion model — you sent a prompt, got a completion. Codex CLI (2025+) is an agentic system: it reads your repo, plans implementations, runs shell commands, and ships code end-to-end. Entirely different paradigm.
Does Codex CLI work on Windows?
Yes, via WSL (Windows Subsystem for Linux). Native Windows support is limited; WSL 2 with Ubuntu is the recommended path.
What is approvalMode: full-auto and when should I use it?
Full-auto means Codex executes the entire plan — file edits, shell commands, test runs — without asking for approval at each step. Use it on isolated feature branches, not on your main branch or production repos without review.
Can Codex CLI work alongside Claude Code?
Yes. They're separate tools with separate configs. Some teams use Codex for the primary implementation loop (OpenAI models) and Claude Code for longer reasoning tasks or parallel subagent workflows. AnyCap works identically with both.
How do I add video generation to Codex CLI?
Install AnyCap (npm i -g anycap && anycap login), then run anycap skill install --target ~/.codex/skills/anycap-cli/. After that, Codex recognizes anycap video generate as an available command. Full guide: Codex Video Generation.
The Bottom Line
Codex CLI is the most capable terminal-native coding agent in 2026. Install, configure, and it handles the full coding loop autonomously — planning, writing, testing, and committing in a single unattended session.
The gap — media generation, web search, cloud storage — closes with one AnyCap install. Same CLI, same session, full pipeline. Teams using Codex + AnyCap report completing full feature-to-demo cycles (code → image → video) in a single terminal session that previously required 3–4 separate tools.
→ Add full capabilities to Codex — install AnyCap free
📖 What to Read Next
- How to Generate Video with Codex: The Complete 2026 Guide — Video generation pipeline: Veo 3.1, Sora 2 Pro, Kling 3.0, Seedance 2.0.
- How to Generate Images with Codex: The Complete 2026 Guide — Image generation for Codex: GPT Image 2, Seedream 5, and more.
- Codex Web Search Guide 2026 — Add live web research to Codex workflows.
- Best AI Video Models for Coding Agents Compared — Veo 3.1 vs Seedance vs Kling vs Sora: which model fits your workflow.
- What Is a Capability Runtime? — The infrastructure layer that gives Codex media and search capabilities.
Related Articles
- Agentic AI vs Traditional AI: 5 Key Differences — Why tools and autonomy define the next generation of AI.
- What Is an AI Agent? The Complete Developer Guide — Agent architecture, tool layers, and how Codex fits the model.
Written by the AnyCap team. We build the capability runtime that gives Codex, Claude Code, and Cursor video, image, search, and storage through one CLI.