# Codex CLI

CreateWithAI Hub page: https://createwithaihub.com/ai-agents/openai-codex-cli
Latest version of this file: https://createwithaihub.com/ai-agents/openai-codex-cli.md

- Type: AI agent · Category: AI Agents
- Publisher: OpenAI
- Pricing: Free plan plus paid plans · License: Apache-2.0
- Works with: Cursor, VS Code, Windsurf
- Runs on: Web, macOS, Windows, Linux

OpenAI's open-source coding agent that runs locally in your terminal, with IDE, desktop and cloud variants.

Codex CLI is OpenAI's open-source coding agent for the terminal. It inspects code, makes changes and runs commands in your local repository, with permission controls and a sandbox for what it may do. It signs in with a ChatGPT plan or an OpenAI API key, and can also run against local models through Ollama or LM Studio. OpenAI also offers Codex as an IDE extension, a desktop app and a cloud agent (Codex Web).

Useful for: Making and testing code changes in a local repo from the terminal, or delegating tasks to the cloud version from ChatGPT.

## Key features

- Runs locally against your repository from the terminal
- /permissions to control file edits and command execution
- Sandbox with inspectable writable roots
- codex mcp to add local or remote MCP servers
- Sign in with ChatGPT or use an API key; custom model providers and local models via --oss (Ollama, LM Studio)

## Connection

- Interface: Terminal / CLI, IDE extension, Web, Desktop app
- Model choice: Bring your own model
- Runs: On your machine, In the cloud

## Install steps from the official documentation

macOS / Linux:

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

Windows:

```
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
```

npm:

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

Homebrew:

```
brew install --cask codex
```

## Limitations

- Codex in the CLI with OpenAI-hosted models needs ChatGPT Plus ($20/month) or higher (Pro from $100/month; Business $20 per user/month billed annually, $25 billed monthly) or an OpenAI API key billed at API rates
- The ChatGPT Free and Go plans include Codex only in the desktop app, subject to rollout
- API-key sessions have no cloud features such as GitHub code review or the Slack integration

## Official links

- Website: https://chatgpt.com/codex
- Source repository: https://github.com/openai/codex
- Documentation: https://learn.chatgpt.com/docs/codex/cli
- Source: https://github.com/openai/codex (README: install commands, IDE/desktop/web variants, ChatGPT plan sign-in, Apache-2.0)
- Source: https://learn.chatgpt.com/docs/codex/cli (Permissions, sandbox, codex mcp (developers.openai.com/codex/cli redirects here))
- Source: https://learn.chatgpt.com/docs/pricing (Codex plans: Free/Go ($0/$8, desktop app only, subject to rollout), Plus $20/mo (CLI, IDE, web, iOS), Pro from $100/mo, Business $20/user/mo billed annually ($25 monthly), Enterprise/Edu; API-key usage at API pricing without cloud features (developers.openai.com/codex/pricing redirects here))
- Source: https://learn.chatgpt.com/docs/config-file/config-advanced (Custom model providers (model_providers), built-in ollama/lmstudio/Bedrock providers, --oss mode for local models)
