CLI generation
Alpha · Early Access
CLI generation is currently in alpha and available exclusively to early access customers. Features and configuration may change. Contact us for access.
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
- 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
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
, stdin piping, and bytes fields using
or
prefixes.
Rich output modes
Details
Supports
,
,
,
, and
, plus built-in
filtering.
Binary-safe workflows
Details
Binary responses support
,
, and TTY protections to prevent dumping raw bytes to a terminal by accident.
Interactive UX
Details
Optional interactive prompting, an
TUI command, interactive
, 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
and
.
Machine-readable docs surfaces
Details
Provides grouped help output and a
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
- 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
Last updated on