Skip to main content
The VastAI class is the main client for interacting with the Vast.ai platform. It wraps the CLI commands as Python methods with typed signatures.

Installation

Quick Start

Constructor

Optional[str]
default:"None"
Your Vast.ai API key. If not provided, reads from ~/.config/vastai/vast_api_key.
Optional[str]
default:"None"
The Vast.ai API server URL. Defaults to https://console.vast.ai when unset.
int
default:"3"
Number of retry attempts for failed API requests.
bool
default:"False"
Return raw JSON responses instead of formatted output.
bool
default:"False"
Print verbose explanations of API calls.
bool
default:"False"
Suppress non-essential output.
bool
default:"False"
Print equivalent curl commands for API calls.
If api_key is not provided, the VastAI class reads it from ~/.vast_api_key.

Getting Help

Use Python’s built-in help() to view documentation for any method: