openapi-cli-gen

Generate human-facing Python CLIs from OpenAPI, Swagger, and FastAPI specs. Nested request bodies become dot flags like --address.city NYC.

pipx install openapi-cli-gen

openapi-cli-gen generate \
  --spec https://api.example.com/openapi.json \
  --name mycli

Start Here

Generated CLI Examples

Why This Exists

OpenAPI specs are usually used to generate SDKs, server stubs, and docs. Those are useful, but they are not the only thing a spec can generate.

For support, ops, QA, demos, and internal admin workflows, a terminal command is often the better interface:

mycli users create \
  --name Jane \
  --email jane@example.com \
  --address.city NYC \
  --address.state NY

That is the lane for openapi-cli-gen: not another SDK directory, but commands humans and scripts can run.

Feedback Wanted

The most useful feedback is a real OpenAPI spec that makes generated CLIs awkward: unusual auth, nested bodies, arrays of objects, multipart uploads, unions, or very large schemas.

Open a spec compatibility report or start from the GitHub repository.