Skip to main content

baml-cli generate

Generate BAML clients based on your source files and generator configurations.

Usage​

baml-cli generate [OPTIONS]

Options​

OptionDescriptionDefault
--from <PATH>Path to baml_src directory./baml_src
--no-version-checkSkip CLI version mismatch checkfalse
--no-testsStrip test blocks from generated clientfalse

Description​

The generate command:

  1. Finds all generators in the BAML project (usually in generators.baml)
  2. Ensures all generators match the CLI version
  3. Generates each baml_client based 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-tests is useful for production builds to minimize bundle size
  • Test blocks are not needed at runtime

See Also​