Skip to main content
The Text Generation Inference serverless template can be used to infer LLMs on Vast GPU instances. This page documents required environment variables and endpoints to get started. A full PyWorker and Client implementation can be found here.

Environment Variables

  • HF_TOKEN(string): HuggingFace API token with read permissions, used to download gated models. Read more about HuggingFace tokens here.
  • MODEL_ID(string): ID of the model to be used for inference. Supported HuggingFace models are shown here.
Some models on HuggingFace require the user to accept the terms and conditions on their HuggingFace account before using. For such models, this must be done first before using it with a Vast template.

Install the Vast.ai SDK

Ensure you have the vastai pip package installed

Ensure API key is set

Configure the environment variable VAST_API_KEY to contain your Vast.ai Serverless API key

Using /generate/

Python

Using /generate_stream/

Python