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

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

> *“The ecosystem trusted by TypeScript developers is coming to Python codebases.”*
>
> — Lubos, Founder of Hey API

## Features

[Section titled “Features”](#features)

* production-grade code that compiles
* runs in any Node.js 22+ environment
* accepts any OpenAPI specification
* core plugin for SDKs
* HTTP client for HTTPX
* highly customizable via plugins
* [sync with Hey API Registry](https://heyapi.dev/docs/openapi/typescript/integrations) for spec management

## Quick Start

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

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

```sh
npx @hey-api/openapi-python -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/docs/openapi/python/output) page.

## Installation

[Section titled “Installation”](#installation)

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

* npm

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

* pnpm

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

* yarn

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

* bun

  ```sh
  bun add @hey-api/openapi-python -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/docs/openapi/python/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-python` via CLI. To do that, add a script to your `package.json` file which will make `openapi-python` executable through script.

package.json

```json
"scripts": {
  "openapi-python": "openapi-python"
}
```

The above script can be executed by running `npm run openapi-python` or equivalent command in other package managers. Next, we will create a [configuration](https://heyapi.dev/docs/openapi/python/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-python';


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

### 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/docs/openapi/python/configuration) page.
