baml-cli generate
Generate BAML clients based on your source files and generator configurations.
Usage
baml-cli generate [OPTIONS]
Options
| Option | Description | Default |
|---|---|---|
--from <PATH> | Path to baml_src directory | ./baml_src |
--no-version-check | Skip CLI version mismatch check | false |
--no-tests | Strip test blocks from generated client | false |
Description
The generate command:
- Finds all generators in the BAML project (usually in
generators.baml) - Ensures all generators match the CLI version
- Generates each
baml_clientbased on configurations
Examples
# Generate with defaults
baml-cli generate
# Generate from specific directory
baml-cli generate --from /path/to/my/baml_src
# Generate without version check
baml-cli generate --no-version-check
# Generate without test blocks (smaller output)
baml-cli generate --no-tests
Output
- Reports number of clients generated and locations
- Suggests configuration if no generators found
- Stops and reports errors if a generator fails
Notes
--no-testsis useful for production builds to minimize bundle size- Test blocks are not needed at runtime