PYTHON SDK
GPU Compute in 3 Lines of Python
Search, provision, and manage GPU instances programmatically. Build agents that scale their own compute.

Install
pip install vastai-sdk
from vastai_sdk import VastAI
vast = VastAI(api_key="YOUR_API_KEY")What you can build
from vastai_sdk import VastAI
vast = VastAI(api_key="...")
# Find cheapest 8x H100
offers = vast.search_offers(
query='gpu_name=H100_SXM num_gpus=8',
order='dph',
limit=3
)
# Launch with vLLM
result = vast.launch_instance(
id=offers[0]["id"],
image="vllm/vllm-openai:latest",
disk=100,
ssh=True
)
print(f"Instance {result['new_contract']} created")Agent-Ready
Build AI agents that provision their own GPU compute. No human in the loop.
Type Hints
Full IDE support — autocomplete, type checking, inline docs.
CLI Parity
Every CLI command has an SDK equivalent. Same query syntax, same filters.
Pip Install
One dependency. Python 3.9+. No compiled extensions.
pip install vastai-sdk
Get your API key and start building GPU-powered applications.