skillfed

vastai

CLI and SDK for Vast.ai GPU Cloud Service

vastai v1.5.4 2.2M downloads/30d#3,233 on PyPI211
Permissive license MIT Active released

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 vastai

uv

uv add vastai

poetry

poetry add vastai

Installing 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

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

gpu cloud management clivast.ai python sdkgpu instance provisioningserverless gpu inferencecloud compute resource apigpu marketplace clientdistributed gpu scheduling
gpu-cloudinfrastructure-as-codeasync-http

More Distributed Computing packages

Further reading