{"templateId":"markdown","versions":[{"version":"v1","label":"1.x (archive)","link":"/docs/cli/v1/commands/generate-client","default":false,"active":false,"folderId":"6f4800fc"},{"version":"v2","label":"2.x (current)","link":"/docs/cli/commands/generate-client","default":true,"active":true,"folderId":"6f4800fc"}],"sharedDataIds":{"sidebar":"sidebar-docs-cli.sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"redocly_category":"Redocly CLI","type":"markdown"},"seo":{"title":"generate-client","description":"OpenAPI-generated documentation tool with 24k+ stars on Github - make APIs your company's superpower.","siteUrl":"https://redocly.com","image":"/assets/redocly-card.f670aae34a39545a5ea633a540cb3a4a333a1f23bb2ed3c4a1b17a5fbcf0ac85.db81178d.png","lang":"en-US"},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"generate-client","__idx":0},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["generate-client"]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning","name":"Experimental"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["generate-client"]}," is an experimental feature: its flags, generated output, configuration schema, and custom-generator API may change in any minor release until it's stable."," ","We'd love your feedback while we stabilize it."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"introduction","__idx":1},"children":["Introduction"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["generate-client"]}," command generates a typed TypeScript client from an OpenAPI 3.x description."," ","Swagger 2.0 descriptions are also accepted and normalized to the 3.x shape before generation."," ","The description is validated first: unresolved ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["$ref"]},"s or structural errors fail generation with the problems listed, independent of your lint configuration."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The generated client has zero runtime dependencies by default — it uses only web-standard APIs (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["fetch"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AbortController"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["URLSearchParams"]},"), so it runs in browsers, Node, Bun, Deno, and edge runtimes."," ","By default it emits a single self-contained file with inline types and one async function per operation."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<api>"]}," argument is a file path, a URL, or an ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/cli/configuration"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["apis:"]}," alias"]},", resolved the same way as in other commands such as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["bundle"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["lint"]},"."," ","An alias, or a path matching an api's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["root"]},", uses that api's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client"]}," block and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["clientOutput"]},"; an unmatched path or URL uses the top-level ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client"]}," defaults."," ","With no argument, a client is generated for every api that declares a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client"]}," block or a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["clientOutput"]}," (see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/cli/configuration/reference/client"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client"]}," configuration"]},")."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This page covers running the command; for the generated client's runtime API (auth, error handling, middleware, retries, and the add-on generators), see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/cli/guides/use-generated-client"},"children":["Use the generated client"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"usage","__idx":2},"children":["Usage"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"redocly generate-client\nredocly generate-client <api>\nredocly generate-client <api> [--output=<path>] [--output-mode=<mode>] [--runtime=<mode>]\nredocly generate-client <api> [--generator=<name>] [--args-style=<style>] [--error-mode=<mode>]\nredocly generate-client <api> [--config=<path>]\nredocly generate-client [--help] [--version]\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"options","__idx":3},"children":["Options"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Option"},"children":["Option"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["api"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["OpenAPI description file path, URL, or an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["apis:"]}," alias. Omit it to generate for every api that has a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client"]}," block or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["clientOutput"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--output"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["-o"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Output path (must end in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".ts"]},"); the entry file in multi-file modes. Defaults to the api's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["clientOutput"]},", else ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<name>.client.ts"]}," next to the configuration file. Single-API invocations only."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--output-mode"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["File layout. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#choose-an-output-mode"},"children":["Choose an output mode"]},". ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Possible values:"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["single"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["split"]},". Default value is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["single"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--runtime"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Where the client's engine lives. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#choose-a-runtime"},"children":["Choose a runtime"]},". ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Possible values:"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["inline"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["package"]},". Default value is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["inline"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--import-ext"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Extension in generated relative imports. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/cli/guides/use-generated-client#run-with-node-directly"},"children":["Run with Node directly"]},". ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Possible values:"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["js"]}," (the tsc/bundler convention), ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ts"]}," (for Node's built-in type stripping). Default value is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["js"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--generator"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["[string]"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Generator to run — a built-in name (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tanstack-query"]}," also has ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["-vue"]},"/",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["-svelte"]},"/",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["-solid"]}," variants) or a custom generator's path or package; repeat the flag to run several. Default value is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sdk"]},". See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/cli/guides/use-generated-client#generators"},"children":["Generators"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--args-style"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["How operation inputs are passed. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/cli/guides/use-generated-client#argument-style"},"children":["Argument style"]},". ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Possible values:"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["flat"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["grouped"]},". Default value is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["flat"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--error-mode"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["How operations report HTTP errors. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/cli/guides/use-generated-client#error-handling"},"children":["Error handling"]},". ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Possible values:"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["throw"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result"]},". Default value is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["throw"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--date-type"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Type of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["date"]},"/",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["date-time"]}," fields; pair ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Date"]}," with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transformers"]}," generator. ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Possible values:"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Date"]},". Default value is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--mock-data"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Data mode for the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mock"]}," generator. ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Possible values:"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["static"]}," (deterministic literals), ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["faker"]}," (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["@faker-js/faker"]}," calls). Default value is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["static"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--mock-seed"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["number"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Seed for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["faker"]},"-mode mocks, for reproducible data. Ignored in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["static"]}," mode."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--server-url"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Override the server URL included in the client as its default. Accepts an absolute (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://api.example.com"]},") or relative (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v1"]},") URL. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["servers[0].url"]},". The app can also repoint the client at runtime — ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["createClient({ serverUrl })"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["configure({ serverUrl })"]},", see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/cli/guides/use-generated-client#authentication"},"children":["Authentication"]}," in the usage guide."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--setup"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Path to a publisher setup module that gets included in the client — pre-configure defaults such as the server URL, retries, headers, and middleware, so a published SDK ships with them built in. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/cli/guides/customize-client-generation#publisher-defaults"},"children":["Publisher defaults"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--config"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Specify path to the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#generate-from-the-configuration-file"},"children":["configuration file"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--help"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["boolean"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Show help."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--version"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["boolean"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Show version number."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"examples","__idx":4},"children":["Examples"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"generate-from-the-configuration-file","__idx":5},"children":["Generate from the configuration file"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Instead of passing flags every time, keep the settings in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redocly.yaml"]}," under a top-level ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client"]}," block and per-API ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["apis.<name>.client"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["clientOutput"]}," — see the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/cli/configuration/reference/client"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client"]}," configuration reference"]}," for the fields."," ","CLI flags take precedence over the configuration."," ","Auto-pagination has no CLI flag; it's declared only as ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/cli/configuration/reference/client#pagination-object"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client.pagination"]}]}," configuration or the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["x-redocly-pagination"]}," operation extension."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"yaml","header":{"controls":{"copy":{}}},"source":"client:\n  generators:\n    - sdk\napis:\n  cafe:\n    root: ./openapi.yaml\n    clientOutput: ./src/api/client.ts\n","lang":"yaml"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"redocly generate-client            # every api with a `client` block or `clientOutput`\nredocly generate-client cafe       # just the `cafe` api\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"generate-from-a-file-path-or-url","__idx":6},"children":["Generate from a file path or URL"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["An unmatched path or URL uses the top-level ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client"]}," defaults; ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--output"]}," names the entry file:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"redocly generate-client openapi.yaml --output dist/client.ts\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"choose-an-output-mode","__idx":7},"children":["Choose an output mode"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--output-mode"]}," controls how the client is split across files:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["single"]}," (default) — one file (self-contained with the default ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["inline"]}," runtime)."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["split"]}," — two files: the schema types and type guards move to a sibling ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<name>.schemas.ts"]},", and the entry file re-exports them, so your imports are the same as in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["single"]},"."]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"redocly generate-client openapi.yaml -o src/api/client.ts --output-mode split\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Both modes work with both runtimes."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"choose-a-runtime","__idx":8},"children":["Choose a runtime"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--runtime"]}," controls where the client's engine (request building, auth, retries, middleware, SSE) lives:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["inline"]}," (default) — the runtime source is embedded in the generated output (only the parts your API needs): self-contained, zero runtime dependencies."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["package"]}," — the generated file imports the runtime from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["@redocly/client-generator"]}," and contains only the types, operation descriptors, and thin call wrappers."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Choose ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["package"]}," when you want engine fixes to arrive via ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["npm update @redocly/client-generator"]}," with no regeneration; the consuming app must then have that package installed as a regular dependency."," ","Your application code is identical in both modes."," ","See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/cli/guides/use-generated-client#package-runtime"},"children":["Package runtime"]}," in the usage guide and the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/Redocly/redocly-cli/tree/main/tests/e2e/generate-client/examples/package-runtime"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["package-runtime"]}," example"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"resources","__idx":9},"children":["Resources"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/cli/guides/use-generated-client"},"children":["Use the generated client"]}," — the runtime API and the add-on generators."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/cli/configuration/reference/client"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client"]}," configuration"]}," — the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redocly.yaml"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client"]}," block."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/cli/commands/lint"},"children":["Lint command"]}," to validate your API description before generating a client."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/cli/commands/bundle"},"children":["Bundle command"]}," to combine a multi-file description into a single input file."]}]}]},"headings":[{"value":"generate-client","id":"generate-client","depth":1},{"value":"Introduction","id":"introduction","depth":2},{"value":"Usage","id":"usage","depth":2},{"value":"Options","id":"options","depth":2},{"value":"Examples","id":"examples","depth":2},{"value":"Generate from the configuration file","id":"generate-from-the-configuration-file","depth":3},{"value":"Generate from a file path or URL","id":"generate-from-a-file-path-or-url","depth":3},{"value":"Choose an output mode","id":"choose-an-output-mode","depth":3},{"value":"Choose a runtime","id":"choose-a-runtime","depth":3},{"value":"Resources","id":"resources","depth":2}],"frontmatter":{"seo":{"title":"generate-client"}},"lastModified":"2026-07-30T09:50:35.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/cli/commands/generate-client","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}