Skip to main content

Python SDK Reference

The official novapod Python package provides typed, asynchronous, and synchronous APIs for orchestrating GPU compute directly from training pipelines, automated evaluation harnesses, or autonomous agent loops.


Installation​

pip install novapod

Authentication​

Set your API token via environment variable or pass it directly to the Client:

export NOVAPOD_API_KEY="np_live_your_secret_key"

Basic Usage​

Context Manager (Auto-Cleanup)​

from novapod import Client

with Client() as client:
# 1. Search for cheapest available H100
offers = client.market.search(gpu="H100_SXM", min_reliability=0.98)
best_offer = offers[0]
print(f"Deploying on {best_offer.id} at ${best_offer.price_per_hour}/hr")

# 2. Provision instance
instance = client.instances.create(
offer_id=best_offer.id,
template="pytorch-2.4",
disk_gb=100,
name="nightly-eval-run"
)

# 3. Block until instance is running (<15s)
instance.wait_for_running()
print(f"SSH command: {instance.ssh_command}")
print(f"JupyterLab: {instance.jupyter_url}")

# 4. Execute remote command over SSH
output = instance.exec("nvidia-smi --query-gpu=name,memory.total --format=csv")
print(output)

# 5. Pause or destroy
instance.pause()

Asynchronous SDK (AsyncClient)​

For high-concurrency applications, FastAPI backends, and autonomous agent loops:

import asyncio
from novapod import AsyncClient

async def run_batch():
async with AsyncClient() as client:
instances = await asyncio.gather(*[
client.instances.create(gpu_type="RTX_4090", template="vllm")
for _ in range(4)
])
print(f"Provisioned {len(instances)} nodes concurrently.")

asyncio.run(run_batch())