baml-cli init
Initialize a new BAML project with directory structure and configuration files.
Usage
baml-cli init [OPTIONS]
Options
| Option | Description | Default |
|---|---|---|
--dest <PATH> | Where to initialize the project | . (current directory) |
--client-type <TYPE> | BAML client type to generate | Auto-detected |
--openapi-client-type <TYPE> | OpenAPI client generator | None |
Description
The init command:
- Creates
${DEST}/baml_srcdirectory structure - Creates
generators.bamlwith initial configuration - Includes example files to get started
Client Types
| Type | Description |
|---|---|
python/pydantic | Python with Pydantic |
typescript | TypeScript |
go | Native Go (recommended) |
ruby/sorbet | Ruby with Sorbet |
rest/openapi | REST with OpenAPI |
Examples
# Initialize in current directory
baml init
# Initialize in specific directory
baml init --dest /path/to/my/project
# Initialize for Python
baml init --client-type python/pydantic
# Initialize for Go
baml init --client-type go
# Initialize with OpenAPI + Go client
baml init --client-type rest/openapi --openapi-client-type go
Notes
- Fails if
baml_srcdirectory already exists - OpenAPI generator detection: checks for
openapi-generator,openapi-generator-cli, or usesnpx @openapitools/openapi-generator-cli