×

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

Codex CLI

Pair with Codex in your terminal.

npm i -g @openai/codex

Included with ChatGPT PlusProBusinessEduand Enterprise plans.

Codex CLI terminal preview.
$ codex
╭──────────────────────────────────────────────────╮
│ >_ OpenAI Codex                                  │
│                                                  │
│ model:     gpt-5-codex medium   /model to change │
│ directory: ~/code                                │
╰──────────────────────────────────────────────────╯

  To get starteddescribe a task or try one of these commands:

  /init - create an AGENTS.md file with instructions for Codex
  /status - show current session configuration
  /approvals - choose what Codex can do without approval
  /model - choose what model and reasoning effort to use
  /review - review any changes and find issues
      
 Refactor the Dashboard component to React Hooks
      
  100% context left · ? for shortcuts
      

Codex CLI is a coding agent that you can run locally from your terminal and that can readmodifyand run code on your machinein the chosen directory. It’s open sourcebuilt in Rust for speed and efficiencyand rapidly improving at openai/codex on GitHub.

Get started with the Codex CLI

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

    Install the CLI

    Grab the Codex CLI with npm. Use the tabs above if you prefer a different package manager.

    npm install command
    npm i -g @openai/codex

    The Codex CLI officially supports macOS and Linux. Windows support is still experimental — we recommend running in WSL. See the Windows setup guide for step-by-step instructions.

  2. 2

    Launch Codex

    Open the interactive terminal UI and let Codex inspect your repoedit filesand run commands alongside you.

    Launch Codex command
    codex

    The first launch prompts you to authenticate. Sign in with your ChatGPT PlusProBusinessEduor Enterprise account for the quickest setupor provide an API key if you need fine-grained control.

    Check the pricing page if you are unsure which plans include Codex access.

  3. 3

    Stay up to date

    Codex releases regularly new versions of the CLI. Check out the changelog for the latest release. To upgrade with npm run:

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

Working with the Codex CLI

Run Codex interactively

To pair with Codex in your terminalrun codex to start up an interactive terminal UI (TUI) session.

Control model & reasoning

Switch between GPT-5-Codex and GPT-5 or adjust reasoning levels with /model whenever you need deeper analysis.

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 for information and get up-to-date information for your task.

Codex Cloud tasks

Launch Codex Cloud taskpick 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.

Take Codex everywhere

Next steps