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 = {
"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.3.3.dev3.tar.gz
(82.2 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.3.3.dev3.tar.gz.
File metadata
- Download URL: vastai_sdk-0.3.3.dev3.tar.gz
- Upload date:
- Size: 82.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.14.0-37-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f723e8c39ee7d41b3c8cddcf947e5755bd63e12430a11bfb6ac1bff361c89dc
|
|
| MD5 |
2bf10de10340247e6fbb6e7a3d366348
|
|
| BLAKE2b-256 |
98ecb6a3105a3ddb6fd4fac2b947ce94f357d2c8aae0f7073c442865483ec39b
|
File details
Details for the file vastai_sdk-0.3.3.dev3-py3-none-any.whl.
File metadata
- Download URL: vastai_sdk-0.3.3.dev3-py3-none-any.whl
- Upload date:
- Size: 89.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.14.0-37-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b65168ae0ee481a851ab83d85ede99f50b3cecbb0ef1711f0039a61f2e8ff68a
|
|
| MD5 |
0fe5529323c4534bc4c9cf0c487c022d
|
|
| BLAKE2b-256 |
aa51b499d20bd1de242282d9b1e75c2cf73bd88afec4ef3806d2fab0fb381f16
|