@beta. For v3, read the docs in the v3 branch.CLI Options
Options
Section titled “Options”-i, --input
Section titled “-i, --input”The input file path of the OpenAPI schema file. This is a required option.
-o, --output <value>
Section titled “-o, --output <value>”The output directory path for the generated files. The default value is openapi.
--pageParam <value>
Section titled “--pageParam <value>”Name of the query parameter used for pagination (infinite query). The default value is page.
--nextPageParam <value>
Section titled “--nextPageParam <value>”Name of the response parameter used for next page. The default value is nextPage.
--initialPageParam <value>
Section titled “--initialPageParam <value>”Initial page value to infinite query. The default value is 1.
--omitInitialPageParam
Section titled “--omitInitialPageParam”Send no initial page parameter at all. When set, the generated infinite queries use initialPageParam: undefined and omit the page parameter from the first request entirely, so the initial page is fetched without it. Useful for APIs that expect no page parameter (or an empty one) on the first request. This overrides --initialPageParam.
Client Options
Section titled “Client Options”The generated client (under the openapi/requests directory) is produced by this package's own client generator: types, SDK functions and a small self-contained HTTP runtime. Nothing in the generated requests directory depends on this package at runtime.
-c, --client <value>
Section titled “-c, --client <value>”The HTTP client to use for the generated hooks. The default value is fetch.
The available options are:
fetchaxios
The runtime for the chosen client is generated into openapi/requests/runtime.gen.ts, so there is nothing to install for fetch. If you use the axios client, you still need to add axios to your project dependencies.
The v3 spellings @hey-api/client-fetch and @hey-api/client-axios are still accepted as aliases.
--format <value>
Section titled “--format <value>”Process the generated queries output folder (openapi/queries) with a formatter. The openapi/requests directory is not affected by this option. The default value is false.
The available options are:
biomeprettier
--lint <value>
Section titled “--lint <value>”Process the generated queries output folder (openapi/queries) with a linter. The openapi/requests directory is not affected by this option. The default value is false.
The available options are:
biomeeslint
--noOperationId
Section titled “--noOperationId”Do not use operation ID to generate operation names. The default value is true.
--enums <value>
Section titled “--enums <value>”Generate enum definitions? The default value is false.
The available options are:
javascripttypescript
--useDateType
Section titled “--useDateType”Use Date instead of string for date and date-time model properties.
The generated transformers.gen.ts also converts matching values of successful
responses into Date objects at runtime. The default value is false.
Error responses are not converted. In a oneOf or anyOf, dates are converted
when the members can be told apart, by their shape or by a discriminator;
otherwise they stay strings and the generator prints where.
--debug
Section titled “--debug”Deprecated: This option is currently accepted but has no effect. It will be removed in a future version.
Run in debug mode? The default value is false.
--noSchemas
Section titled “--noSchemas”Disable generating JSON schemas (openapi/requests/schemas.gen.ts). The default value is false.
--schemaType <value>
Section titled “--schemaType <value>”Type of JSON schema. Only applies when --noSchemas is not set. The default value is json.
The available options are:
json: the schemas as the specification writes themform: withouttitle,descriptionand thex-enum-*names, for use in form libraries
CI and Automation Options
Section titled “CI and Automation Options”See CI and Coding Agents for details and examples.
--agentsMd [file]
Section titled “--agentsMd [file]”Also keep a short guide for coding agents in AGENTS.md in the working directory, or in the file you name (--agentsMd CLAUDE.md). The guide says how the generated names are built and how to find an operation and its types with grep, so that an agent does not read the generated files, which can be very large. It is written between two comments that carry the output path; everything else in the file is left as it is, and the block is replaced in place on the next run. With --check, a missing or outdated block is reported like a file that differs.
--check
Section titled “--check”Generate into a temporary directory and compare the result with the existing output instead of writing it. Exits with 1 and lists the files that differ (added, modified or removed) when the output is out of date, and with 0 when it is up to date. No existing file in the output directory is changed.
--json
Section titled “--json”Print errors to stderr as a single line of JSON ({ "code", "message", "details" }) instead of human-readable text. Nothing else is written to stderr in this mode.
Exit Codes
Section titled “Exit Codes”| Exit code | Meaning |
|---|---|
0 |
Success, or --check found no differences |
1 |
--check found differences |
2 |
Error (invalid options, unreadable or invalid input, generation failure) |