Windows上安装Codex CLI完整指南

2026-08-01 约 4 分钟阅读

OpenAI的Codex CLI是强大的终端智能体,但Windows安装有差异。

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

Step 2: Install

npm install -g @openai/codex
codex --version

Step 3: Authenticate

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):

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

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.

相关文章
2026-06-29
高收益主线龙头策略——不花钱的数据,也能抓到龙头
2026-06-29
你笔记本里,藏着一个AI
2026-07-14
免费AI编程助手 2026 配置指南:VS Code 5分钟装 Continue、Copilot、Windsurf

💬 评论 (0)

暂无评论,来说两句吧~

登录后评论