Typed API clients,
straight from your spec.
swagger-typescript-api-es turns OpenAPI 3 and Swagger 2 schemas into a fully typed fetch or axios client with data contracts — one command, zero hand-written types.
npm i -D swagger-typescript-api-esHow it works
Configure once. Regenerate forever.
Point it at your schema, run npx swagger-typescript-api-es, and import a client whose every method is typed end to end.
Features
Everything a real-world API needs
OpenAPI 3.x & Swagger 2
JSON or YAML, from a URL or a local file. Swagger 2.0 is converted to OpenAPI 3 automatically.
fetch or axios
A zero-dependency fetch client by default, or an axios client with interceptors and your own instance.
Modular output
One file, or a split into http-client, data-contracts and one class per route module.
Enums & extraction
Union or TypeScript enums, and extracted types for request params, bodies, responses and errors.
Hooks & templates
Rename types and routes with hooks, or take full control of the output with Eta templates.
Strict types
Every path, query, body and response is typed, so the compiler catches API drift before runtime.
ESM & TypeScript
Written in TypeScript and shipped as ESM only, formatted with the fast oxfmt formatter.
CLI, config or code
Run the CLI, commit a typed swagger-typescript-api.config.ts, or call generateApi() from a script.
Try it on your own schema
Paste a spec, flip options, and download the generated client — right in the browser.