The official Python SDK for Vast.ai, providing programmatic access to GPU cloud resources. Users install the `vastai-sdk` package, which then exposes the `VastAI` client class through the `vastai` module. This SDK allows for searching, launching, and managing GPU instances, mirroring much of the functionality of the Vast.ai CLI. The current version is 0.6.0, with active development.
pip install vastai-sdkVerified import paths — ran on the pinned version, not inferred.
Initialize the VastAI client using an API key from an environment variable or direct parameter, then search for available GPU offers.
Always install `vastai-sdk` for the Python SDK. The `from vastai import VastAI` import pattern is correct.
Use `from vastai import VastAI` after installing `pip install vastai-sdk`.
Refer to `https://github.com/vast-ai/vast-sdk` for SDK-specific information and contributions.
Always check PyPI (pypi.org/project/vastai-sdk) for the most up-to-date version information.
pip install vastai-sdk
import vastai
client = vastai.VastAI(api_key="YOUR_VALID_API_KEY")
client = vastai.VastAI(api_key="...")