Getting Started
You give us your OpenAPI v3 spec, we give you client SDKs in the most popular languages:
import SDKLanguages from '@site/src/components/docs/SDKLanguages'; import { Callout } from '~/components'
Install
In your terminal, run:
brew install speakeasy-api/homebrew-tap/speakeasy
Authenticate
To use the Speakeasy CLI, you need to authenticate with the Speakeasy Platform.
To do this, run:
speakeasy auth login
This will open a browser window where you can login to the Speakeasy Platform and create or select a workspace (if you have previously used the Platform) by following the prompts. Once logged in you will be redirected to your workspace and an API key will be generated for you. You can then return to the terminal and you should see a message that you are authenticated.
Run
Once installed, 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.
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
There are many additions that can be made to 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.