Skip to main content

Generate Client SDKs

Speakeasy provides functionality through our CLI tooling to generate client SDKs from your OpenAPI v3 spec. Currently, we support generating SDKs for the following languages:

  • Golang
  • Python
  • Typescript
  • Java
  • + More to come

The Speakeasy SDK Generator will produce a package in your language of choice that is ready to use and publish on your favourite package registry. We have produced a library of over 4500+ SDKs from a directory of public OpenAPI specs here: https://github.com/speakeasy-api/openapi-directory

cli output

info

Full CLI documentation can be found here.

Our Philosophy

  • We are generating fully typed SDKs that feel like they have been written by a human: easy to read and debug.
  • We will eventually be moving towards a batteries-included model where everything from retries to pagination of your APIs can be configured within the SDK.
  • Our generator tools are designed to be easy to use and always output usable SDKs. In the case we can't output a working SDK, we will validate your OpenAPI spec and alert you to where the problem is.
  • We plan to cover as much of the OpenAPI spec as possible while having a deep focus on the most common ways of defining an API, ensuring you have a nice to use SDK as the output.

How we designed our SDKs

All the SDKs we generate are designed to be as idiomatic to the language they are generated for as possible while being similar enough to each other to allow some familarity between them, but also to allow for an effiecient generation engine that is capabale of supporting many languages. Some of the design decisions we made are listed below:

  • Each of the SDKs generally implement a base SDK class that contains the methods for each of the API endpoints defined in a spec.
  • Where possible we generate fully typed models from the OpenAPI document and seperate those models defined as components in the docs and those that are defined inline with operations.
  • We use reflection metadata where possible to annotate types with the required metadata needed to determine how to serialize and deserialize them, based on the configuration in the OpenAPI document.
  • We generate full packages for each language that should be able to be published to a package registry with little additional work, to get them in your end-users hands as quickly as possible.

If you have any feedback or want to suggest improvements or ask for a new feature please get in contact in the #client-sdks channel in our public Slack.

Getting Started

Install the Speakeasy CLI tool via homebrew:

brew install speakeasy-api/homebrew-tap/speakeasy

Once installed, generate an SDK with a single command:

speakeasy generate sdk -s openapi.yaml --output ./sdk -l go

For documentation on using the SDK generator please see here.

Feature Documentation