vastai-sdk

Solid

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

AI & Automation 195 stars 84 forks Updated 3 days ago MIT

Install

View on GitHub

Quality Score: 88/100

Stars 20%
76
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
3 days ago
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Solid

vastai

Vast.ai CLI to manage GPU instances, volumes, serverless endpoints, and billing.

195 Updated 3 days ago
vast-ai
AI & Automation Featured

vastai-install-auth

Install and configure Vast.ai CLI and REST API authentication. Use when setting up a new Vast.ai integration, configuring API keys, or initializing Vast.ai GPU cloud access in your project. Trigger with phrases like "install vastai", "setup vastai", "vastai auth", "configure vastai API key", "vastai gpu setup".

2,274 Updated today
jeremylongshore
AI & Automation Solid

vast-gpu

Rent, manage, and destroy GPU instances on vast.ai. Use when user says "rent gpu", "vast.ai", "rent a server", "cloud gpu", or needs on-demand GPU without owning hardware.

11,152 Updated today
wanshuiyin
AI & Automation Featured

vastai-common-errors

Diagnose and fix Vast.ai common errors and exceptions. Use when encountering Vast.ai errors, debugging failed instances, or troubleshooting GPU rental issues. Trigger with phrases like "vastai error", "fix vastai", "vastai not working", "debug vastai", "vastai instance failed".

2,274 Updated today
jeremylongshore
AI & Automation Featured

vastai-sdk-patterns

Apply production-ready Vast.ai SDK patterns for Python and REST API. Use when implementing Vast.ai integrations, refactoring SDK usage, or establishing coding standards for GPU cloud operations. Trigger with phrases like "vastai SDK patterns", "vastai best practices", "vastai code patterns", "idiomatic vastai".

2,274 Updated today
jeremylongshore