Skip to main content

Python client for RunPod Cloud REST API

Project description

RunPod Management

A Python client for the RunPod Cloud REST API.

Features

  • Full pod lifecycle management (create, list, get, update, delete)
  • Pod control operations (start, stop, restart)
  • Container registry authentication management (CRUD)
  • Account information: balance, spend, and quota via GraphQL API
  • Type-safe Pydantic models for all requests and responses
  • Configuration via environment variables or programmatic setup
  • Comprehensive error handling

Installation

pip install -e .

Quick Start

  1. Set your API key:
export RUNPOD_API_KEY=your_api_key_here
  1. Use the clients:
from evolvishub_runpod_management import AccountInfoClient, PodClient, ContainerRegistryAuthClient, PodCreateInput

# Account information
with AccountInfoClient.initialize() as client:
    balance = client.get_balance()
    print(f"Credit balance: ${balance.credit_balance}")
    print(f"Current spend/hr: ${balance.current_spend_per_hr}")
from evolvishub_runpod_management import PodClient, ContainerRegistryAuthClient, PodCreateInput

# Pod management
with PodClient.initialize() as client:
    # Create a pod
    pod = client.create_pod(PodCreateInput(
        image_name="runpod/pytorch:2.0.0-py3.10-cuda11.8.0-devel",
        name="my-pod",
        gpu_type_ids=["NVIDIA RTX A4000"],
        container_disk_in_gb=50,
    ))
    print(f"Created: {pod.id}")

    # List all pods
    for p in client.list_pods():
        print(f"{p.id}: {p.name} - {p.desired_status}")

    # Stop the pod
    client.stop_pod(pod.id)

# Container registry auth management
from evolvishub_runpod_management import ContainerRegistryAuthCreateInput

with ContainerRegistryAuthClient.initialize() as client:
    # Create credentials
    auth = client.create(ContainerRegistryAuthCreateInput(
        name="my-docker-hub",
        username="myuser",
        password="mypassword",
    ))
    print(f"Created auth: {auth.id}")

    # List all credentials
    for a in client.list():
        print(f"{a.id}: {a.name}")

Documentation

See docs/usage.md for full API reference and examples.

Development

# Install with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Lint
ruff check evolvishub_runpod_management/ tests/

License

MIT

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

evolvishub_runpod_management-0.2.0.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

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

evolvishub_runpod_management-0.2.0-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for evolvishub_runpod_management-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a1b28d25f07465760866c622c4a7f72c81bdade1c2e9915c99c787ed7b6b2baf
MD5 fc52808466d053d0c25e45499aae795d
BLAKE2b-256 98827961922393bd8e2332f1471641043e82a996fc017fe83987837a2358746b

See more details on using hashes here.

Provenance

The following attestation bundles were made for evolvishub_runpod_management-0.2.0.tar.gz:

Publisher: publish-prod.yml on evolvisai/evolvishub-runpod-management

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for evolvishub_runpod_management-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bfeeaea31d0418cd515299a07fedddef888b490f2d5ffaea70bed45433c1b0d8
MD5 1adcfc902b97047a6680da586c8e3f83
BLAKE2b-256 3f351ca575320615c8e6ba68ae420b7739b4cf41b51d0f5593081d12c335af50

See more details on using hashes here.

Provenance

The following attestation bundles were made for evolvishub_runpod_management-0.2.0-py3-none-any.whl:

Publisher: publish-prod.yml on evolvisai/evolvishub-runpod-management

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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