×

注意!页面内容来自https://developers.openai.com/codex/cli,本站不储存任何内容,为了更好的阅读体验进行在线解析,若有广告出现,请及时反馈。若您觉得侵犯了您的利益,请通知我们进行删除,然后访问 原网页

Codex CLI

Pair with Codex in your terminal

Codex CLI is OpenAI’s coding agent that you can run locally from your terminal. It can readchangeand run code on your machine in the selected directory. It’s open source and built in Rust for speed and efficiency.

Codex is included with ChatGPT PlusProBusinessEduand Enterprise plans. Learn more about what’s included.


CLI setup

<>astro-island,astro-slot,astro-static-slot{display:contents}
Choose your package manager
  1. 1

    Install

    Install the Codex CLI with npm.

    npm install command
    npm i -g @openai/codex
  2. 2

    Run

    Run Codex in a terminal. It can inspect your repositoryedit filesand run commands.

    Run Codex command
    codex

    The first time you run Codexyou'll be prompted to sign in. Authenticate with your ChatGPT account or an API key.

    See the pricing page if you're not sure which plans include Codex access.

  3. 3

    Upgrade

    New versions of the Codex CLI are released regularly. See the changelog for release notes. To upgrade with npmrun:

    npm upgrade command
    npm i -g @openai/codex@latest

The Codex CLI is available on macOS and Linux. Windows support is experimental. For the best Windows experienceuse Codex in a WSL workspace and follow our Windows setup guide.


Work with the Codex CLI

Run Codex interactively

Run codex to start an interactive terminal UI (TUI) session.

Control model and reasoning

Use /model to switch between GPT-5-Codex and GPT-5or adjust reasoning levels.

Image inputs

Attach screenshots or design specs so Codex reads them alongside your prompt.

Run local code review

Get your code reviewed by a separate Codex agent before you commit or push your changes.

Use Codex to search the web and get up-to-date information for your task.

Codex Cloud tasks

Launch a Codex Cloud taskchoose environmentsand apply the resulting diffs without leaving your terminal.

Scripting Codex

Automate repeatable workflows by scripting Codex with the exec command.

Model Context Protocol

Give Codex access to additional third-party tools and context with Model Context Protocol (MCP).

Approval modes

Choose the approval mode that matches your comfort level before Codex edits or runs commands.