OpenAI CLI is the official command-line tool for the OpenAI REST API, published by OpenAI on GitHub under the Apache License 2.0. It lets you call the API from a terminal or shell script without writing an application. Commands follow the API's resource structure (openai <resource> [subresource] <command>), and built-in help works offline without an API key.
The README highlights a few everyday workflows: generating and editing images that are saved locally, uploading, retrieving and downloading files, submitting a JSONL batch and waiting for its results, and exporting API data for scripts. Output defaults to readable text even in pipes; you can switch to JSON, JSONL, YAML or raw output and extract fields with GJSON transforms. Admin endpoints, such as organization usage reports, use a separate admin API key, and the reference documents mTLS client certificates, custom headers and an OPENAI_UNTRUSTED_STDIN mode for piping untrusted input.
OpenAI positions the tool explicitly next to Codex CLI: use openai to call a specific API or script API operations, and use codex when you want a coding agent to read and edit code. On eligible interactive runs the CLI checks for updates (disable with OPENAI_CLI_NO_UPDATE_CHECK=1) and, on the first interactive run, saves image-picker Tab shortcuts for Bash, zsh and fish; the docs explain how to opt out and remove them.
The CLI itself is free. Every request uses your own OpenAI API key and is billed at standard OpenAI API rates, so cost depends entirely on the models and endpoints you call.
