Home / Features / OpenAPI to CLI
OpenAPI API client code generation REST TypeScript

OpenAPI to CLI

Turn an OpenAPI spec into a CLI people actually use.

Beltline imports an OpenAPI spec and generates resource commands, a typed API client, pagination, retries, JSON output, and examples — then lets you customize the TypeScript where it matters.

The API already knows what it can do. Beltline turns that into a command surface.


An SDK is not a CLI.

OpenAPI can generate clients, but users still need commands, flags, help text, safe confirmations, output formats, examples, and auth-aware workflows. Generated SDKs stop at the function call. Beltline starts there and builds out.

Generate the boring 80%. Customize the important 20%.


Before and after Beltline

| Before | After Beltline | |--------|----------------| | OpenAPI spec sitting in a repo | Resource commands grouped by noun | | Generic generated SDK | Typed client wired into auth and retries | | Handwritten wrapper commands | Human tables and --json for free | | Inconsistent output across endpoints | Pagination and retry conventions baked in | | No agent metadata | MCP-ready command metadata in the same manifest |


From spec to commands in a few steps

beltline api import ./openapi.yaml
beltline generate resource projects
beltline generate resource deployments
beltline generate command incidents open

Generated CLI:

acme projects list
acme deployments get dep_123 --json
acme incidents open --service billing-api --severity high

Example output:

ID SERVICE STATUS AGE
dep_123 billing-api failed 4m
dep_122 web success 18m

Same call with --json returns a stable envelope that scripts and agents can rely on.


What Beltline handles for you

Import operations Point Beltline at the OpenAPI spec. It reads paths, operations, parameters, and schemas to understand what the API can do.

Group commands into resources Operations on /deployments become acme deployments list, acme deployments get, acme deployments rollback. Consistent naming across every resource.

Add human-friendly names Override command names, flag names, and descriptions in the manifest without touching generated code. The spec is the source; the manifest is the tuning layer.

Generate examples and docs Help text, usage examples, and reference docs are generated from the same definitions. They stay accurate without being maintained separately.

Reuse the same operations for MCP and automation The commands generated from OpenAPI also become MCP tools and Zapier actions. One import, three surfaces.


Frequently asked questions

Does Beltline replace SDK generators? No. Beltline wraps the API client in a command surface: auth, output formatting, retries, examples, agent metadata, and automation adapters. Use it alongside generated clients.

Can I rename generated commands? Yes. Manifest overrides cover command names, flags, descriptions, and confirmation rules without touching the underlying generated code.

Can I hide unsafe operations? Yes. Exclude specific operations from generation, or mark write operations as confirmation-required so agents cannot run them blindly.

Do I need a complete OpenAPI spec? No. Beltline can import partial specs and supplement them with manually defined commands in the manifest.

Ready to ship a production CLI?

Other features