openai / codex

OpenAI / Codex

Codex CLI is a coding agent from OpenAI that runs locally on your computer. If you want Codex in your code editor (VS Code, Cursor, Windsurf), install in your IDE. If you want the desktop app experience, run codex app or visit the Codex App page. If you are looking for the cloud-based agent from OpenAI, Codex Web, go to chatgpt.com/codex.

Codex CLI 是 OpenAI 推出的一个可在本地计算机上运行的编程代理。如果你希望在代码编辑器(如 VS Code、Cursor、Windsurf)中使用 Codex,请直接在 IDE 中安装。如果你想要桌面应用体验,请运行 codex app 或访问 Codex App 页面。如果你正在寻找 OpenAI 基于云端的代理 Codex Web,请访问 chatgpt.com/codex。

Quickstart: Installing and running Codex CLI

快速入门:安装并运行 Codex CLI

Run the following on Mac or Linux to install Codex CLI: curl -fsSL https://chatgpt.com/codex/install.sh | sh

在 Mac 或 Linux 上运行以下命令以安装 Codex CLI: curl -fsSL https://chatgpt.com/codex/install.sh | sh

Run the following on Windows to install Codex CLI: powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"

在 Windows 上运行以下命令以安装 Codex CLI: powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"

The standalone installers download from https://releases.openai.com/codex by default and fall back to GitHub Releases if a metadata or asset download is unavailable. To force GitHub Releases, set CODEX_INSTALLER_USE_RELEASES_OPENAI_COM to false (0 and no are also accepted): curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_INSTALLER_USE_RELEASES_OPENAI_COM=false sh $env:CODEX_INSTALLER_USE_RELEASES_OPENAI_COM='false'; irm https://chatgpt.com/codex/install.ps1 | iex

独立安装程序默认从 https://releases.openai.com/codex 下载,如果元数据或资源下载失败,则会回退到 GitHub Releases。若要强制使用 GitHub Releases,请将 CODEX_INSTALLER_USE_RELEASES_OPENAI_COM 设置为 false(同时也接受 0no): curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_INSTALLER_USE_RELEASES_OPENAI_COM=false sh $env:CODEX_INSTALLER_USE_RELEASES_OPENAI_COM='false'; irm https://chatgpt.com/codex/install.ps1 | iex

Codex CLI can also be installed via the following package managers: # Install using npm npm install -g @openai/codex # Install using Homebrew brew install --cask codex Then simply run codex to get started.

Codex CLI 也可以通过以下包管理器安装: # 使用 npm 安装 npm install -g @openai/codex # 使用 Homebrew 安装 brew install --cask codex 安装完成后,只需运行 codex 即可开始使用。

You can also go to the latest GitHub Release and download the appropriate binary for your platform. Each GitHub Release contains many executables, but in practice, you likely want one of these: macOS Apple Silicon/arm64: codex-aarch64-apple-darwin.tar.gz x86_64 (older Mac hardware): codex-x86_64-apple-darwin.tar.gz Linux x86_64: codex-x86_64-unknown-linux-musl.tar.gz arm64: codex-aarch64-unknown-linux-musl.tar.gz Each archive contains a single entry with the platform baked into the name (e.g., codex-x86_64-unknown-linux-musl), so you likely want to rename it to codex after extracting it.

你也可以前往最新的 GitHub Release 页面,下载适合你平台的二进制文件。每个 GitHub Release 包含多个可执行文件,但实际上你通常只需要以下其中之一: macOS Apple Silicon/arm64: codex-aarch64-apple-darwin.tar.gz x86_64 (旧款 Mac 硬件): codex-x86_64-apple-darwin.tar.gz Linux x86_64: codex-x86_64-unknown-linux-musl.tar.gz arm64: codex-aarch64-unknown-linux-musl.tar.gz 每个压缩包内包含一个文件名中带有平台标识的条目(例如 codex-x86_64-unknown-linux-musl),解压后你可能需要将其重命名为 codex

Using Codex with your ChatGPT plan

将 Codex 与你的 ChatGPT 订阅计划配合使用

Run codex and select Sign in with ChatGPT. We recommend signing into your ChatGPT account to use Codex as part of your Plus, Pro, Business, Edu, or Enterprise plan. Learn more about what’s included in your ChatGPT plan. You can also use Codex with an API key, but this requires additional setup.

运行 codex 并选择“使用 ChatGPT 登录”。我们建议登录你的 ChatGPT 账户,以便将 Codex 作为你的 Plus、Pro、Business、Edu 或 Enterprise 计划的一部分使用。了解更多关于 ChatGPT 计划包含的内容。你也可以使用 API Key 来使用 Codex,但这需要额外的配置。

Docs Codex Documentation Contributing Installing & building Open source fund This repository is licensed under the Apache-2.0 License.

文档 Codex 文档 贡献 安装与构建 开源基金 本仓库采用 Apache-2.0 许可证。