Get Started
@hey-api/openapi-ts generates TypeScript code from OpenAPI specifications. Point it at your spec, pick your plugins, and get production-ready code in seconds.
Used by companies like Vercel, OpenCode, and PayPal.
“OpenAPI codegen that just works.”
— Guillermo Rauch, CEO of Vercel
Demo
Features
- production-ready code that compiles
- runs in any Node.js 20+ environment
- accepts any OpenAPI specification
- core plugins for SDKs, types, and schemas
- HTTP clients for Fetch API, Angular, Axios, Next.js, Nuxt, and more
- 20+ plugins to reduce third-party boilerplate
- highly customizable via plugins
- sync with Hey API Registry for spec management
Quick Start
The fastest way to use @hey-api/openapi-ts is via npx
npx @hey-api/openapi-ts -i hey-api/backend -o src/clientCongratulations on creating your first client! 🎉 You can learn more about the generated files on the Output page.
Installation
You can download @hey-api/openapi-ts from npm using your favorite package manager.
npm install @hey-api/openapi-ts -D -Epnpm add @hey-api/openapi-ts -D -Eyarn add @hey-api/openapi-ts -D -Ebun add @hey-api/openapi-ts -D -EVersioning
This package does NOT follow the semantic versioning strategy. Please pin an exact version so you can safely upgrade when you're ready.
Due to the nature of the package, we use the following versioning strategy.
1.x.x: significant breaking changes, reserved for v1 releasex.1.x: breaking changesx.x.1: new features, bug fixes, and non-breaking changes
We publish migration notes for every breaking release. You might not be impacted by a breaking release if you don't use the affected plugin(s).
Usage
CLI
Most people run @hey-api/openapi-ts via CLI. To do that, add a script to your package.json file which will make openapi-ts executable through script.
"scripts": {
"openapi-ts": "openapi-ts"
}The above script can be executed by running npm run openapi-ts or equivalent command in other package managers. Next, we will create a configuration file and move our options from Quick Start to it.
Node.js
You can also generate output programmatically by calling createClient() in a JavaScript/TypeScript file.
import { createClient } from '@hey-api/openapi-ts';
createClient({
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: 'src/client',
});Configuration
It's a good practice to extract your configuration into a separate file. Learn how to do that and discover available options on the Configuration page.
Examples
You can view live examples on StackBlitz.
Sponsors
Hey API is sponsor-funded. If your team relies on Hey API in production, consider becoming a sponsor to accelerate the roadmap.
Gold

Best-in-class developer interfaces for your API.
stainless.comThe open source coding agent.
opencode.ai
