Skip to main content

podstack

Python SDK for the Podstack platform API.

pip install podstack

The client talks to https://podstack.ai/api/v1. Set PODSTACK_API_KEY to a ps_live_ key, or run podstack auth login so the CLI credentials file is present. The API does not accept a psk_ key. api.podstack.ai does not resolve. Public reads such as client.job_gpus.list() work with no key.

from podstack import Podstack

with Podstack() as client:
    for gpu in client.gpus.list():
        print(gpu.gpu_type, gpu.vram_gb)
    for rate in client.rates.list():
        print(rate.gpu_type, rate.region, rate.price_per_hour)

price_per_hour and every other spec are copied from the API. The SDK does not ship a price table or a GPU catalogue.

Billable calls

Create, terminate, submit, cancel, chat, embeddings, image generation, and function deploy or invoke require confirm=True. dry_run=True returns the request and does not send it. dry_run is checked first.

preview = client.instances.create(gpu_type=gpu.gpu_type, dry_run=True)
operation = client.instances.create(gpu_type=gpu.gpu_type, confirm=True)

There is no stop or start that keeps an instance disk. Terminate the instance to stop the per-second charge. Commands and file copies use the SSH command the API returns and the local ssh / scp binaries.

Functions

Creating a function is this package. The CLI only lists functions.

import podstack

@podstack.function(gpu="a100_80gb", requirements=["torch"])
def device_name():
    import torch
    return torch.cuda.get_device_name(0)

print(device_name.deploy(dry_run=True))
print(device_name.invoke(confirm=True))

The function has to live in a file. Arguments must be JSON-serializable. Calling it like a normal function raises ConfirmationRequired unless the decorator was created with confirm=True.

Storage

Object storage is billed for the data you keep. No ingress or egress fees. Minimum storage duration: 30 days. usage() returns that customer bill: stored GB, usd_per_gb_day, usd_per_gb_month, month_cost_usd, projected_month_usd, and early_delete lines with each object key and days_remaining. Prices are copied from the API.

from podstack import Podstack

with Podstack() as client:
    print(client.storage_regions())
    client.create_bucket("datasets")
    bill = client.usage(bucket="datasets")
    print(bill["stored_gb"], bill["usd_per_gb_day"], bill["month_cost_usd"])
    for line in bill.get("early_delete", []):
        print(line.get("key"), line.get("days_remaining"))

Agents

podstack.tools() returns OpenAI, Anthropic, and MCP schemas. Names match the Podstack CLI. python -m podstack.mcp serves those tools on stdio. stop_instance and start_instance are listed because the CLI lists them, and they report that the platform does not keep a stopped machine.

Agent GPU work uses list_gpu_offers, launch_job, wait_for_job, get_job_logs, get_job_status, and cleanup. Those calls go to /agent/.... Call launch with dry_run=true or without confirm, read the estimate, then confirm. The server tags every launch source=mcp and stops it at the runtime or budget cap. cleanup deletes only what this caller started.

See examples/ and AGENTS.md.

Version 1.11.0

Storage helpers return the customer usage bill: stored GB, per-GB rates, month cost, and early-delete lines. See CHANGELOG.md.

Version 1.10.0

Agent MCP tools launch a GPU job, follow its logs, and tear down only the resources that caller started. See CHANGELOG.md.

Version 1.9.0

deploy registers a function by name, uploads a cloudpickle version, and activates it. invoke starts POST /functions/{id}/runs and unpickles the result. See CHANGELOG.md.

1.8.0 removed the previous notebook SDK. There are no deprecated shims for routes the platform does not serve. The removed modules are listed in docs/audit.md.

Async code uses AsyncPodstack. The method names match the sync client.

import asyncio
from podstack import AsyncPodstack

async def main():
    async with AsyncPodstack() as client:
        print(await client.gpus.list())

asyncio.run(main())

Development

python -m pip install -e ".[dev]"
python -m ruff check src tests examples
python -m mypy
python -m pytest
python -m build
twine check dist/*

This directory is the root of the standalone package. The release workflow is .github/workflows/release.yml. It runs on a v* tag and on manual dispatch. It does not publish from a pull request. Tag publish uses PyPI Trusted Publishing (environment pypi, id-token: write) and falls back to the PYPI_API_TOKEN secret when that secret is set. Manual dispatch also uploads the built distributions to TestPyPI.

Metadata

Release files for podstack 1.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for podstack 1.11.0
File Size Uploaded Provenance Actions
podstack-1.11.0.tar.gz 70.3 kB Without provenance Details for podstack-1.11.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for podstack 1.11.0
File Interpreter ABI Platform Actions
podstack-1.11.0-py3-none-any.whl Python 3 none any Details for podstack-1.11.0-py3-none-any.whl

Total release size: 125.8 kB

Release files / podstack-1.11.0.tar.gz

Download URL podstack-1.11.0.tar.gz
Size 70.3 kB
Tags Source
SHA-256 checksum
How to use checksums
dec40adc5635f4e94143d2f03af7eba582d2d61dcafc7a5e70ad81ff8a02bf19
BLAKE2b-256 checksum
How to use checksums
ac3ddabcf0d42d67c4010a04604e905b6a31fa0764a01b1865a0e0d823f0b721
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / podstack-1.11.0-py3-none-any.whl

Download URL podstack-1.11.0-py3-none-any.whl
Size 55.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38feb8cc22f2e9b567382d2c597d28f556583d152a5e60aa4c64af8ddec8576f
BLAKE2b-256 checksum
How to use checksums
27c0810bffd863d81282ef115b5a8e5634722c4d5fb792e48e8a1ec78c42b5d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for podstack 1.11.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.11.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page