Output
You must set the output so we know where to generate your files.
Output
Output can be a path to the destination folder or an object containing the destination folder path and optional settings.
export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: 'src/client',
};export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
path: 'src/client',
// ...other options
},
};You can learn more about complex use cases in the Advanced section.
File Name
You can customize the naming and casing pattern for files using the fileName option.
export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
fileName: '{{name}}',
path: 'src/client',
},
};export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
fileName: {
case: 'snake_case',
},
path: 'src/client',
},
};By default, we append every file name with a .gen suffix to highlight it's automatically generated. You can customize or disable this suffix using the fileName.suffix option.
export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
fileName: {
suffix: '.gen',
},
path: 'src/client',
},
};export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
fileName: {
suffix: null,
},
path: 'src/client',
},
};export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
fileName: {
suffix: '.generated',
},
path: 'src/client',
},
};Module Extension
You can customize the extension used for TypeScript modules.
export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
importFileExtension: undefined,
path: 'src/client',
},
};export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
importFileExtension: null,
path: 'src/client',
},
};export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
importFileExtension: '.js',
path: 'src/client',
},
};export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
importFileExtension: '.ts',
path: 'src/client',
},
};By default, we don't add a file extension and let the runtime resolve it.
import foo from './foo';If we detect a TSConfig file with moduleResolution option set to nodenext, we default the extension to .js.
import foo from './foo.js';Format
To format your output folder contents, set format to a valid formatter.
export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
format: null,
path: 'src/client',
},
};export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
format: 'prettier',
path: 'src/client',
},
};export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
format: 'biome',
path: 'src/client',
},
};You can also prevent your output from being formatted by adding your output path to the formatter's ignore file.
Lint
To lint your output folder contents, set lint to a valid linter.
export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
lint: null,
path: 'src/client',
},
};export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
lint: 'eslint',
path: 'src/client',
},
};export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
lint: 'biome',
path: 'src/client',
},
};export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
lint: 'oxlint',
path: 'src/client',
},
};You can also prevent your output from being linted by adding your output path to the linter's ignore file.
Name Conflicts
As your project grows, the chances of name conflicts increase. We use a simple conflict resolver that appends numeric suffixes to duplicate identifiers. If you prefer a different strategy, you can provide your own nameConflictResolver function.
export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
nameConflictResolver({ attempt, baseName }) {
return attempt === 0 ? baseName : `${baseName}_N${attempt + 1}`;
},
path: 'src/client',
},
};export type ChatCompletion = string;
export type ChatCompletion_N2 = number;TSConfig Path
We use the TSConfig file to generate output matching your project's settings. By default, we attempt to find a TSConfig file starting from the location of the @hey-api/openapi-ts configuration file and traversing up.
export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
path: 'src/client',
tsConfigPath: undefined,
},
};export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
path: 'src/client',
tsConfigPath: './config/tsconfig.custom.json',
},
};export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
path: 'src/client',
tsConfigPath: null,
},
};Custom Files
By default, you can't keep custom files in the path folder because it's emptied on every run. If you're sure you need to disable this behavior, set clean to false.
export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: {
clean: false,
path: 'src/client',
},
};WARNING
Setting clean to false may result in broken output. Ensure you typecheck your code.
Examples
You can view live examples on StackBlitz.
Sponsors
Help Hey API stay around for the long haul by becoming a sponsor.
Gold

Best-in-class developer interfaces for your API.
stainless.comThe open source coding agent.
opencode.ai
