Skip to main content
Deploying a model to Baseten turns a Hugging Face model into a production-ready API endpoint. You write a config.yaml that specifies the model, the hardware, and the engine, then uvx truss push builds a TensorRT-optimized container and deploys it. No Python code, no Dockerfile, no container management. This guide walks through deploying Qwen 2.5 3B Instruct, a small but capable LLM, from a config file to a production API. You’ll set up Truss, write a config, deploy to Baseten, and call the model’s OpenAI-compatible endpoint.

Install and sign in

Before you begin, sign up or sign in to Baseten, then install uv, a fast Python package manager. Install the Truss CLI and connect it to your Baseten account. Browser login opens a tab to approve this device, so there’s no API key to copy and paste.
Install Truss
Sign in
Prefer not to install? Run uvx truss login --browser to use the same flow without a permanent install, and use uvx truss … for the rest of this guide.

Create a Truss project

Create a directory for your project:
TRT-LLM engine deployments only need a config.yaml. No custom Python code is required, and the model/ directory (used for custom preprocessing or postprocessing) isn’t needed here.

Write the config

Create a config.yaml with:
config.yaml
That’s the entire deployment specification.
  • model_name identifies the model in your Baseten dashboard.
  • resources selects an L4 GPU (24 GB VRAM), which is plenty for a 3B parameter model.
  • trt_llm tells Baseten to use Engine-Builder-LLM, which compiles the model with TensorRT-LLM for optimized inference.
  • checkpoint_repository points to the model weights on Hugging Face. Qwen 2.5 3B Instruct is ungated, so no access token is needed.
  • quantization_type: fp8 compresses weights to 8-bit floating point, cutting memory usage roughly in half with negligible quality loss.
  • max_seq_len: 8192 sets the maximum context length for requests.
  • num_builder_gpus: 2 uses two GPUs during the build phase. FP8 quantization requires more GPU memory at build time than at inference time, so a single L4 runs out of memory during compilation without this setting.

Deploy

Push the model to Baseten:
Engine-based deployments (TRT-LLM) use published deployments by default. The --watch flag, which creates a development deployment with live reload, is not supported for TRT-LLM models. For custom Python models, see Customize a model where --watch enables a faster development loop.
You should see:
Baseten downloads the model weights from Hugging Face, compiles them with TensorRT-LLM, and deploys the resulting container to an L4 GPU. This build step takes roughly 10-20 minutes for the first deploy. You can watch progress in the logs linked above.

Call the model

Engine-based deployments serve an OpenAI-compatible API. Once the deployment shows “Active” in the dashboard, call it using the OpenAI SDK or cURL. Replace {model_id} with your model ID from the deployment output. The endpoint follows this shape: Anatomy of the model API endpoint. In https://model-abc123.api.baseten.co/environments/production/sync/v1, abc123 is the model ID and production is the environment that serves the request.
Install the OpenAI SDK if you don’t have it:
Create a chat completion:
You should see a response like:
Any code that works with the OpenAI SDK works with your deployment. Just point the base_url at your model’s endpoint.

Next steps

Engine configuration

Tune max sequence length, batch size, quantization, and runtime settings.

Customize a model

Add custom Python code when you need preprocessing, postprocessing, or unsupported model architectures.

Autoscaling

Configure replicas, concurrency targets, and scale-to-zero for production traffic.