openapi-typescript

Generate TypeScript types from OpenAPI 3.x specs with zero runtime overhead. Unlike openapi-generator (which generates a full SDK), openapi-typescript generates only TypeScript type definitions — no HTTP client code. Use with openapi-fetch (companion package) for a type-safe fetch wrapper, or use generated types manually. Supports OpenAPI 3.0, 3.1, and AsyncAPI schemas. Extremely fast generation via native TypeScript.

Evaluated Mar 06, 2026 (0d ago) v6+
Homepage ↗ Repo ↗ Developer Tools openapi typescript code-generation types api-client
⚙ Agent Friendliness
68
/ 100
Can an agent use this?
🔒 Security
90
/ 100
Is it safe for agents?
⚡ Reliability
79
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
88
Error Messages
82
Auth Simplicity
100
Rate Limits
100

🔒 Security

TLS Enforcement
90
Auth Strength
90
Scope Granularity
90
Dep. Hygiene
88
Secret Handling
90

Local code generation — no security concerns. Generated types improve security by catching API contract violations at compile time.

⚡ Reliability

Uptime/SLA
85
Version Stability
78
Breaking Changes
72
Error Recovery
82
AF Security Reliability

Best When

You want compile-time TypeScript types from your OpenAPI spec without a generated HTTP client — lightweight type safety with your own HTTP library.

Avoid When

You need a complete generated SDK with built-in HTTP client, auth, and retry logic — use openapi-generator instead.

Use Cases

  • Generate TypeScript types from OpenAPI specs for type-safe API clients without runtime SDK overhead
  • Keep TypeScript type definitions in sync with API specs automatically in CI — regenerate types on spec changes
  • Build type-safe API clients using openapi-fetch companion package that validates request/response types against OpenAPI spec
  • Type-check API response handling in TypeScript agent code against the OpenAPI contract
  • Generate types for internal microservice APIs to ensure consumers use correct request/response shapes

Not For

  • Full SDK generation with built-in HTTP client — use openapi-generator for multi-language SDK generation with retry logic, auth, etc.
  • OpenAPI 2.0 (Swagger) specs — openapi-typescript focuses on OpenAPI 3.x
  • Runtime request validation — generated types are compile-time only; use zod-openapi or ajv for runtime validation

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

No authentication — local code generation tool.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

MIT-licensed open source tool.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

Known Gotchas

  • openapi-typescript v6 output format changed significantly from v5 — generated types use different patterns; regenerate and update consuming code after major version upgrade
  • Generated types reference each other by path schema keys — using the types requires understanding the generated schema structure ($defs, paths, components)
  • Circular schema references in OpenAPI specs produce TypeScript recursive types — may cause slow TypeScript compilation for very deep circular schemas
  • openapi-fetch companion package is required for the full type-safe client experience — without it, generated types are useful but require manual wiring
  • Remote spec URLs require internet access at generation time — cache local copies for offline CI builds
  • Discriminated union schemas in OpenAPI (oneOf with discriminator) may not produce ideal TypeScript union types — manual type narrowing may be needed

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for openapi-typescript.

$99

Scores are editorial opinions as of 2026-03-06.

5208
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered