oRPC OpenAPI to Contract

Generate an oRPC contract from an existing OpenAPI specification with Hey API.

ali-master/skills7 installsMITSynced Aug 26

Works with

Claude CodeCursorCodex CLIGitHub CopilotGemini CLI
---
name: oRPC OpenAPI to Contract
description: Generate an oRPC contract from an existing OpenAPI specification with Hey API.
license: MIT
---

# OpenAPI to Contract

If you have an [OpenAPI Specification](https://swagger.io/specification/), use [Hey API](https://heyapi.dev/)'s `orpc` plugin to generate an oRPC contract.

> The Hey API `orpc` plugin is currently beta.

## Example

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

```ts
// openapi-ts.config.ts
import { defineConfig } from '@hey-api/openapi-ts'

export default defineConfig({
  input: 'https://get.heyapi.dev/hey-api/backend',
  output: 'src/client',
  plugins: [
    {
      name: 'orpc',
      validator: { input: 'zod' },
    },
  ],
})
```

Then run:

```sh
npx @hey-api/openapi-ts
```

## What To Do Next

* Implement the contract on your own server with [Implement Contract](/docs/contract-first/implement-contract).
* Create a type-safe client with [OpenAPILink](/docs/openapi/client/openapi-link).
* Use as reference alongside [Define Contract](/docs/contract-first/define-contract).

More API Design skills

← All API Design skills

Check your AI visibility

One URL in, a 0–100 score and the exact fixes out.

RUN THE CHECK

Browse all the tools

15 tools across six categories
13 of them never send your data anywhere

Free · No signup · No trial clock

SEE THE DIRECTORY