SDK for Vast.ai GPU Cloud Service
Project description
Vast.ai Python SDK
The official Vast.ai SDK pip package.
Install
pip install vastai-sdk
Examples
NOTE: Ensure your Vast.ai API key is set in your working environment as VAST_API_KEY. Alternatively, you may pass the API key in as a parameter to either client.
Using the VastAI CLI client
- Create the client
from vastai import VastAI
vastai = VastAI() # or, VastAI("YOUR_API_KEY")
- Run commands
vastai.search_offers()
- Get help
help(v.create_instances)
Using the Serverless client
- Create the client
from vastai import Serverless
serverless = Serverless() # or, Serverless("YOUR_API_KEY")
- Get an endpoint
endpoint = await serverless.get_endpoint("my-endpoint")
- Make a request
request_body = {
"input" : {
"model": "Qwen/Qwen3-8B",
"prompt" : "Who are you?",
"max_tokens" : 100,
"temperature" : 0.7
}
}
response = await serverless.request("/v1/completions", request_body)
- Read the response
text = response["response"]["choices"][0]["text"]
print(text)
Find more examples in the examples directory
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
vastai_sdk-0.2.2.tar.gz
(69.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vastai_sdk-0.2.2.tar.gz.
File metadata
- Download URL: vastai_sdk-0.2.2.tar.gz
- Upload date:
- Size: 69.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.12.12 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1d7b3b92d7044fd6b27d99c9eff750f7a51f3a042b1420a414606952e059f69
|
|
| MD5 |
30c1998f4a7fdfff79ebc30bea74d1a8
|
|
| BLAKE2b-256 |
ceffa651bd7cc0f642e10176b3de7bf1c623d84ed2dd9b17a71b88adf60fbab3
|
File details
Details for the file vastai_sdk-0.2.2-py3-none-any.whl.
File metadata
- Download URL: vastai_sdk-0.2.2-py3-none-any.whl
- Upload date:
- Size: 72.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.12.12 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c12f15c372ab09d2f4b65e5cc537afa53dd91e8822f634ad4d9d230c432e375d
|
|
| MD5 |
43ba7ec59848d8aa3ade5907c9a18905
|
|
| BLAKE2b-256 |
fa1441ccf58436cf44b8c8c9ed731f06f3515a5dd94120848f1042691235fd72
|