Skip to main content

SDK for Vast.ai GPU Cloud Service

Project description

🪄 Vast.ai Magic Comes To Python!

It's everything you love from the Vast.ai CLI tool, wrapped neatly in an easy-to-use Python interface!

PyPI version

📦 What's in the pip?

Why, it’s not just an SDK—it’s an entire development philosophy in a single import statement! With just a humble pip install, you unlock:

  • Lightning-fast integrations: So easy, it practically writes your code for you.
  • 🛡️ Error-free operations: Bugs? Banished. Exceptions? Extinct. Our SDK makes them a thing of the past!
  • 🌍 Infinite scalability: Whether you’re running on a potato or the world’s fastest supercomputer, we’ve got you covered!

👀 Let's Sneak A Peek!

Under the hood we are using what the CLI tool uses and so the documentation is the same. The arguments are the same.

🐚 shell: vastai cast --spell='abracadabra'

🐍 python: vastai.cast(spell='abracadabra')

Just a little something like this and we're ready to roll!

import vastai_sdk
vastai = vastai_sdk.VastAI()

In fact, try this right now. I'll wait!

$ pip install vastai-sdk
$ python
Python 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import vastai_sdk
>>> v = vastai_sdk.VastAI()
>>> v.search_offers()

This is easy, you got this!

What about the return values?

JSONable objects, exactly as --raw would send to your pretty terminal. It's really the same.

Alright, but what about an API key, what's the catch?

You can provide it in the class instantiation: vastai.VastAI("My-magnificent-key")

OR, if you leave it blank it will look for a key in the same place as the CLI, right there in your friendly $HOME directory.

The creds_source @property will tell you where what's being used came from. Example:

>>> v=vastai_sdk.VastAI("Not-My-Real-Key-Don't-Worry!")
>>> v.creds_source
'CODE'
>>> v.api_key
"Not-My-Real-Key-Don't-Worry!"
>>>

Introspection, __doc__, __sig__?

Yes, yes, and yes. It's all in there. Try this at the handy python prompt

>>> help(v.create_instance)

Pretty nice, right? Now do this! (No Spoilers!)

>>> help(v.<tab>

All the helpers are there so your vscode, emacs, ipython, and neovim sessions will fly as your fingertips tab away.

Help, support, all that stuff?

Sure. Just head over to GitHub issues.

Thanks for using Vast.ai. We 💖 you!

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.0.tar.gz (69.0 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.0-py3-none-any.whl (71.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vastai_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 69.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.14.0-33-generic

File hashes

Hashes for vastai_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 47015c209597fd0e7ab18534c34e64ed8ef4e5ed1a14b2a29ee8d563d5b7df98
MD5 e55db5850e0d05dbb2d03088e2bb0db2
BLAKE2b-256 3d749e498f05a0da6f096a92b7bfe321d5ea2e66baa0fd9c89879d7a8e3d99cd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vastai_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 71.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.14.0-33-generic

File hashes

Hashes for vastai_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c5b457f3341003984de78c62d5195e0f41787318e65712af3282250d2bb7715
MD5 5d29cdb1392faaba33cd2673af17f807
BLAKE2b-256 cd241b29be76e8640d83e0da939ce0837ed4aa006758986dd304af2c9602d02a

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