Get Started 
Generate TypeScript interfaces, REST clients, and JSON Schemas from OpenAPI specifications.
Features 
- works with CLI, Node.js, or npx
 - supports OpenAPI 2.0, 3.0, and 3.1 specifications
 - supports both JSON and YAML input files
 - supports external references using json-schema-ref-parser
 - generates TypeScript interfaces, REST clients, and JSON Schemas
 - Fetch API, Axios, Angular, Node.js, and XHR clients available
 - abortable requests through cancellable promise pattern
 
Quick Start 
The fastest way to use openapi-ts is via npx
sh
npx @hey-api/openapi-ts -i path/to/openapi.json -o src/clientCongratulations on creating your first client! 🎉
Installation 
sh
npm install @hey-api/openapi-ts --save-devsh
pnpm add @hey-api/openapi-ts -Dsh
yarn add @hey-api/openapi-ts -Dsh
bun add @hey-api/openapi-ts -DIf you want to use openapi-ts with CLI, add a script to your package.json file
json
"scripts": {
  "openapi-ts": "openapi-ts"
}You can also generate your client programmatically by importing openapi-ts in a .ts file.
ts
import { createClient } from '@hey-api/openapi-ts';
createClient({
  input: 'path/to/openapi.json',
  output: 'src/client',
});WARNING
You need to be running Node.js v18 or newer
Examples 
You can view live examples on StackBlitz.
