resources and start_command to match your model’s requirements.
Set up your environment
This guide uses the Baseten CLI. Sign in 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. Accept the license for any gated model you deploy, like Gemma 3, then authenticate the weight source’s
auth block (below) in one of two ways. Without auth, a gated repo fails to deploy with a 401.- Hugging Face OIDC, which stores no token: add a CI/CD identity for your Hugging Face account, then set
auth_method: HF_OIDCandhf_oidc_resourceto your Hugging Face username. For more information, see Hugging Face OIDC. - Access token: create a read-only user access token, add it as the
hf_access_tokensecret in your Baseten workspace, and keepauth_method: CUSTOM_SECRET.
Configure the model
Create a directory with aconfig.yaml file:
config.yaml:
config.yaml
base_image specifies the SGLang 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. SGLang 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 readiness_endpoint and liveness_endpoint use /health, which returns 200 once the server is running. 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:Call the model
Call the deployed model with the OpenAI client:call_model.py
model_url with the URL from your deployment output.