vastai-sdk, for convenient Python usage.
PyPI Install
You can install the latest stable PyPI release with:Text
Usage
Import the package:Text
Text
Resource Methods
Most CLI commands have direct equivalents in the Python SDK. Your VastAI client exposes the same functionality through class methods and IDE’s will surface type hints and arguments automatically. For example, the CLI commandvastai show instances has the equivalent, vast_sdk.show_instances().
Text
Getting help
Use the built-inhelp() method to view detailed documentation for any SDK method. This will show you the method’s description, parameters, query syntax, and usage examples.
Text
Example Usage
Here are some example usages of our Python SDK classVastAI:
Search offers
Find an available RTX 3090 GPUText
Starting and Stopping Instances
Text
Creating a New Instance
Create a new instance based on given parameters (performs search offers + create instance).Text
Copying Files Between Instances
Text
Managing SSH Keys
Create a new SSH key, show all SSH keys, and delete an SSH key.Text
Contribution and Issue Reporting
This code repository is open source and can be rapidly changing at times. If you find a potential bug, please open an issue on GitHub. If you wish to contribute to improving this code and its functionality, feel welcome to open a PR with any improvements on our GitHub repository.Available Methods
Below is a list of the available methods you can call on theVastAI client. These methods are categorized for better readability.
Instance Management
SSH Key Management
API Key Management
Autoscaler Management
Endpoint Management
File Management
Team Management
Host Management
Other Methods
For a complete list of methods and their usage, please refer to Commands.