The open source, agent friendly client for generating SDKs, CLIs, docs, and more from your OpenAPI description
One command. One self-contained file. Zero dependencies.
TypeScript, Python, Go, or PHP - regenerate whenever your API changes.
⚗️ Experimental - flags and output may still change. Feedback welcome.
$ npx @redocly/cli@latest generate-client openapi.yaml --output src/client.ts# → src/client.ts - every operation typed, zero dependencies
import { client, listMenuItems, getOrderById } from './client.ts';client.auth.bearer(token);const menu = await listMenuItems({ query: { limit: 10 } });const order = await client.getOrderById({ path: { orderId: 'ord_01khr…' } });
1
command, description to client
0
runtime dependencies
4
languages - TS, Python, Go, PHP
100%
typed - bad calls fail the build
Your API description. A complete SDK
Type-safe by design
Every operation, parameter, and response typed from your description. A bad call fails the build, not production - add zod to catch contract breaks at runtime too.
Production-ready out of the box
Auth from securitySchemes, retries with backoff, typed pagination and SSE streaming, multipart uploads, composable middleware. Nothing to hand-write.
Built for your codebase
Single file or split. Flat or grouped arguments. Throw or typed results. Bake your defaults in with --setup and regenerate reference docs with --docs.
Runs anywhere
OpenAPI 3.0-3.2 or Swagger 2.0 in; TypeScript, Python, Go, or PHP out. Browsers, Node, Bun, Deno, edge - anywhere fetch does.
/ Before → after
Delete the boilerplate
Types alone don't send requests - the client should ship the behavior too.
// Before: types-only generator - you still write all of thisconst url = `${BASE}/orders/${encodeURIComponent(orderId)}`;const res = await fetch(url, {headers: {Authorization: `Bearer ${token}`,Accept: 'application/json',},signal,});if (!res.ok) throw new Error(`HTTP ${res.status}`);const order = (await res.json()) as Order;
// After: generate-client - typed, authed, retried, cancellableconst order = await getOrderById({ path: { orderId } }, { signal });
/ AI-assisted development
Give your agent a client, not a blank editor
Generated code is the cheapest, safest code an AI can ship. One command, the same client every time - the AI-written part of your diff shrinks to intent.
Agents generate it
One tool call replaces ~12,000 tokens of hand-written HTTP plumbing. Deterministic output: nothing lands in review except your logic.
Agents code against it
A hallucinated endpoint or invented field fails the build, not production - the compiler is the agent’s fact-checker. Add zod for the same guardrail at runtime.
Agents test with it
--generator mock emits mocks and seeded factories, so AI-written tests run offline and reproduce exactly.
Put it in your agents file
Tell your coding agent once, in AGENTS.md or CLAUDE.md, and it stops hand-writing fetch code for good.
Publishing an SDK? Pair this with --setup: agents consume your API with your auth, retries, and headers baked in. Nothing to misconfigure.
/ Try it live
A real example,
straight from the repo
This is our zero-install-quickstart example, unedited - client.ts was generated from openapi.yaml by one command. Tweak main.ts and hit Run: it calls the live cafe demo API from your browser.
// zero-install-quickstart — the whole loop: generate → import → call.
//
// `redocly generate-client` turned openapi.yaml into ONE self-contained file
// (src/api/client.ts) with zero runtime dependencies — there is no client
// library to install or keep in sync. Import the generated functions and call.
import { getMenuItemPhoto, listMenuItems } from './api/client.js';
const menu = await listMenuItems({ query: { limit: 3 } });
for (const item of menu.items) {
console.log(`${item.name} — $${(item.price / 100).toFixed(2)}`);
}
const [first] = menu.items;
if (first) {
const photo = await getMenuItemPhoto({
path: { menuItemId: first.id },
query: { photoSize: 'thumbnail' },
});
console.log(
photo instanceof Blob ? `${first.name} photo: ${photo.type}, ${photo.size} bytes` : photo
);
}
api.cafe.redocly.com// hit Run - main.ts executes right here
/ FOR TEAMS THAT SHIP SDKs
Generation is free. Running SDKs is the product
generate-client stays open source and ungated. For teams that publish SDKs, we’re building the pipeline, policy, and visibility around it in Reunite.
How does your company run SDKs?
/ One description. Every artifact.
Add generators with one flag
Each emits its own file - the client stays dependency-free.
typescript(default)fetch clientpython · go · phptanstack-querytransformersDate convertersDateswrzodzodValidation middlewaremockcli--dry-run, and documented exit codesschema prints any operation’s contract as JSONyour generator$ npx @redocly/cli@latest generate-client openapi.yaml -o src/client.ts \--generator python --generator zod --generator cli --generator mock --docs
Docs that never drift
--docs writes a reference page for every generator you select, rendered from the same table the code runs on. codeSamples: true adds an x-codeSamples overlay, so every operation in your Redoc docs shows a snippet that agrees with the SDK.
/ Ownership without the fork
Own the generator, not a fork
Eject any generator as TypeScript you own. Unmodified, it produces the exact same output, while upstream fixes still merge seamlessly.
| Aspect | fork(the old way) | eject-generator |
|---|---|---|
| You get | the whole project, to maintain forever | one readable file per stage, in your repo |
| Upstream fixes arrive via | stop reaching you | --update |
| The design ships as | source code you reverse-engineer | SKILL.md |
| Your agent edits | the generated output, by hand | the generator, never the output |
| Best for | nobody - a fork is a life sentence | house rules - naming, headers, error style (byte-identical until you change it) |
/ Open source
Open source, in the CLI you already know
generate-client ships inside the MIT-licensed Redocly CLI - the same tool that lints and bundles your OpenAPI. No account, no server: it runs on your machine and the code is yours. Redocly’s own apps call our production APIs through clients generated by this exact command.
/ Help us pick
Which language should we add next?
TypeScript, Python, Go, and PHP today. Vote for the next one with a one-click issue.
Frequently asked questions
Your typed client is one command away
One self-contained, zero-dependency file in TypeScript, Python, Go, or PHP. Open source. No account.
$ npx @redocly/cli@latest generate-client openapi.yaml --output src/client.ts