config.yaml, push with the Truss CLI, and get an OpenAI-compatible API endpoint, without custom Python or a Dockerfile.
This guide walks through deploying Gemma 4 26B Instruct on two H100 GPUs with vLLM, using EAGLE3 speculative decoding and prefix caching. You’ll add a Hugging Face token, write a config, deploy to Baseten, and call the model’s OpenAI-compatible endpoint. Weights mirror once through the Baseten Delivery Network (BDN), so replicas scale up without re-downloading from Hugging Face.
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
Add a Hugging Face access token
Gemma requires a license click-through:- Accept Google’s license terms on the Gemma model page. The weights in this example come from RedHatAI’s FP8 fork; your Hugging Face token grants access to both repos.
- Create a read-only user access token.
- Save the token as a secret named
hf_access_tokenin your Baseten workspace.
Create a Truss project
Create a directory for your project:config.yaml. Skip custom Python and the model/ directory, which you use for custom preprocessing or postprocessing.
Write the config
Create aconfig.yaml with:
config.yaml
weightstells BDN which Hugging Face checkpoint to mirror and where to mount it inside the container.auth_secret_nameuses yourhf_access_tokensecret for the gated download.base_imageanddocker_serverrun vLLM as the serving process:start_commandlaunches the server, and the endpoint fields tell Baseten which routes to forward for predictions and health checks.--enable-prefix-cachingreuses the KV cache when requests share a prompt prefix, such as a system prompt, RAG context, or multi-turn history.- The
--speculative-config.*flags enable EAGLE3 speculative decoding, which runs a small draft model alongside the main model and accepts matching token predictions to cut decode latency. resourcesprovisions two H100 GPUs;start_commandreads the GPU count withnvidia-smiand sets vLLM’s tensor parallelism to match.runtime.health_checksgives vLLM time to load weights before Baseten routes traffic or restarts the replica.model_metadatasupplies the example request for the dashboard Try panel, andsecretsdeclares which workspace secrets the container can read.
Deploy
Push the model to Baseten:Call the model
Once the deployment showsActive in the dashboard, call it with a Baseten API key. The endpoint follows this shape:
{model_id} in the examples below with your model ID from the deploy output.
- Python
- cURL
Send a streaming chat completion with the OpenAI SDK. Save the following as Run the script with
call_model.py:call_model.py
uv, which pulls the OpenAI SDK on the fly:base_url at your model’s endpoint. To route traffic through a third-party OpenAI-compatible gateway, see External LLM gateways.
Adapt to another model
The same pattern works across model families: BDN handles weight delivery, vLLM serves the model, and Baseten handles replicas, routing, and monitoring. Port the template incrementally, changing and validating one layer before moving to the next.- Weights: Point
weights[].sourceat the new repo and update the path instart_command. Keepauth_secret_namefor gated models, and pin a revision (for example,@mainor a commit hash) for reproducibility. - Served model name: Set
--served-model-nameto the public model ID your clients will send, and update themodelfield inexample_model_inputto match. - Model-specific vLLM flags: Swap or drop reasoning and tool-call parsers (the
gemma4parsers only apply to Gemma 4). Remove the--speculative-config.*flags if your target has no published EAGLE3 speculator. - Hardware: Resize
resources.acceleratorfor the new checkpoint’s memory footprint. Confirm utilization in the deployment logs andnvidia-smi. - Runtime tuning: Tune
runtime.predict_concurrencyalongside--max-num-seqsonce you know your traffic pattern. - Rollback: Promote a working config to a separate environment and roll forward only after smoke tests pass.
Next steps
Other weight sources
Mirror weights from S3, GCS, and other BDN sources instead of Hugging Face.
SGLang
Serve the same class of model with SGLang instead of vLLM.
Custom Docker server
Run vLLM, SGLang, Triton, or any containerized inference server on Baseten.
Autoscaling
Configure replicas, concurrency targets, and scale-to-zero for production traffic.
Customize a model
Add custom Python when you need preprocessing, postprocessing, or unsupported architectures.