Skip to main content

SDK for Vast.ai GPU Cloud Service

Project description

Vast.ai Python SDK

PyPI version

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

  1. Create the client
from vastai import VastAI
vastai = VastAI() # or, VastAI("YOUR_API_KEY")
  1. Run commands
vastai.search_offers()
  1. Get help
help(v.create_instances)

Using the Serverless client

  1. Create the client
from vastai import Serverless
serverless = Serverless() # or, Serverless("YOUR_API_KEY")
  1. Get an endpoint
endpoint = await serverless.get_endpoint("my-endpoint")
  1. 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)
  1. Read the response
text = response["response"]["choices"][0]["text"]
print(text)

Find more examples in the examples directory

Project details


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.6.tar.gz (69.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vastai_sdk-0.2.6-py3-none-any.whl (72.8 kB view details)

Uploaded Python 3

File details

Details for the file vastai_sdk-0.2.6.tar.gz.

File metadata

  • Download URL: vastai_sdk-0.2.6.tar.gz
  • Upload date:
  • Size: 69.1 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

Hashes for vastai_sdk-0.2.6.tar.gz
Algorithm Hash digest
SHA256 9a7d93e2dc1b229af5f0c234913601b42fe04f8f664393bf1daabfec8a1aaaa4
MD5 10aee4738247275e5ed1bc205dd2445c
BLAKE2b-256 5019c3b3069d5c73e7a18017ab6a6822c3caf8be9c9e2cdbc74200fc1ee32167

See more details on using hashes here.

File details

Details for the file vastai_sdk-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: vastai_sdk-0.2.6-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

Hashes for vastai_sdk-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 93dbc7eaf4c8f7a1f787294c744da16edbf0cf11c0cfb3398a7960868ed08cb9
MD5 3ee19aa3d2bdc415befff2d15d21e0ab
BLAKE2b-256 ad3b6e197325c06a088cdb497bf0c6bc2b9a6c99038f4c6e7d2fe2a1b593ee66

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page