Skip to main content

Kuberoute Python SDK

Official Python SDK for Kuberoute AI — Intelligent Kubernetes Workload Placement & Cost Optimization.

Installation

pip install kuberoute

Or install in editable mode from this monorepo:

pip install -e packages/sdk-python

Quickstart

Synchronous Usage

from kuberoute import KubeRoute

# Initialize the client
client = KubeRoute(
    base_url="http://localhost:8080", # or https://api.kuberoute.ai
    token="your-jwt-token"            # or KUBEROUTE_TOKEN env var
)

# In local dev mode, you can log in directly:
client.login_dev()

# Check health
health = client.health()
print(f"Server status: {health.status}")

# List registered Kubernetes clusters
clusters = client.clusters.list()
for cluster in clusters.clusters:
    print(f"Cluster: {cluster.name} ({cluster.provider}/{cluster.region})")

# Register a new cluster
new_cluster = client.clusters.create(
    name="production-eks",
    provider="aws",
    region="us-west-2"
)
print(f"Registered cluster ID: {new_cluster.id}")

# Fetch routing & placement decisions
decisions = client.decisions.list(cluster_id=new_cluster.id)
for d in decisions.decisions:
    print(f"Decision: {d.id} | Savings: ${d.predicted_cost_savings}/mo | Reason: {d.reason}")
    if d.confidence_score > 0.9:
        client.decisions.apply(cluster_id=new_cluster.id, decision_id=d.id)
        print("Applied decision!")

# Get aggregate infrastructure costs and savings
costs = client.costs.get_total()
print(f"Total: ${costs.total} | Optimized: ${costs.optimized} | Savings: ${costs.savings}")

Asynchronous Usage (AsyncKubeRoute)

import asyncio
from kuberoute import AsyncKubeRoute

async def main():
    async with AsyncKubeRoute(base_url="http://localhost:8080", token="your-token") as client:
        clusters = await client.clusters.list()
        print(f"Found {clusters.total} clusters")

asyncio.run(main())

Resources

  • client.clusters: list(), get(id), create(name, provider, region), delete(id)
  • client.decisions: list(cluster_id, status, page, limit), get(cluster_id, decision_id), apply(...), reject(...), revert(...)
  • client.costs: get_total(), get_cluster(cluster_id)
  • client.me(): Get current authenticated user and tenant credit stats.

Metadata

Release files for kuberoute 0.1.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 kuberoute 0.1.0
File Size Uploaded
kuberoute-0.1.0.tar.gz 6.6 kB Details

Built distribution (wheel)

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

Total release size: 14.5 kB

Release files / kuberoute-0.1.0.tar.gz

Download URL kuberoute-0.1.0.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fc75f45e0100bad20f38490ac78f1456ba78acab88657653f55e9e2f55243d7a
BLAKE2b-256 checksum
How to use checksums
990824267744f6c718a37002e0485cc258edf5e6d8737c1e4a5aced1ac445a61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / kuberoute-0.1.0-py3-none-any.whl

Download URL kuberoute-0.1.0-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea4538594a8df1153e5dd426a781c40882eb405c5bcc70eed88cdbb55b0a6229
BLAKE2b-256 checksum
How to use checksums
6f63b75b4d40079749d6e4eb5678b9189cc4523d50cc516d80d23907930d49c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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