deniz.in

Markets

Weather

Loading weather

· via Hacker News – Front Page (native)

OpenAI releases official CLI for its REST API with image, admin and file support

OpenAI has published an official command-line client for its REST API, installable via Homebrew or Go, covering responses, images, files and admin usage endpoints.

OpenAI releases official CLI for its REST API with image, admin and file support

OpenAI ships an official command-line client

OpenAI has released an official CLI for its REST API, published on GitHub as openai/openai-cli and noticed after the project reached the front page of Hacker News. The tool is a Go program that exposes the company's REST endpoints through a resource-oriented command structure, and it is distributed through both Homebrew and Go's standard install tooling.

How to install and authenticate

According to the project's README, the CLI can be installed with brew install openai/tools/openai, or through Go, which requires version 1.26 or later: go install 'github.com/openai/openai-cli/cmd/openai@latest'. The Go route places the binary in the Go bin directory, typically $HOME/go/bin, and the README notes it may need to be added to your PATH.

Standard API endpoints authenticate with the OPENAI_API_KEY environment variable, while admin endpoints require a separate OPENAI_ADMIN_KEY. A typical request looks like openai responses create --input "Say this is a test" --model gpt-5.5. Admin functionality follows the same shape, for example openai admin organization usage completions with time-range and bucket-width flags to retrieve organization usage data. An older colon-separated syntax, such as openai admin:organization:usage completions, still works, and openai help setup guides users through entering an API key safely. Help pages render without a network connection or credentials.

Images, files and scriptable output

The CLI goes beyond plain request plumbing. Image generation with openai images generate --prompt "A tiny orange robot" saves results to ~/Downloads/gpt-images/ and prints the saved paths, defaulting to a preset model the README identifies as gpt-image-2.5-sunburst when no explicit model is given. The separate images create-variation command has been retired; variations are now produced through images edit with a GPT Image model and a prompt. Local files can be uploaded with an explicit purpose, inspected by metadata, and downloaded back to disk.

For scripting, successful responses print readable text by default, including inside pipes, while --format json, --format jsonl, raw and yaml switch to machine-readable output. Errors print actionable summaries to stderr, with --format-error json exposing the original API error payload and --transform-error extracting specific fields such as an error code.

Updates, configuration and completion

The tool checks for newer stable releases by reading public GitHub release metadata: at most once a day, without credentials, and waiting no longer than 200 milliseconds so failed checks stay silent. It never installs updates itself; it only prints a notice, at most every seven days, with the appropriate upgrade command for verified installations. OPENAI_CLI_NO_UPDATE_CHECK=1 disables the mechanism entirely.

Configuration extends beyond the API key, with environment variables and matching global flags for organization and project IDs, a webhook secret, custom headers and mutual TLS certificate files. A --base-url flag points the CLI at a custom API backend, with HTTPS required except for localhost or loopback addresses — a practical hook for proxies and local gateways. Shell completion is offered for Bash, zsh and fish, including an interactive image picker and a Ctrl+X-then-Tab search over command suggestions, while PowerShell keeps its normal Tab completion.

Why it matters

Most developers interact with OpenAI through language SDKs, raw HTTP calls or third-party terminal wrappers. An official CLI puts the vendor itself into that last category, legitimizing terminal-first workflows and raising the bar for community tools that have filled the gap until now.

The design choices suggest a focus on automation rather than casual experimentation: offline help, pipe-friendly defaults alongside explicit JSON modes, structured error extraction, admin usage reporting, mTLS support and a custom base URL are the features that scripts, CI pipelines and internal tooling need. For teams that currently glue together their own commands against the OpenAI API, this release offers a maintained first-party alternative — and its quick appearance on Hacker News's front page indicates developers are already paying attention.

  • #openai
  • #cli
  • #developer-tools
  • #api
  • #go

Related posts