vastai-sdk

Solid

Vast.ai Python SDK — high-level API for GPU instances, volumes, serverless endpoints, and billing.

AI & Automation 207 stars 89 forks Updated today MIT

Install

View on GitHub

Quality Score: 88/100

Stars 20%
77
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Vast.ai Python SDK (`vastai` / `vastai_sdk`) The `vastai` package provides a Python SDK for managing GPU instances, volumes, serverless endpoints, and billing on Vast.ai. The `vastai_sdk` package is a backward-compatibility shim that re-exports `vastai`. ## Installation ```bash pip install vastai ``` For serverless and async support: ```bash pip install "vastai[serverless]" ``` ## Authentication The SDK reads the API key from `~/.vast_api_key` by default. You can also pass it explicitly: ```python from vastai import VastAI vast = VastAI() # reads ~/.vast_api_key vast = VastAI(api_key="YOUR_API_KEY") # explicit key ``` Get your API key from https://console.vast.ai/manage-keys/ ## Backward Compatibility The old `vastai_sdk` import still works: ```python from vastai_sdk import VastAI # equivalent to: from vastai import VastAI ``` ## VastAI Class (High-Level SDK) ```python from vastai import VastAI vast = VastAI(api_key=None, server_url=None, retry=3, raw=False, quiet=False) ``` ### Instance Management ```python # List all your instances instances = vast.show_instances() # Get a single instance instance = vast.show_instance(id=12345) # Search GPU offers offers = vast.search_offers(query='gpu_name=RTX_4090 num_gpus>=4 reliability>0.99') # Create an instance from an offer result = vast.create_instance(id=<offer_id>, image="pytorch/pytorch:latest", disk=50) # Lifecycle vast.start_instance(id=12345) vast.stop_instance(id=12345) vast.reboo...

Details

Author
vast-ai
Repository
vast-ai/vast-cli
Created
7 years ago
Last Updated
today
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category