---
title: "Get Started"
description: "Get started with @hey-api/openapi-ts."
url: "https://heyapi.dev/docs/openapi/typescript/get-started"
---

[@hey-api/openapi-ts](https://github.com/hey-api/openapi-ts) generates TypeScript code from OpenAPI specifications. Point it at your spec, pick your plugins, and get production-grade code in seconds.

Used by companies like Vercel, OpenCode, and PayPal.

> *“OpenAPI codegen that just works.”*
>
> — Guillermo Rauch, CEO of Vercel

### Demo

[Section titled “Demo”](#demo)

Launch demo

## Features

[Section titled “Features”](#features)

* production-grade code that compiles
* runs in any Node.js 22+ 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](https://heyapi.dev/openapi-ts/integrations) for spec management

## Quick Start

[Section titled “Quick Start”](#quick-start)

The fastest way to use `@hey-api/openapi-ts` is via npx

```sh
npx @hey-api/openapi-ts -i hey-api/backend -o src/client
```

Congratulations on creating your first client! 🎉 You can learn more about the generated files on the [Output](https://heyapi.dev/openapi-ts/output) page.

## Installation

[Section titled “Installation”](#installation)

You can download `@hey-api/openapi-ts` from npm using your favorite package manager.

* npm

  ```sh
  npm install @hey-api/openapi-ts -D -E
  ```

* pnpm

  ```sh
  pnpm add @hey-api/openapi-ts -D -E
  ```

* yarn

  ```sh
  yarn add @hey-api/openapi-ts -D -E
  ```

* bun

  ```sh
  bun add @hey-api/openapi-ts -D
  ```

### Versioning

[Section titled “Versioning”](#versioning)

This package is in [initial development](https://semver.org/#spec-item-4). Please pin an exact version so you can safely upgrade when you’re ready.

We publish [migration notes](https://heyapi.dev/openapi-ts/migrating) for every breaking release. You might not be impacted by a breaking change if you don’t use the affected features.

## Usage

[Section titled “Usage”](#usage)

### CLI

[Section titled “CLI”](#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.

package.json

```json
"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](https://heyapi.dev/openapi-ts/configuration) file and move our options from Quick Start to it.

### Node.js

[Section titled “Node.js”](#nodejs)

You can also generate output programmatically by calling `createClient()` in a JavaScript/TypeScript file.

script.ts

```ts
import { createClient } from '@hey-api/openapi-ts';


createClient({
  input: 'hey-api/backend', // sign up at app.heyapi.dev
  output: 'src/client',
});
```

### Vite

[Section titled “Vite”](#vite)

If you’re using [Vite](https://vite.dev) 5, 6, 7, or 8, you can integrate `@hey-api/openapi-ts` directly into your build pipeline with `@hey-api/vite-plugin`. Install it alongside the main package:

* npm

  ```sh
  npm install @hey-api/vite-plugin -D -E
  ```

* pnpm

  ```sh
  pnpm add @hey-api/vite-plugin -D -E
  ```

* yarn

  ```sh
  yarn add @hey-api/vite-plugin -D -E
  ```

* bun

  ```sh
  bun add @hey-api/vite-plugin -D
  ```

Then add the plugin to your Vite configuration:

vite.config.ts

```ts
import { heyApiPlugin } from '@hey-api/vite-plugin';
import { defineConfig } from 'vite';


export default defineConfig({
  plugins: [
    heyApiPlugin({
      config: {
        input: 'hey-api/backend', // sign up at app.heyapi.dev
        output: 'src/client',
      },
    }),
  ],
});
```

See the [Vite](https://heyapi.dev/openapi-ts/configuration/vite) page for full configuration options.

### Configuration

[Section titled “Configuration”](#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](https://heyapi.dev/openapi-ts/configuration) page.

## Examples

You can view live examples on [StackBlitz](https://stackblitz.com/orgs/github/hey-api/collections/openapi-ts-examples) or on [GitHub](https://github.com/hey-api/openapi-ts/tree/main/examples).
