Set up your environment
You’ll need a Baseten account and uv for the Python client. This tutorial creates billable GPU compute. Check L4 pricing before deploying. Install the Baseten CLI:- macOS or Linux
- Windows
Terminal
BASETEN_API_KEY. Run the remaining commands in this terminal so the key stays available to them.
Configure the model server
Create a project directory:Terminal
config.yaml. The vLLM container includes the inference server, so you don’t need to write a Dockerfile or Python server:
config.yaml
weightspins a Hugging Face revision and mounts its files at/models/qwen. This model is public and ungated, so the download doesn’t need a Hugging Face token.base_imageselects a versioned vLLM container.start_commandtells vLLM to load/models/qwenand listen on port8000, matchingserver_port.--served-model-namesets the name in API requests.model_namesets the dashboard name.- The health endpoints let Baseten check whether the server is ready and running.
predict_endpointidentifies the server route that handles inference. resourcesassigns one L4 to each running copy of the server, called a replica.predict_concurrencylets Baseten forward up to 256 simultaneous requests to each replica so vLLM can batch them.
openai-compatible tag enables the dashboard’s chat playground for this server. vLLM itself provides the OpenAI-compatible API.
Deploy the model
Run this command from the directory containingconfig.yaml:
--tail shows logs; --wait waits for Active or exits with an error. Baseten must load the container and weights before the server can answer requests.
Copy the model ID (abc1d2ef) and deployment ID (xyz123) from the output. Use your own IDs in the request URL so you test the deployment you just created. The first published deployment of a new model serves production; later pushes need an explicit promotion to update production.
If deployment fails, inspect the build or deployment logs. Build failures occur before the container starts; startup failures occur while the server or weights load. Use deployment troubleshooting to identify the failing stage.
Send a request
Save this OpenAI-compatible request ascall_model.py. Replace {model_id} and {deployment_id} with the IDs from the push. The request’s model value matches --served-model-name in the configuration:
call_model.py
--with openai installs the SDK for this run:
https://model-{model_id}.api.baseten.co/environments/production/sync/v1 and run the request again.
Clean up
Exiting the client script doesn’t stop the deployment. When you’re finished testing, deactivate the deployment to release its replicas and stop its compute charges. Its endpoint stops serving requests; the model and configuration remain available for reactivation.- Open Dedicated Inference in the dashboard and select the model you created.
- Under Deployments, select the deployment you used in this example.
- Select Deactivate deployment, then Yes, deactivate.
- Wait for the deployment’s status to become Inactive.
Next steps
- Configure autoscaling to control replica counts and idle compute cost.
- Publish and validate an update to change the server configuration and release another deployment. Custom Docker servers use published deployments rather than the Python Truss watch workflow.
- Configure a custom server to use a different container or serving framework.