Generate SDKs from OpenAPI
Generating the first SDK with Speakeasy takes no more than a few minutes. Follow these steps to get started.
Sign up for Speakeasy
First, sign up for a free Speakeasy (opens in a new tab) account.
New accounts start with a 14-day free trial of Speakeasy’s business tier, so that users can try out every SDK generation feature. At the end of the trial, accounts will revert to the free tier. No credit card is required.
Free accounts can continue to generate one SDK with up to 50 API methods free of charge.
Install the Speakeasy CLI
After signing up, install the Speakeasy CLI using one of the following methods:
# Homebrew (macOS)brew install speakeasy-api/homebrew-tap/speakeasy
For manual installation, download the latest release from the releases page (opens in a new tab), extract the binary, and add it to the system path.
Run the Speakeasy quickstart command
For first-time SDK generation, run speakeasy quickstart
.
speakeasy quickstart
Authenticate your Speakeasy account using the CLI prompts. Then, in the browser window that opens, select a workspace to associate with the CLI. You can always change workspaces later.
Upload an OpenAPI document
After authentication, the CLI prompts for an OpenAPI document:
Enter either a link to a remote-hosted OpenAPI document or a relative path to a local file in one of the supported formats:
Specification format | Supported |
---|---|
OpenAPI 3.0 | ✅ |
OpenAPI 3.1 | ✅ |
JSON Schema | ✅ |
TIP
If your specification is in an unsupported format, use one of the following tools to convert it:
- Swagger 2.0 -> OpenAPI 3.0 (opens in a new tab): Go to Edit > Convert to OpenAPI 3.0
- Postman -> OpenAPI 3.0 (opens in a new tab)
Specify an SDK name and language
After configuring the OpenAPI document, the CLI prompts for an SDK name. It’s best to name the SDK after the company or project it’s being used for.
The CLI then provides a language selection prompt.
For each supported language, Speakeasy has worked with language experts to craft generators that produce highly idiomatic code. The links below provide more information about the design decisions behind each language implementation:
Supported generation languages
Specify a package name and output directory
To complete the SDK configuration, set a package name and output directory.
The CLI infers an SDK package name from the OpenAPI document, which can be overwritten if necessary. This package name only becomes relevant when publishing the SDK package.
The CLI then prompts for the output directory for the generated SDK.
Speakeasy validates the specifications and generates the SDK after receiving all inputs. The process executes speakeasy run
to validate, generate, compile, and set up the SDK. Upon successful completion, a confirmation message displays the details of the generated SDK:
Iterate on the SDK
After successful SDK generation, a CLI prompt appears asking to open the SDK in Speakeasy Studio. The Studio is a web GUI that helps improve the look and feel of SDKs. It uses OpenAPI overlays to preserve the original OpenAPI document, while allowing changes to the generated SDK.
Changes saved in the Studio automatically trigger a regeneration of the SDK locally.
Changes can also be made without the Studio. Find all the details in the guide to customizing SDKs.
Next step: Upload your SDK to GitHub
Once the SDK looks good, follow the Speakeasy guide to setting up an SDK on GitHub.