
How do I get started with Speakeasy to generate a TypeScript SDK from our OpenAPI spec?
Most teams don’t get stuck writing TypeScript—they get stuck turning a fast-moving OpenAPI spec into a TypeScript SDK that actually stays in sync. Speakeasy is built to solve that exact failure mode: you point it at your spec, it generates a type-safe, idiomatic SDK, and then it keeps that SDK updated every time your API changes.
Quick Answer: You install the Speakeasy CLI, point it at your OpenAPI spec, and generate a TypeScript SDK by choosing TypeScript as the target. From there, you customize with guardrails and wire it into CI so your SDK updates with every commit.
Quick Answer: To get started, install the Speakeasy CLI, upload or reference your OpenAPI spec, and generate a TypeScript SDK using either the CLI or the Speakeasy web app.
Frequently Asked Questions
How do I start generating a TypeScript SDK from my OpenAPI spec with Speakeasy?
Short Answer: Install the Speakeasy CLI, provide your OpenAPI spec, and run the generation workflow targeting TypeScript. You’ll get a production-ready, type-safe SDK you can publish to your package registry.
Expanded Explanation:
The starting point is always your OpenAPI spec. Speakeasy uses that as the source of truth to generate an idiomatic TypeScript SDK with full type coverage, pagination, retries, and authentication already wired up. Once you’ve installed the Speakeasy CLI, you can either upload the spec in the web app (app.speakeasy.com) or reference it locally/over HTTP in the CLI. From there, you select TypeScript as the language and Speakeasy generates the SDK code, tests, and documentation scaffolding so your team can start consuming your API via TypeScript instead of hand-rolled HTTP calls.
Because TypeScript is a first-class target, Speakeasy leans into strong typing, clear method signatures, and predictable error shapes. The result is a TypeScript SDK that feels like it was written by a senior engineer on your team, but updates automatically when your OpenAPI spec changes.
Key Takeaways:
- Start from your OpenAPI spec; Speakeasy treats it as the single source of truth.
- Use the Speakeasy CLI or web app to generate a fully typed, idiomatic TypeScript SDK in minutes.
What’s the step-by-step process to generate a TypeScript SDK from an OpenAPI spec?
Short Answer: Install the CLI, validate your OpenAPI spec, generate the TypeScript SDK, and then publish it where your developers expect it (e.g., a private npm registry) with CI handling future updates.
Expanded Explanation:
The generation workflow is intentionally simple: you install the Speakeasy CLI, log in, and point it at your OpenAPI spec. Speakeasy validates the spec, infers models and operations, and then builds a TypeScript SDK that’s ready to check into Git and publish as an npm package. Once the first version is in place, you wire the same commands into your CI pipeline so every API change produces a fresh SDK via pull request instead of a manual effort.
This is where Speakeasy’s “APIs change fast. Your SDKs should too.” idea becomes real: the same workflow you use on day one is the workflow your CI uses on day N. No bespoke scripts, no guessing what changed.
Steps:
- Install the Speakeasy CLI
- On macOS (Homebrew):
brew install speakeasy-api/tap/speakeasy - Or install via script/Winget/Chocolatey as documented at
https://docs.speakeasyapi.devafter you sign up.
- On macOS (Homebrew):
- Prepare and validate your OpenAPI spec
- Ensure your OpenAPI/Swagger spec is available locally or via URL.
- Run it through your existing linters/validators; Speakeasy will also validate the spec before generation.
- Generate the TypeScript SDK
- Use the Speakeasy CLI or app to:
- Upload or reference the spec.
- Choose TypeScript as the target language.
- Run the generation workflow to produce the SDK codebase.
- Use the Speakeasy CLI or app to:
- Review and customize (with guardrails)
- Inspect the generated TypeScript code, models, and docs.
- Apply overlays or hooks if you need custom behavior (e.g., extra helpers, internal-only endpoints).
- Publish and automate updates
- Commit the SDK to GitHub/GitLab and publish to npm/private registry.
- Add Speakeasy to your CI so each spec change regenerates the SDK and opens a pull request.
How is a Speakeasy TypeScript SDK different from a generic client generator?
Short Answer: A Speakeasy TypeScript SDK is production-grade, idiomatic, and change-aware, while generic generators often produce thin, untyped HTTP wrappers that drift out of sync with your API.
Expanded Explanation:
Generic generators tend to stop at “code compiles.” They rarely produce the kind of ergonomics TypeScript teams actually want: strong typing everywhere, predictable error handling, and thoughtful method naming. They also usually assume you’ll manually re-run them when your API changes—which is exactly how drift creeps in.
Speakeasy’s TypeScript output is designed as if it will be the primary interface to your API: type-safe models driven by your OpenAPI schema, clear method groupings by tag, opinionated pagination and retries, and auth patterns that match real-world production APIs. On top of that, the platform is built around “ship with every commit”—the generation workflow is meant to sit inside CI, not on a single engineer’s laptop. That’s the difference between a one-off codegen and a maintained SDK.
Comparison Snapshot:
- Option A: Generic client generator
- Minimal typing, thin wrappers over fetch/axios.
- Little to no support for pagination, retries, or auth patterns.
- No opinionated workflow for ongoing updates or CI integration.
- Option B: Speakeasy TypeScript SDK
- Idiomatic TypeScript with strong model typing and operation methods.
- Handles OAuth 2.0 flows, pagination, retries, and documentation from your OpenAPI.
- Designed for CI-driven regeneration so the SDK stays in lockstep with your API spec.
- Best for:
- Use a generic generator for quick prototypes.
- Use Speakeasy when you need a TypeScript SDK your team will adopt in production and keep in sync long-term.
How do I implement and use the generated TypeScript SDK in my apps?
Short Answer: After generating the TypeScript SDK, you check it into your repo or publish it to a registry, then import it into your Node.js/TypeScript projects and use the typed client instead of hand-written HTTP calls.
Expanded Explanation:
Once Speakeasy generates your TypeScript SDK, the rest looks like standard TypeScript package workflow. You treat the SDK as its own project: it lives in Git, it has a version, and your applications depend on it via package.json. When the API evolves, your CI regenerates the SDK and your consuming apps get the benefits through normal dependency updates.
In day-to-day development, your engineers interact with the SDK just like any other library: import { Client } from '@your-org/your-api-sdk' and then call client.users.list() instead of manually building URLs, query params, and headers. Types, autocomplete, and documentation comments come along for free, driven directly from your OpenAPI spec.
What You Need:
- A publish strategy for the SDK
- A Git repository (e.g., GitHub) for the generated SDK.
- An npm or private registry to distribute the package to your apps.
- Integration into your stack
- Update your application code to import and use the generated client.
- Optionally add CI checks so SDK changes are tested alongside your apps.
How does this help my team strategically, beyond just generating a TypeScript client once?
Short Answer: Automating a TypeScript SDK from your OpenAPI spec turns your API into a reliable interface that updates with every change, improving developer velocity, consistency, and governance across human devs and AI agents.
Expanded Explanation:
Generating a TypeScript SDK once is useful; using Speakeasy as the “API interface engine” is where the real leverage shows up. When TypeScript is just one of several targets (SDKs in 7+ languages, Terraform providers, CLIs, and MCP servers), you’re no longer fighting fragmented clients. You’ve standardized on a single truth—the OpenAPI spec—and a single workflow for shipping integration surfaces.
Operationally, this means your API team can move faster without leaving consumers behind. Feature ships in the API, spec updates, CI regenerates the TypeScript SDK (plus other language SDKs and tools), and consuming teams upgrade on their own cadence. For AI clients—agents in Cursor, Claude Code, or GitHub Copilot—those same definitions can power MCP servers and “agent-ready” CLIs, so agents and humans share the same guardrails rather than bespoke, untracked integrations.
Why It Matters:
- Fewer integration bugs, more shipping: Developers consume a type-safe SDK instead of rolling fragile HTTP clients, and you upgrade them predictably via versioned packages.
- One API, multiple interfaces, no drift: The same OpenAPI spec drives TypeScript SDKs, other language SDKs, Terraform, CLIs, and MCP tools, all with a workflow built to “ship with every commit.”
Quick Recap
To get started with Speakeasy for a TypeScript SDK, you install the CLI, point it at your OpenAPI spec, and generate an idiomatic, type-safe client that’s ready to publish. The real win is wiring that workflow into CI so the TypeScript SDK evolves automatically with your API, instead of becoming another piece of drift-prone infrastructure. You end up with one source of truth (your OpenAPI spec) feeding the TypeScript SDK your team actually wants to use.