In 20 seconds
- The OpenAI CLI (github.com/openai/openai-cli) is 'the official command-line tool for the OpenAI REST API,' written in Go and licensed under Apache 2.0. It installs as a prebuilt binary, with `brew install openai/tools/openai` or with `go install`, and reads your key from OPENAI_API_KEY.
- It isn't new: its GitHub releases begin with v1.0.0 on May 5, 2026, and run through v1.40.5 on October 23, 2026, adding the Live API, image tools and admin-key setup along the way.
- It sends one API request per command, for Responses, files, images, speech, transcription and admin endpoints. Codex CLI, installed as `codex`, is a coding agent that edits code and runs commands inside a sandbox and can sign in with a ChatGPT plan.
On this page
The OpenAI CLI is OpenAI's official command-line tool for its API: a single openai binary that turns each API endpoint into a terminal command, such as openai responses create. It has shipped since May 2026, with version 1.40.5 released on October 23, 2026, and it's easy to confuse with Codex CLI, OpenAI's other terminal tool. The difference: the OpenAI CLI sends API requests you write yourself, while Codex CLI is an agent that decides what to do in your code.
This explainer is based on the openai-cli GitHub repository and changelog, OpenAI's OpenAI CLI documentation, the Codex GitHub repository and OpenAI's Codex CLI and sandboxing documentation, checked October 23, 2026. For how Codex itself works and what it costs, see our Codex explainer.
The short version
- What it is: "The official command-line tool for the OpenAI REST API," per its README. Written in Go, Apache 2.0 licensed, copyright 2026 OpenAI.
- Install: a prebuilt binary from GitHub Releases,
brew install openai/tools/openai, orgo install. - Sign-in: an API key in
OPENAI_API_KEY; an admin key inOPENAI_ADMIN_KEYfor admin endpoints. No ChatGPT sign-in is documented. - What it covers: Responses, files, batches, images, speech, transcription and organization admin endpoints, among others.
- Not new: releases since May 2026; v1.40.5 on October 23, 2026.
- Not Codex: Codex CLI is a coding agent with a sandbox; the OpenAI CLI makes no decisions of its own.
What is the OpenAI CLI?
It's a thin terminal client for the OpenAI API. Commands follow the API's resources, openai <resource> [subresource...] <command> [flags...], so openai files list lists your uploaded files and openai responses create --input "Say this is a test" --model gpt-5.5 sends one request to the Responses API. OpenAI's documentation pitches it for "one-off terminal requests" and for scripts that do "repeatable batch work over files and generated artifacts."
Output is controlled with --format, which accepts auto, json, jsonl, pretty, raw, yaml or explore (the repository's CLI reference also lists text). The default is readable text, "even in pipes," so scripts should ask for json or jsonl. A --transform flag pulls out fields with a GJSON path, so a script can keep only the assistant's text instead of the whole response object. Binary uploads take a plain file path, and JSON input flags can read a value from a file with @path.
How do you install the OpenAI CLI?
The README lists three methods:
- Prebuilt binary: download the archive for macOS, Linux or Windows from GitHub Releases and put
openaion yourPATH. - Homebrew:
brew install openai/tools/openai - Go:
go install 'github.com/openai/openai-cli/cmd/openai@latest'. The binary lands in$HOME/go/binby default. The README now asks for Go 1.26 or later, while OpenAI's documentation page still says Go 1.25.
From a clone of the repository, ./scripts/run runs it without installing. No npm or pip package is documented. The CLI checks for updates on interactive runs but never installs them itself; OPENAI_CLI_NO_UPDATE_CHECK=1 turns the checks off.
How does the OpenAI CLI sign in?
With API keys. openai help setup walks you through entering one, and scripts can supply it as an environment variable. Standard endpoints use OPENAI_API_KEY; admin endpoints use OPENAI_ADMIN_KEY, and OpenAI's docs say the right key is selected "based on the endpoint being called." Other variables set the organization, project, a webhook secret and mutual TLS certificates; the repository's CLI reference says mutual TLS "is currently in beta." OPENAI_BASE_URL points it at a different API host.
Two cautions from OpenAI: its docs say to "be careful about giving unvetted actors access to admin keys," and --debug prints request and response details. The CLI reference warns: "do not share debug logs if they may contain sensitive payloads."
Because it uses an API key, each command is a normal API call billed to that key's organization. There's no documented way to sign in with a ChatGPT plan.
What can the OpenAI CLI do?
OpenAI's documentation walks through these areas:
- Responses: text generation, structured JSON output, web search and file inputs, with models such as gpt-6-astra and gpt-5.5.
- Files and batches: uploads for use as Responses inputs, and batch jobs the CLI can wait on and download.
- Images:
openai images generateandopenai images edit, with gpt-image-2. The README says generated images are saved to~/Downloads/gpt-images/(or a folder set with--output-dir); OpenAI's documentation page still says image commands "do not yet have native--outputsupport" and decodes base64 output instead. - Speech:
openai audio:speech createwith gpt-4o-mini-tts, written to a file such as MP3. OpenAI's docs mark that model deprecated, with shutdown on January 6, 2027. - Transcription:
openai audio:transcriptions createwith gpt-transcribe, the model the docs recommend, for plain transcript text. whisper-1 (for srt and vtt subtitles) and gpt-4o-transcribe-diarize still work but shut down on February 26, 2027. - Admin:
openai admin organizationcommands (the olderadmin:organization:*form also works) to manage projects and service accounts and fetch usage.
The README doesn't list every supported endpoint; it points to --help, which works without an API key or network connection, and to a CLI reference. The changelog shows coverage growing fast: the Live API arrived in v1.15.0 on September 10, an inline image-generation picker in v1.33.0 on October 3, usage cost grouping in v1.38.0 on October 8, admin-key setup, voice creation and batch downloads in v1.39.0 on October 19, and speech playback, live microphone translation, a local command search (openai explore) and webhook setup in v1.40.3 on October 22, 2026.
Is the OpenAI CLI the same as Codex CLI?
No. They share a vendor and a terminal, and little else.
| OpenAI CLI | Codex CLI | |
|---|---|---|
| What it is | "The official command-line tool for the OpenAI REST API" | "A coding agent from OpenAI that runs locally on your computer" |
| Command | openai | codex |
| Install | Prebuilt binary, Homebrew (openai/tools/openai) or go install | Install script, npm (@openai/codex), Homebrew cask |
| Sign-in | API key (OPENAI_API_KEY), admin key for admin endpoints | Sign in with ChatGPT (recommended for paid plans) or API key |
| Who decides what runs | You: one command, one API request | The agent: it reads files, edits code and runs commands |
| Sandbox | None needed; it only calls the API | Sandbox modes from read-only to danger-full-access |
| Scripting | Every command; --format and --transform for pipelines | codex exec for scripts and pipelines |
| License | Apache 2.0 | Apache 2.0 |
| GitHub stars, October 23, 2026 | about 1,090 | about 130,600 |
Table 1The OpenAI CLI executes requests you write; Codex CLI decides what to do and runs it in a sandbox. Source: openai/openai-cli README and OpenAI CLI docs; openai/codex README and Codex CLI and sandboxing docs.
Last verified: October 23, 2026
OpenAI draws the line the same way. The README now opens with the question "OpenAI CLI or Codex CLI?": use openai "when you want to call a specific API or put API operations in a script," and Codex CLI "when you want a coding agent to work on a project." The OpenAI CLI docs page recommends the CLI for API work "you want to inspect and rerun," such as batch extraction, file transforms and artifact generation, and Codex subagents for work that needs judgment, such as exploring code, debugging or reviewing changes. It also mentions "Codex-authored batch scripts," which suggests the two can work together: an agent writes a script that calls openai, and you rerun it without the agent.
Codex CLI brings the agent's risks with it. It runs with a sandbox (Seatbelt on macOS, bubblewrap on Linux) and approval policies, and a background server added in September, covered in our story on the Codex CLI daemon. If you want an agent's harness behind an API instead, that's OpenAI's Agents API. How Codex CLI stacks up against other coding agents is in our Claude Code vs Codex vs Cursor comparison.
Does it replace the old openai command from the Python package?
In effect, yes, but watch your PATH. OpenAI's docs say "older Python SDK versions installed a legacy openai command." If your shell still finds that binary first, the commands won't match the new CLI's. Fresh installs of the new CLI aren't affected, according to the docs. As of October 23, 2026, the openai-python README describes only a Python library and doesn't document a command-line tool.
Is the OpenAI CLI new?
Not as of October 2026. The repository's GitHub Releases page shows v1.0.0 on May 5 and v1.1.0 on May 7, 2026, and both the releases and the changelog run to v1.40.5, dated October 23, 2026. OpenAI's docs page for the CLI carries no beta label, though mutual TLS support is marked beta.
What's confirmed, reported and uncertain
- Confirmed (repository and OpenAI docs): what the CLI is, install methods, authentication, global flags, documented commands, license and changelog dates.
- Confirmed (Codex repository and docs): Codex CLI's description, install methods, sign-in options, sandbox modes and license.
- Conflicting: the README asks for Go 1.26 or later and says images save to disk, while OpenAI's documentation page still says Go 1.25 and describes no native image output option.
- Uncertain: the full list of API endpoints the CLI covers, since the README points to
--helprather than listing them. No OpenAI blog post announcing the CLI was found.
About this story
Based on the sources linked below. How we report: Editorial standards.






Comments (0)