Codex CLI on Windows 2026: Complete Setup Guide (OpenAI's Coding Agent)
OpenAI's Codex CLI is a strong terminal agent but the setup differs on Windows. Here is what works.
## Codex CLI on Windows 2026: Complete Setup Guide (OpenAI's Coding Agent)
OpenAI's Codex CLI brings the coding agent that powers ChatGPT Codex into your terminal. It is open source (Apache-2.0) and sits at 102,900 GitHub stars. Windows setup has a few gotchas - here is the path that works.
## Step 1: Prerequisites
- Node.js 20+ (for npm)
- Git for Windows (for repo operations)
- An OpenAI API key (or ChatGPT Plus subscription for some plans)
## Step 2: Install
```bash
npm install -g @openai/codex
codex --version
```
## Step 3: Authenticate
```bash
codex login
```
This opens a browser window to authorize with your OpenAI account. On Windows, if the browser does not auto-open, copy the printed URL manually.
## Step 4: Windows-Specific Setup
Open a terminal (use Git Bash or Windows Terminal - plain cmd works but Git Bash handles paths better):
```bash
codex
```
Then try: "list the files in this directory and summarize the README".
## Windows Troubleshooting
| Issue | Fix |
|-------|-----|
| codex not recognized | Reinstall Node, confirm %APPDATA%
pm is in PATH |
| Login window won't open | Run codex login --headless and paste the URL |
| Path errors on repos | Use Git Bash instead of cmd |
| Firewall blocks | Allow Node.js in Windows Defender Firewall |
| Slow first run | Codex downloads models/schema on first launch |
## What Codex CLI Does Well
- Executes multi-step coding tasks with plan-then-act behavior
- Sandboxed command execution (approval prompts)
- Reads your whole repo for context
- Works with GPT-5-class models via API
## FAQ
**Is Codex CLI free?** The CLI is open source. API usage is billed at OpenAI rates; Plus subscribers get limited monthly usage.
**Codex CLI vs Claude Code?** Both are terminal agents; Codex is OpenAI-tied, Claude Code is Anthropic-tied. Choose by which model you prefer.
**Can it run local models?** No - Codex CLI is designed for OpenAI models.
Related Articles
2026-06-29
The Mainline Dragon Strategy โ Chasing the Leader Without Paying for Data
2026-06-29
The AI Hiding in Your Laptop
2026-07-14
Free AI Coding Assistant Setup 2026: 5-Min VS Code Guide (Continue, Copilot, Windsurf)
