Skip to main content
vLLM supports a wide range of models and performance optimizations. This guide deploys a vLLM model as a custom Docker server on Baseten. This configuration serves Qwen 2.5 3B with vLLM on an L4 GPU. The deployment process is the same for larger models like GLM-4.7. Adjust the resources and start_command to match your model’s requirements.

Set up your environment

This guide uses uvx to run Truss commands without a separate install step. Sign in to Baseten and install the OpenAI SDK. Browser login opens a tab to approve this device, so there’s no API key to copy and paste.
Sign in to Baseten
Install the OpenAI SDK
Hugging Face access for gated models. Some models require that you accept terms and conditions on Hugging Face before deployment. To prevent issues:
  1. Accept the license for any gated models you wish to access, like Gemma 3.
  2. Create a read-only user access token from your Hugging Face account.
  3. Add the hf_access_token secret to your Baseten workspace.
  4. Reference it from the weight source’s auth block (below). The secret alone does not authenticate weight mirroring, so without auth a gated repo fails to deploy with a 401.

Configure the model

Create a directory with a config.yaml file:
Copy the following configuration into config.yaml:
config.yaml
The base_image specifies the vLLM Docker image. The weights block uses the Baseten Delivery Network to mirror the model from Hugging Face and mount it at /models/qwen before the container starts. vLLM reads weights directly from that path and serves the model with --served-model-name, which sets the model identifier for the OpenAI-compatible API. The health_checks settings control how Baseten monitors the server after it passes the startup probe.

Deploy the model

Push the model to Baseten to start the deployment:
You should see output like:
Copy the model URL from the output for the next step. The first deploy can take several minutes while Baseten pulls the vLLM base image. Subsequent scale-ups reuse the cached image and start much faster.

Call the model

Call the deployed model with the OpenAI client:
call_model.py
Replace the model_url with the URL from your deployment output.

Monitor your deployment

Once the model is serving traffic, open the Metrics tab in the model dashboard to watch how it performs. Baseten detects the vLLM engine and surfaces engine-native graphs such as token throughput, inter-token latency, KV cache usage, and queue depth alongside the standard metrics. See vLLM and SGLang metrics.

Route through an external LLM gateway

To route traffic from a third-party OpenAI-compatible gateway to this deployment, see External LLM gateways. The model value the gateway sends must match the --served-model-name in the start_command above.