Explainer

OpenAI CLI explained: what OpenAI's official command-line tool does, and how it differs from Codex CLI

The OpenAI CLI is OpenAI's official `openai` command for calling its API from a terminal: Responses, files, images, audio and admin endpoints, with an API key. Codex CLI is a coding agent. How to install the OpenAI CLI, what it covers and how the two tools differ, as of October 23, 2026.

A terminal with one lit command and one arrow to an API box beside a terminal in a dashed sandbox with a three-step loop, on mint, titled Not Codex

In 20 seconds

  1. 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.
  2. 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.
  3. 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, or go install.
  • Sign-in: an API key in OPENAI_API_KEY; an admin key in OPENAI_ADMIN_KEY for 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:

  1. Prebuilt binary: download the archive for macOS, Linux or Windows from GitHub Releases and put openai on your PATH.
  2. Homebrew: brew install openai/tools/openai
  3. Go: go install 'github.com/openai/openai-cli/cmd/openai@latest'. The binary lands in $HOME/go/bin by 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 generate and openai 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 --output support" and decodes base64 output instead.
  • Speech: openai audio:speech create with 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 create with 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 organization commands (the older admin: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 CLICodex 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"
Commandopenaicodex
InstallPrebuilt binary, Homebrew (openai/tools/openai) or go installInstall script, npm (@openai/codex), Homebrew cask
Sign-inAPI key (OPENAI_API_KEY), admin key for admin endpointsSign in with ChatGPT (recommended for paid plans) or API key
Who decides what runsYou: one command, one API requestThe agent: it reads files, edits code and runs commands
SandboxNone needed; it only calls the APISandbox modes from read-only to danger-full-access
ScriptingEvery command; --format and --transform for pipelinescodex exec for scripts and pipelines
LicenseApache 2.0Apache 2.0
GitHub stars, October 23, 2026about 1,090about 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 --help rather than listing them. No OpenAI blog post announcing the CLI was found.

Read next

Comments (0)

More on OpenAI

View all
Models · ExplainerGemini 4 Carbon vs Claude Opus 5.5 vs GPT-6.1 Sol: price, context, access and benchmarks (October 2026)Gemini 4 Carbon vs Opus 5.5 vs GPT-6.1 Sol, on official prices, context limits and access as of October 29, 2026, plus the shared benchmarks: Artificial Analysis scores them 59, 58 and 55. Carbon isn't on sale yet.·9 min read
Research · BenchmarksArtificial Analysis Intelligence Index v5: 60% private tests, three evaluations dropped, and Gemini 4 Carbon on top at 59Artificial Analysis Intelligence Index v5, launched October 27, 2026, rebuilds the index around nine evaluations, 60% of them with private test sets. Claude Opus 5.5 led at 58 until Gemini 4 Carbon scored 59 the next day. What changed, who leads, and why older scores don't compare.·8 min read
Policy · NewsOpenAI lawsuit over epilepsy death: parents allege ChatGPT coached their daughter off her seizure medicationAn OpenAI lawsuit over an epilepsy death was filed on October 27, 2026: the parents of Bowen Wan, 31, allege ChatGPT running GPT-4o guided her to taper off her anti-seizure medication and hide it from her doctors. What the suit alleges, the claims, and what OpenAI has said.·5 min read
Research · AnalysisOpenAI solved open math problems, it says: local smoothing, the Exponential Time Hypothesis and QCD, and what has actually been checkedOpenAI says its AI solved open problems in math, computer science and physics, announced October 26, 2026: Sogge's local smoothing conjecture, a disproof of the Exponential Time Hypothesis, and existence proofs for quantum field theories including QCD. Two come with Lean proofs; the physics work hasn't been released, and no outside group has finished checking any of them.·9 min read
The Week in AI · every Friday

New guides and explainers, every Friday.

The week’s biggest stories in AI and tech, what they mean, and what to read next.

Free. One email a week. Unsubscribe in one click.