OpenAI CLI – Official CLI for the OpenAI API OpenAI released an official command-line interface for its REST API, installable via Homebrew with `brew install openai/tools/openai` or built from source with Go 1.26 or later. The CLI uses a resource-based command structure (`openai [subresource...] [flags...]`), requires an `OPENAI_API_KEY` for standard endpoints and an `OPENAI_ADMIN_KEY` for admin endpoints, and prints readable text by default with `--format json` or `--format jsonl` available for scripts. The tool also adds help pages that work without an API key or network connection and shell Tab completion for Bash, zsh and fish, with existing colon commands such as `openai admin:organization:usage completions` continuing to work. The official CLI for the OpenAI REST API https://platform.openai.com/docs . brew install openai/tools/openai To test or install the CLI locally, you need Go https://go.dev/doc/install version 1.26 or later installed. go install 'github.com/openai/openai-cli/cmd/openai@latest' Once you have run go install , the binary is placed in your Go bin directory: - Default location : $HOME/go/bin or $GOPATH/bin if GOPATH is set - Check your path : Run go env GOPATH to see the base directory If commands aren't found after installation, add the Go bin directory to your PATH: Add to your shell profile .zshrc, .bashrc, etc. export PATH="$PATH:$ go env GOPATH /bin" The first eligible interactive openai run quietly saves image picker Tab shortcuts for future Bash, zsh, and fish sessions. Open a new terminal to use them. See shortcut setup and removal https://github.com/openai/openai-cli/blob/main/docs/image-picker-shell-setup.md for requirements and opt-out. PowerShell keeps normal Tab completion; press Enter after openai images generate to open the picker. After cloning the git repository for this project, you can use the scripts/run script to run the tool locally: ./scripts/run args... The CLI follows a resource-based command structure: openai