oapi-codegen
oapi-codegen is a free, open-source command-line tool and Go library that converts OpenAPI specifications into Go server implementations, API clients, and HT…
What oapi-codegen is
oapi-codegen is a free, open-source command-line tool and Go library that converts OpenAPI specifications into Go server implementations, API clients, and HTTP models. It supports OpenAPI 3.0 and 3.1, including 3.1 webhooks and nullable forms, but not OpenAPI 2.0 (Swagger). Server boilerplate targets Chi, Echo, Echo v5, Fiber, Fiber v3, Gin, gorilla/mux, Iris, and net/http. Strict generation handles multiple media types and status codes, form requests, marshaling, and response headers. Generated clients can use a custom HTTP client and return raw responses or parsed data. Large specifications can be split across packages through import mapping or external references. Go templates and supported extensions customize generated output. YAML configuration includes a JSON Schema, and the CLI and format are classed as stable. Installation works as a Go tool or binary and with go:generate. Building requires Go 1.25 or newer.
Good
- Generates Go servers, clients, and HTTP models
- Supports OpenAPI 3.0 and 3.1
- Targets many Go server frameworks
- Allows template and extension customization
- Can split large specifications across packages
Watch out
- Does not support OpenAPI 2.0
- Building requires Go 1.25 or newer
- Only latest minor release gets active support
- Maintainer support is best-efforts
Who it suits
oapi-codegen suits Go developers generating servers, clients, and models from OpenAPI 3 specifications. It is useful for projects needing customizable templates, package splitting, and command-line automation.
Verdict
oapi-codegen is a flexible OpenAPI-to-Go generator with broad framework support and customizable output. Check its OpenAPI version requirement and release-support policy before adopting it.
Plans and prices
From oapi-codegen's own pricing page, checked 4 Oct 2026.
| Plan | Price | What it gives you |
|---|---|---|
| Open source | Free | OpenAPI-to-Go code generation; Go 1.25+ required to build and install |
The facts
Each one read from oapi-codegen's own pages, with the date it was checked.
What it does
- Compatibility limits
- Only the latest minor release receives active development support, bug fixes are not backported, and some imported package internals and template overrides are described as unstable.checked 4 Oct 2026
- Configuration
- The tool uses YAML configuration and provides a JSON Schema for editor suggestions; its command-line interface and configuration format are classed as stable.checked 4 Oct 2026
- Customization
- Generated Go templates can be overridden, and supported OpenAPI extensions can customize generated types, names, JSON behavior, and struct tags.checked 4 Oct 2026
- Generated clients
- Generated clients can use a custom HTTP client and can return either a raw HTTP response or parsed response data.checked 4 Oct 2026
- Integrations
- It can be installed as a Go tool or binary and used with go:generate; the project also documents Renovate for updating a pinned configuration schema.checked 4 Oct 2026
- Large specifications
- The tool can split large OpenAPI specifications across multiple Go packages using import mapping or external references.checked 4 Oct 2026
- OpenAPI support
- It supports OpenAPI 3.0 and 3.1, including 3.1 webhooks and nullable type forms; it does not support OpenAPI 2.0 (Swagger).checked 4 Oct 2026
- Purpose
- oapi-codegen is a command-line tool and library that converts OpenAPI specifications into Go server implementations, API clients, and HTTP models.checked 4 Oct 2026
- Requirements
- Building and installing oapi-codegen requires Go 1.25 or newer; generated code can have lower Go version requirements depending on the server backend.checked 4 Oct 2026
- Security
- The project links to an organizational security policy and says it may make breaking changes if needed to respond to a security vulnerability.checked 4 Oct 2026
- Server generation
- It generates server boilerplate for Chi, Echo, Echo v5, Fiber, Fiber v3, Gin, gorilla/mux, Iris, and net/http.checked 4 Oct 2026
- Strict server
- Strict server generation supports multiple request and response media types and status codes, form requests, automatic marshaling, and response status and content-type handling.checked 4 Oct 2026
- Support
- The maintainers describe support as best-efforts because they work on the project during off hours from their jobs.checked 4 Oct 2026
Alternatives to oapi-codegen
- 1
Fern
Free planOpen sourceWebAPILinuxmacOS7.8Free plan - 2

Supabase
Free planAndroidiOSWebAPI7.6From $25 a month - 3
Swagger Codegen
Free planOpen sourceWebAPILinuxmacOS7.6Free plan - 4

Xano
Free planAndroidiOSWebAPI7.5From $85 a month - 5

Hasura
Free planWebAPILinuxSelf-hosted6.9Free plan - 6

PocketBase
Free planAndroidiOSWebAPI6.9Free plan
