Getting Started

The Speakeasy CLI provides access to features of the Speakeasy Platform. This CLI supports an interactive mode. Simply type speakeasy in you terminal for a guided setup and usage experience.

Install

In your terminal, run:


brew install speakeasy-api/homebrew-tap/speakeasy

Authenticate

Authenticate with the Speakeasy platform to use the Speakeasy CLI:


speakeasy auth login

A browser window will open. Log in to the Speakeasy Platform and create a workspace (or select a workspace if you have previously used the platform) by following the prompts.

When you are redirected to your workspace, Speakeasy will generate an API key for you. Return to the terminal, and you should see a message that you are authenticated.

Run

When you have installed the Speakeasy CLI, get your OpenAPI spec and generate an SDK with a single command:


speakeasy generate sdk -s openapi.yaml -o ./sdks/go/ -l go

Getting started is that easy.

For the full set of CLI commands, type speakeasy -h.

CLI Commands

Below are the available flags for the speakeasy generate sdk command:


-y, --auto-yes auto answer yes to all prompts
-d, --debug enable writing debug files with broken code
-h, --help help for sdk
-i, --installationURL string the language specific installation URL for installation instructions if the SDK is not published to a package manager
-l, --lang string language to generate sdk for (available options: [go, java, php, python, ruby, terraform, typescript]) (default "go")
-o, --out string path to the output directory
-p, --published whether the SDK is published to a package manager or not, determines the type of installation instructions to generate
-r, --repo string the repository URL for the SDK, if the published (-p) flag isn't used this will be used to generate installation instructions
-b, --repo-subdir string the subdirectory of the repository where the SDK is located in the repo, helps with documentation generation
-s, --schema string path to the openapi schema (default "./openapi.yaml")

Feature Documentation

You can modify your OpenAPI spec to customize the SDKs that Speakeasy generates for you. Below are the available features:

Recommended Changes

Group related methods into namespaces

Rename methods to be more idiomatic

Add retries to your SDK

Flatten request parameters

Rename enums

Optional Changes

Define global parameters

Configure your server at runtime

Use a Custom HTTP Client

Add webhooks to your SDK

CI/CD

To use the CLI in a CI/CD pipeline, you can authenticate it by creating an API key in the Speakeasy Platform and then setting the SPEAKEASY_API_KEY environment variable to the value of the API key in your pipeline.