Skip to main content
Use config.yaml to set environment variables, install dependencies, and choose compute resources for your model.

Environment variables

To set environment variables in the model serving environment, use the environment_variables key:
config.yaml
Store credentials in Baseten secrets.

Python packages

Choose requirements to list packages inline or requirements_file to use your project’s dependency file. Set one field.

Inline list

List packages directly in config.yaml:
config.yaml
Pin package versions with ==:
config.yaml

Requirements file

Point requirements_file at a dependency file. Truss supports three formats:
Use a standard pip requirements file for full control over pip options and repositories.
config.yaml

Dependency constraints

Truss uses a constraints.txt file to enforce version bounds on base server dependencies. If you specify a package that overlaps with base dependencies (for example, numpy or fastapi), your version is respected but must fall within the bounds defined in constraints.txt. If you specify a version outside these bounds, the build will fail with an unsatisfiable error. This applies to both requirements (inline list) and requirements_file.

Chains

Chains supports the same three formats through DockerImage.requirements_file. Use make_abs_path_here to resolve the path relative to the source file:
chainlet.py
pyproject.toml and uv.lock work the same way:
chainlet.py
chainlet.py
pip_requirements_file is deprecated. Use requirements_file instead. You can’t combine pip_requirements with pyproject.toml or uv.lock files; manage all dependencies in your pyproject.toml.

System packages

Truss supports installing apt-installable Debian packages. To add system packages to your model serving environment, add them to your config.yaml file:
config.yaml
For example, to install Tesseract OCR:
config.yaml
To run a command when Baseten builds the image, use a custom build command.

Resources

Specify hardware resources in the resources section.

Individual resource fields

For a CPU model:
config.yaml
For a GPU model:
config.yaml
When you push your model, it’s assigned an instance type matching the required specifications.

Exact instance type

config.yaml
Using instance_type lets you select an exact SKU. When specified, other resource fields are ignored. See the Resources page for more information on options available.

Files and containers

To ship local files with your model, bundle the files with your Truss. To control the build environment, choose a base Docker image. If the image runs its own HTTP server, configure a custom server and its health checks.