The best OpenAPI TypeScript client generator depends on what you want to own. Pick openapi-typescript + openapi-fetch for types with a 2.8 KB runtime, Hey API for a full SDK that generated fastest in our run, Kubb v5 for the widest plugin set (hooks, Zod, Faker, MSW), and Orval for TanStack Query hooks across five frameworks with plain fetch.
We ran all four on GitHub’s public REST spec (1,281 operations), type-checked every output, and bundled one call from each. The numbers below are ours.
OpenAPI TypeScript client generator comparison at a glance
| Kubb | Hey API | Orval | openapi-typescript | |
|---|---|---|---|---|
| Version tested | 5.26.0 | 0.99.0 | 8.49.0 | 7.13.0 + openapi-fetch 0.17.0 |
| What it emits | Types, fetch/axios client, hooks, Zod, Faker, MSW | Types, SDK, 7 HTTP clients, hooks, Zod/Valibot | Typed functions, hooks, Zod, mocks | One .d.ts file of types |
| Config file | kubb.config.ts |
openapi-ts.config.ts |
orval.config.ts |
CLI flags |
| Generate time, 1,281 ops | 4.1 to 5.5 s | 3.1 to 3.3 s | 5.0 to 6.1 s | 2.4 to 3.0 s |
tsc --strict errors |
0 | 0 | 1 | 0 |
| Runtime for one GET (gzip) | 6.7 KB | 4.2 KB | 0.4 KB | 2.8 KB |
| License | MIT | MIT | MIT | MIT |
All four are MIT-licensed and need Node.js 22 or later, except openapi-typescript, which doesn’t pin an engine on npm.
How we tested the four generators
We used GitHub’s REST API description (OpenAPI 3.0.3, 1,281 operations, 1,016 schemas): large, real and full of edge cases like binary uploads and discriminators.
Each tool ran three times on a MacBook with Node.js 24.15.0, set up for types plus a fetch client (openapi-typescript emits types only). Times are wall clock, including npx startup.

| Generator | Files | Lines | Size on disk |
|---|---|---|---|
| Kubb | 3,597 | 320,850 | 22 MB |
| Hey API | 16 | 157,077 | 6.0 MB |
| Orval | 7,949 | 275,989 | 35 MB |
| openapi-typescript | 1 | 156,205 | 7.0 MB |
We compiled every output with TypeScript 5.9.3 (--strict, --skipLibCheck). Three compiled with zero errors. Orval produced one: GitHub’s spec has a schema named blob, Orval generated a Blob model for it, and that import shadowed the global Blob type on the release-asset upload endpoint. One error in 1,281 operations, fixed by a rename, but you only find it on a big spec.
For runtime size, we bundled one getObject call with esbuild (--minify) and gzipped it: what ships to the browser, not what sits in your repo.
The developer comparison on Bluesky that prompted this post tested 1,200 operations and preferred Kubb v5 over Hey API. Different machine, different spec: treat both as signals, not a ranking.
Kubb v5: the plugin platform
Kubb 5.0.0 shipped on 17 August 2026, and the current release is 5.26.0. Version 5 reads OpenAPI 2.0 through 3.2 via @kubb/adapter-oas and generates through plugins you install one by one: types, fetch or axios clients, TanStack Query and SWR hooks, Zod, Faker, MSW, Cypress and MCP.
Setup is the smoothest of the four. One command scaffolds the config, installs the plugins and runs the first generation:
npx kubb init --input ./openapi.json --output ./src/gen \
--plugins plugin-ts,plugin-fetch,plugin-react-query,plugin-zod
On a 5-operation spec that produced 39 files in 310 ms: types/, clients/, hooks/ and zod/, one file per operation, plus a .kubb/ runtime with auth and retry helpers.
What stood out:
kubb generate --checkexits 1 when generated files are out of date: a ready-made CI gate for spec drift.- Clients throw by default. Generated functions default
ThrowOnErrortotrue, so a 404 rejects the promise. - One file per operation keeps diffs small in review, at the cost of 3,597 files on GitHub’s spec.
- Telemetry is on by default. Disable it with
KUBB_DISABLE_TELEMETRY=1.
Hey API: the SDK generator
Hey API (@hey-api/openapi-ts) is still on 0.x, so expect breaking changes between minors, yet it’s the most downloaded SDK-style generator: 8.3 million npm downloads in the week to 24 November 2026.
It ships 7 HTTP clients (Fetch, Axios, Angular, Next.js, Nuxt, ofetch, ky) and plugins for TanStack Query, Pinia Colada, SWR, Zod, Valibot, ArkType, Fastify, NestJS, Faker and MSW.
// openapi-ts.config.ts
import { defineConfig } from '@hey-api/openapi-ts';
export default defineConfig({
input: './openapi.json',
output: 'src/client',
plugins: ['@hey-api/client-fetch', 'zod',
{ name: '@hey-api/sdk', validator: true }, '@tanstack/react-query'],
});
Output is compact: 16 files for all of GitHub’s spec, operations in sdk.gen.ts, types in types.gen.ts, generated in about 3.1 seconds.
Two things to know:
- Clients don’t throw by default.
ThrowOnErrordefaults tofalse, so you check the returnederror. That’s the opposite of Kubb. - Validators cost bytes. With
validator: true, each SDK call parses requests and responses with Zod. Our one-call bundle grew from 4.2 KB to 31 KB gzipped. Turn it on for untrusted APIs, not for every call.
One gotcha: with TypeScript 7.0.2 installed, Hey API crashed at startup (its peer range is >=5.5.3 || >=6.0.0). Installing TypeScript 5 fixed it.
Orval: hooks for every framework
Orval 8.49.0 targets frontend teams. Its client option covers react-query, vue-query, svelte-query, solid-query, angular-query, swr, pinia-colada, angular, axios, fetch, zod, valibot, effect, hono and mcp.
// orval.config.ts
import { defineConfig } from 'orval';
export default defineConfig({
api: {
input: './openapi.json',
output: {
mode: 'split',
target: 'src/api/api.ts',
schemas: 'src/api/model',
client: 'react-query',
httpClient: 'fetch',
override: { query: { version: 5 } },
},
},
});
Orval writes plain fetch calls with no runtime library, which is why one bundled call came to 0.4 KB gzipped. Each function returns { data, status, headers } instead of throwing.
Watch two defaults. If Orval can’t find @tanstack/react-query in your package.json, it generates v4 hooks and warns you; set override.query.version: 5. And on GitHub’s spec it wrote 7,949 files (35 MB), the largest output, because every model gets its own file.
openapi-typescript + openapi-fetch: types only
openapi-typescript takes the smallest bet. It turns the spec into one .d.ts file of paths and components interfaces and generates no functions at all. You call the API through openapi-fetch, a typed wrapper around fetch:
npx openapi-typescript ./openapi.json -o src/api/schema.d.ts
import createClient from 'openapi-fetch';
import type { paths } from './api/schema';
const api = createClient<paths>({ baseUrl: 'https://api.example.com' });
const { data, error } = await api.GET('/objects/{id}', {
params: { path: { id: '42' } },
});
Paths, params and response bodies are type-checked against the spec, and the client weighs 2.8 KB gzipped. It was the fastest generator in our run (about 2.4 seconds) and the most popular: each package passed 18 million npm downloads in the week to 24 November 2026.
The trade-off: you write the call sites yourself, and there’s no Zod or mock output.
Which OpenAPI TypeScript generator should you pick?
| Pick this | If you |
|---|---|
| openapi-typescript + openapi-fetch | Want types and the smallest runtime, and are happy to write call sites |
| Hey API | Want a generated SDK with many HTTP clients and the fastest full-SDK generate |
| Kubb v5 | Want types, client, hooks, Zod, Faker and MSW from one plugin config, plus a --check CI gate |
| Orval | Want TanStack Query or SWR hooks across frameworks with zero client runtime |
If you publish an SDK to external developers in several languages, none of these is the full answer; see our look at Stainless and the multi-language OpenAPI Generator.
Keep the generated client in sync with Apidog CLI
A generator is only as good as the spec you feed it. If your API lives in Apidog, your coding agent can export the current spec, regenerate the client and type-check it, so nobody hand-copies JSON again.
Set up Apidog CLI once:
npm install -g apidog-cli@latest
apidog login --with-token <YOUR_TOKEN>
npx -y skills add https://apidog.com # pick your agent when prompted
Then give Claude Code, Codex or OpenCode one prompt:
Export the OpenAPI 3.0 spec for Apidog project <projectId> to ./openapi.json,
regenerate our TypeScript client with `npx kubb generate`, run `npx tsc --noEmit`,
and summarize which endpoints changed and whether anything failed to compile.
The agent lists the endpoints, exports the spec and hands it to the generator:
apidog endpoint list --project <projectId>
apidog export --project <projectId> --format openapi --oas-version 3.0 --output ./openapi.json
npx kubb generate
npx tsc --noEmit

We ran these commands on a sandbox project: the export produced a 5-operation OpenAPI 3.0.1 file, and all four generators built a client from it. Swap in npx openapi-ts, npx orval or npx openapi-typescript and the loop is the same. Add --branch <branchName> to apidog export to generate against a sprint branch.

For CI, run the same export and then kubb generate --check, which fails the build when the committed client no longer matches the spec. Our Apidog CLI CI/CD guide covers tokens and pipeline setup, and letting an agent update the spec itself covers the other direction.
Once that loop works for one developer, a team can hand it out: Sharkly is a board where you assign tasks like “regenerate the client for the billing API” to coding agents that run on your own machines with your own Claude Code, Codex or OpenCode plan, run several in parallel, and review what they ship before it merges. It’s free to start.
FAQ
What is the best OpenAPI TypeScript client generator in 2026? There’s no single winner: openapi-typescript + openapi-fetch is the lightest, Hey API the fastest full SDK, Kubb v5 the broadest plugin set, and Orval the strongest for TanStack Query hooks.
Is Kubb v5 stable? Yes. Kubb 5.0.0 reached npm on 17 August 2026, and 5.26.0 is the latest stable tag. Plugins version separately (@kubb/plugin-fetch is 6.6.0), so install them through kubb init to get matching versions.
Does openapi-typescript generate a client? No. It generates types only. Pair it with openapi-fetch for a typed fetch client, or openapi-react-query for TanStack Query hooks.
Which generator supports Zod? Kubb (plugin-zod), Hey API (zod plugin, plus Valibot and ArkType) and Orval (client: 'zod'). openapi-typescript does not.
How do I regenerate the client when the API changes? Export the latest spec (for example with apidog export --format openapi), rerun the generator, then type-check. Kubb’s generate --check fails CI when the committed code is stale.
Conclusion
All four generators turned a 1,281-operation spec into TypeScript in under 7 seconds. The real choice is how much code you want generated: a types file, an SDK, a plugin stack or framework hooks. Run your own spec through the two that fit, check the output with tsc --strict, and put the regenerate step in your agent or CI. Our OpenAPI Generator tutorial covers the multi-language route.



