Skip to Content
DocumentationOverview

CLI generation

Speakeasy can generate a fully functional command-line interface (CLI) from your OpenAPI specification. The generated CLI is written in Go using Cobra  and provides a per-operation command structure, multiple output formats, built-in authentication, and cross-platform distribution tooling.

Getting started

  • Generate a CLI — Create a CLI from your OpenAPI document using speakeasy quickstart
  • Customize a CLI — Configure command naming, environment variables, custom code regions, and more
  • Distribute a CLI — Distribute your CLI using GoReleaser, install scripts, or go install
  • Configuration reference — Full gen.yaml configuration reference for the cli target

Key features

  • Per-operation commands with smart grouping and stutter removal
  • Multiple output formats — pretty, JSON, YAML, table, and TOON  (token-oriented output for LLM consumption)
  • Built-in jq filtering via --jq
  • Flexible input — individual flags, --body JSON, or stdin piping
  • 4-tier authentication — flags → environment variables → OS keychain → config file
  • Shell completions for bash, zsh, fish, and PowerShell
  • Pagination with --all and --max-pages
  • SSE and JSONL streaming
  • Retries with configurable exponential backoff
  • Diagnostics--dry-run and --debug with automatic secret redaction
  • AI agent mode — automatically detected for coding assistants like Claude Code, Cursor, and others
  • Cross-platform release — GoReleaser config, install scripts, and GitHub Actions workflow

Last updated on