vastai
CLI and SDK for Vast.ai GPU Cloud Service
What it is and what it does
Vastai is the official Python interface to Vast.ai's GPU cloud platform. It offers both a command-line tool and a programmatic SDK for discovering, provisioning, and managing GPU compute instances on a peer-to-peer marketplace. The CLI can be installed standalone without Python, while the SDK integrates into Python applications for automated workflows.
The package handles three main workflows: searching available GPU offers by specification, managing instance lifecycle (create, start, stop, destroy), and making inference requests to serverless endpoints. It wraps HTTP communication with aiohttp and requests, handles authentication via API key, and provides tab completion for CLI commands. The serverless client supports async request patterns for high-throughput inference scenarios.
Use it for:
- Search and filter GPU offers by hardware specs (model, count, memory) before provisioning a training instance
- Automate instance lifecycle in CI/CD pipelines—create, configure, run jobs, then tear down to minimize cost
- Build applications that query serverless GPU endpoints for real-time model inference without managing infrastructure
- Monitor and manage multiple GPU instances programmatically from a single control script
- Integrate Vast.ai resource discovery into AI agent workflows for autonomous compute allocation
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a CLI and Python SDK for managing GPU compute resources on Vast.ai, including instance lifecycle operations, resource searching, and serverless endpoint inference.
Yes, if you use Vast.ai for GPU compute. The package is actively maintained, has no known vulnerabilities, and provides both CLI and SDK interfaces. Install friction is low and the license is permissive. The main prerequisite is a Vast.ai account and API key. Not relevant if you don't use the Vast.ai platform.
Install
vastai on PyPI
pip
pip install vastaiuv
uv add vastaipoetry
poetry add vastaiInstalling vastai
Before you install
Low friction installation with a pure-Python wheel. Active maintenance with a release 2 days old and last commit on 2026-08-14. Requires Python 3.10 or later. Runtime dependency chain is substantial (18 packages including aiohttp, cryptography, and pillow) but all are standard ecosystem libraries.
License in practice
MIT license (permissive) — you can use, modify, and redistribute vastai freely in commercial and private projects with minimal restrictions.
Quickstart
pip install vastai
from vastai import VastAI
vast = VastAI() # uses VAST_API_KEY env var
vast.search_offers(query='gpu_name=RTX_4090 num_gpus>=4')
Requires VAST_API_KEY environment variable or explicit api_key parameter; obtain from https://cloud.vast.ai/manage-keys/
Verify before relying
- Whether the serverless client supports synchronous (non-async) usage patterns or requires asyncio integration
- Specific rate limits or quota constraints when searching or managing instances via the SDK
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 18 — aiodns, aiohttp, anyio, argcomplete, borb, cryptography, curlify, pillow, psutil, pycares, pycryptodome, pyparsing, python-dateutil, requests, rich, typing-extensions, urllib3, xdg |
| Maintenance | actively maintained — 2 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,173,468/month — #3,233 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: vastai-1.5.4-py3-none-any.whl
Tags
More Distributed Computing packages
gRPC Python is an HTTP/2-based RPC framework…
permissive · top 100 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI
cloudpickleCloudpickle extends Python's standard pickle…
permissive · top 1,000 on PyPI
smart-openProvides a unified, open()-compatible Python…
permissive · top 1,000 on PyPI
portalockerPortalocker provides cross-platform file…
permissive · top 1,000 on PyPI
rayRay is a distributed computing framework that…
permissive · top 1,000 on PyPI
leptonaiLepton AI is a Python framework for building…
unclear · top 15,000 on PyPI
runpodRunpod is a Python SDK and API client library…
permissive · top 5,000 on PyPI
vastai-sdkProvides Python bindings to the Vast.ai API for…
unclear · top 5,000 on PyPI
skypilot-nightlySkyPilot provisions and manages AI compute jobs…
permissive · top 15,000 on PyPI
openai-codex-cli-binProvides a local command-line interface to…
permissive · top 15,000 on PyPI
azure-cliAzure CLI is a command-line tool for managing…
permissive · top 5,000 on PyPI
google-agents-cliA CLI toolchain that equips coding agents…
permissive · top 15,000 on PyPI
fastapi-cloud-cliA command-line tool for deploying and managing…
permissive · top 1,000 on PyPI
azure-ai-inferenceUnified client library for chat completions,…
permissive · top 5,000 on PyPI
stashaiStash is a CLI and MCP server that creates a…
permissive · top 15,000 on PyPI