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.

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.

See examples/ and AGENTS.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.9.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.9.0
File Size Uploaded Provenance Actions
podstack-1.9.0.tar.gz 59.6 kB Without provenance Details for podstack-1.9.0.tar.gz

Built distribution (wheel)

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

Total release size: 107.5 kB

Release files / podstack-1.9.0.tar.gz

Download URL podstack-1.9.0.tar.gz
Size 59.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a9e96f61774e14a39c48638b6f790878c7dc324bed4337b651b743d4d7a413fc
BLAKE2b-256 checksum
How to use checksums
11546cde32067f48eeef805ed6dfac4db5379f2140cca86826456cf27d125b12
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.9.0-py3-none-any.whl

Download URL podstack-1.9.0-py3-none-any.whl
Size 47.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
db4480275518323f1c00a248f62e9968cb8d4fd4380039c5222e9e1bc3dd657b
BLAKE2b-256 checksum
How to use checksums
4ef8acd1902040ec90d5f503f1b65b01dc118d4adaaddfae05c71ae15ffa11bc
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.9.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.9.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