CLI Generation
CLI generation
Speakeasy can generate a fully functional command-line interface (CLI) from an OpenAPI specification. The generated CLI is written in Go using Cobra, wraps a generated Go SDK, and ships with human-friendly and automation-friendly interfaces out of the box.
Getting started
Section titled “Getting started”- Generate a CLI — Create a CLI from an OpenAPI document using
speakeasy quickstart - Customize a CLI — Configure command naming, environment variables, interactive features, release artifacts, and more
- Distribute a CLI — Distribute a CLI using GoReleaser, install scripts, or
go install - Configuration reference — Full
gen.yamlconfiguration reference for theclitarget
What the generated CLI includes
Section titled “What the generated CLI includes”Capability
Per-operation command tree
Details
Each operation becomes a Cobra command, grouped by tags with stutter removal to keep names concise.
Flexible request input
Details
Users can supply request data through typed flags, whole-body JSON via
--body, stdin piping, and bytes fields using file: or b64: prefixes.Rich output modes
Details
Supports
pretty, json, yaml, table, and toon, plus built-in --jq filtering.Binary-safe workflows
Details
Binary responses support
--output-file, --output-b64, and TTY protections to prevent dumping raw bytes to a terminal by accident.Interactive UX
Details
Optional interactive prompting, an
explore TUI command, interactive configure, and auth login/logout flows for human terminal use.Agent-aware UX
Details
Automatically detects AI coding agents and switches to TOON-friendly defaults, structured errors, and non-interactive behavior.
Runtime controls
Details
Includes pagination, SSE/JSONL streaming, retries, timeouts, custom headers, response headers, and diagnostics like
--dry-run and --debug.Machine-readable docs surfaces
Details
Provides grouped help output and a
--usage KDL schema for tooling, automation, and agent consumption.Distribution tooling
Details
Generates GoReleaser config, release workflows, install scripts, and built-in shell completions for Bash, Zsh, Fish, and PowerShell.
Key features
Section titled “Key features”- Per-operation commands with smart grouping and stutter removal
- Multiple output formats — pretty, JSON, YAML, table, and TOON
- Built-in jq filtering via
--jq - Flexible input — individual flags,
--body, stdin, and bytes fields withfile:/b64:input - 4-tier authentication — flags → environment variables → OS keychain → config file
- Interactive mode — auto-prompting for unresolved fields,
explore,configure, and auth forms - Agent mode — auto-detected for Claude Code, Cursor, Codex, Aider, and similar environments
- Pagination with
--alland--max-pages - SSE and JSONL streaming
- Retries and timeouts
- Response headers via
--include-headers - Binary downloads with
--output-fileand--output-b64 - Shell completions for Bash, Zsh, Fish, and PowerShell
- Machine-readable usage output via
--usage - Cross-platform release — GoReleaser config, install scripts, and GitHub Actions workflow