Skip to main content

Setup

Sign in to Baseten with Truss, then install the Python requests library.
Sign in to Baseten
Install requests
Pick the model you want to deploy. Each tab is a self-contained recipe.
black-forest-labs/FLUX.1-dev is a 12B-parameter diffusion transformer model.This preset serves FLUX.1 dev on H100 40GB, tuned for text-to-image throughput.

Hardware

H100_40GB

Write the config

Create and move into the project directory:
Then create a file named config.yaml and paste the following:
config.yaml

Deploy

Push the config to Baseten:
You should see output similar to:
truss push prints your model ID (abc1d2ef in the example). The examples below use it wherever you see {model_id}, and read your API key from the BASETEN_API_KEY environment variable.

Call the model

Use the /predict endpoint to generate your model’s images.The deployment returns the generated image as base64-encoded bytes. Decode the response to write the image to disk.
main.py

Next steps

Call your model

Endpoint anatomy, authentication, and sync versus async inference

Autoscaling

Scale replicas with traffic, including scale to zero