openai-cli  by openai

Command-line interface for OpenAI APIs

Created 3 weeks ago

New!

616 stars

Top 53.0% on SourcePulse

GitHubView on GitHub
Project Summary

Summary The openai-cli is the official command-line interface for interacting with the OpenAI REST API. It empowers developers and power users to programmatically access OpenAI's models and administrative features directly from their terminal, streamlining workflows and enabling automation.

How It Works This CLI adopts a resource-based command structure, allowing users to target specific API endpoints (e.g., openai completions create). It leverages environment variables like OPENAI_API_KEY for authentication and supports flexible input methods, including passing files directly or embedding file content within JSON/YAML payloads. Advanced features include explicit file encoding options and the ability to transform output using GJSON syntax.

Quick Start & Requirements

  • Installation:
    • Homebrew: brew install openai/tools/openai
    • Go: go install 'github.com/openai/openai-cli/cmd/openai@latest' (requires Go 1.25+). Ensure $HOME/go/bin is in your PATH.
  • Local Development: Clone the repository and use ./scripts/run args....
  • Dependencies: Go version 1.25 or later is required for the go install method.
  • Links: Installation commands serve as primary guides.

Highlighted Details

  • Supports both standard user-facing API endpoints and administrative endpoints.
  • File arguments can be passed using @filename.ext syntax, with options for explicit string (@file://) or base64 (@data://) encoding.
  • Includes a ./scripts/link utility for development against specific local or remote versions of the OpenAI Go SDK.
  • Offers extensive output formatting options (--format, --format-error) and debug logging (--debug).

Maintenance & Community No specific details regarding maintainers, community channels (like Discord/Slack), or roadmap were present in the provided README.

Licensing & Compatibility The project is licensed under the Apache License 2.0. This license is generally permissive for commercial use and integration into closed-source projects.

Limitations & Caveats The go install method requires a recent Go version (1.25+), which may be a barrier for users not already using Go or needing older versions. The README focuses on installation and usage, with limited information on broader community support or long-term maintenance signals.

Health Check
Last Commit

4 days ago

Responsiveness

Inactive

Pull Requests (30d)
17
Issues (30d)
3
Star History
621 stars in the last 26 days

Explore Similar Projects

Feedback? Help us improve.