Type-safe TypeScript for OpenAPI: generate types from an OpenAPI 3.x schema and call your API with a
fully typed fetch client.
openapi-typesafe is a maintained, drop-in successor to
openapi-typescript and openapi-fetch, whose
author stopped maintaining them in
September 2026. It is a fork with the full upstream history (see NOTICE).
Release candidate. The current version is a 1.0.0 release candidate (
1.0.0-rc.N); names and output can still change before 1.0.0.
- Drop-in. Migrate by changing package names. Generated output and the client API stay compatible.
- TypeScript 7 ready. The generator does not use the TypeScript compiler API, so it works the same on TypeScript 5.4, 6 and 7.
- Verifiably compatible. A public compatibility report compares the output with openapi-typescript on more than 1,800 real-world OpenAPI 3.x schemas. CI runs the full corpus every night; the report is refreshed from that run for every release candidate and every major or minor release, and the GitHub release notes link it.
- Secure releases. Minimal dependencies, npm provenance, no long-lived publish tokens.
- Stable API. Semantic versioning from 1.0.0; Versioning lists what a version promises.
| Package | Replaces | Purpose |
|---|---|---|
openapi-typesafe |
openapi-typescript |
CLI and Node API: OpenAPI 3.0, 3.1 and 3.2 → TypeScript types |
openapi-typesafe-fetch |
openapi-fetch |
Type-safe fetch client for the generated types |
openapi-typesafe-helpers |
openapi-typescript-helpers |
Shared type helpers |
openapi-typesafe-react-query |
openapi-react-query |
TanStack Query bindings |
openapi-typesafe-migrate |
— | Moves a project to the packages above |
All packages share one version (ADR-016).
npx openapi-typesafe ./openapi.yaml -o ./src/api/schema.d.tsimport createClient from "openapi-typesafe-fetch";
import type { paths } from "./api/schema";
const client = createClient<paths>({ baseUrl: "https://api.example.com/v1/" });
const { data, error } = await client.GET("/posts/{post_id}", {
params: { path: { post_id: "123" } },
});Both the request and the response are checked against the schema. There are no manual type annotations.
- Agent skill:
skills/openapi-typesafeteaches an agent the setup, typed calls, error handling, middleware, TanStack Query hooks and the migration from openapi-typescript. It follows the Agent Skills format: copy the directory to.claude/skills/in your project for Claude Code, or to wherever your agent loads skills.tools/skill-evalsmeasures it on 34 coding tasks. llms.txt: the docs site servesllms.txt(an index of every page),llms-full.txt(all pages in one file) and a Markdown copy of each page.
See CONTRIBUTING.md. Project rules are in GOVERNANCE.md and the Code of Conduct. Report vulnerabilities as described in SECURITY.md.
MIT. The original copyright notices of openapi-typescript and openapi-react-query
are preserved. This project is not affiliated with or endorsed by the original authors.