Get Started ​
WARNING
This package is in initial development. The interface might change before it becomes stable. We encourage you to leave feedback on GitHub.
@hey-api/openapi-ts is an OpenAPI to TypeScript codegen trusted over 1,750,000 times each month to generate reliable API clients and SDKs. The code is MIT-licensed and free to use. Discover available features below or view our roadmap to learn what's coming next.
Demo ​
Features ​
- runs in CLI, Node.js 18+, or npx
 - works with OpenAPI 2.0, 3.0, and 3.1
 - customizable types and SDKs
 - clients for your runtime (Fetch API, Axios, Next.js, Nuxt, etc.)
 - plugin ecosystem to reduce third-party boilerplate
 - custom plugins and custom clients
 - integration with Hey API Platform
 
Quick Start ​
The fastest way to use @hey-api/openapi-ts is via npx
npx @hey-api/openapi-ts \
  -i https://get.heyapi.dev/hey-api/backend \
  -o src/clientCongratulations on creating your first client! 🎉 You can learn more about the generated files on the Output page.
Installation ​
npm install @hey-api/openapi-ts -Dpnpm add @hey-api/openapi-ts -Dyarn add @hey-api/openapi-ts -Dbun add @hey-api/openapi-ts -DWe recommend pinning an exact version so you can safely upgrade when you're ready. This package is in initial development and its API might change before v1.
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 need to create a configuration file and move our options from Quick Start to it.
Node.js ​
You can also generate clients programmatically by importing @hey-api/openapi-ts in a TypeScript file.
import { createClient } from '@hey-api/openapi-ts';
createClient({
  input: 'https://get.heyapi.dev/hey-api/backend',
  output: 'src/client',
});Configuration ​
It is 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 ​
Love Hey API? Become our sponsor.



