Codex CLI is a coding agent from OpenAI that runs locally on your computer.

Codex CLI splash


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 的一款编码代理,可在你的计算机上本地运行。

Codex CLI splash


如果你希望在代码编辑器(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:

在 Mac 或 Linux 上运行以下命令来安装 Codex CLI:

curl -fsSL https://chatgpt.com/codex/install.sh | sh

Run the following on Windows to install Codex CLI:

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

独立安装程序默认从 https://releases.openai.com/codex 下载,如果元数据或资源下载不可用,则回退到 GitHub Releases。要强制使用 GitHub Releases,请将 CODEX_INSTALLER_USE_RELEASES_OPENAI_COM 设置为 false(也接受 0 和 no):

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:

Codex CLI 也可以通过以下包管理器安装:

# Install using npm
npm install -g @openai/codex
# Install using Homebrew
brew install --cask codex

Then simply run codex to get started.

然后只需运行 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.

运行 codex 并选择 使用 ChatGPT 登录。我们建议登录你的 ChatGPT 账户,以便将 Codex 作为 Plus、Pro、Business、Edu 或 Enterprise 套餐的一部分使用。详细了解你的 ChatGPT 套餐包含哪些内容。

You can also use Codex with an API key, but this requires additional setup.

你也可以使用 API 密钥来使用 Codex,但这需要额外设置。

Docs

文档

This repository is licensed under the Apache-2.0 License.

本仓库根据 Apache-2.0 许可证 授权。