---
title: Python SDK
description: >-
  The Lightning Cloud Python SDK, vpcloud_client, covers the whole public API:
  fleets, nodes, Managed Kubernetes, storage, health, and the Observability API.
  It gets and refreshes tokens for you from an Application Principal's client ID
  and secret, so your code never handles one.
canonical: 'https://lightning.ai/docs/platform/cluster/get-started/python-sdk'
---
# Python SDK {#python-sdk}

The Lightning Cloud Python SDK, `vpcloud_client`, covers the whole public API: fleets, nodes, Managed Kubernetes, storage, health, and the [Observability API](/docs/platform/cluster/observability/overview.md). It gets and refreshes tokens for you from an [Application Principal](/docs/platform/cluster/access/authentication.md#principals)'s client ID and secret, so your code never handles one.

## Install {#install}

Python 3.9 or later. Install into a virtual environment, because many systems refuse a system-wide `pip install`.

```bash
git clone https://github.com/voltagepark/vp-cloud-sdk.git
cd vp-cloud-sdk
python3 -m venv .venv
source .venv/bin/activate
pip install .
```

Or with [uv](https://docs.astral.sh/uv/): `uv sync && source .venv/bin/activate`.

## Configure {#configure}

Export your Application Principal's credentials. Keep the secret in a secrets manager, not in source control.

```bash
export VPCLOUD_CLIENT_ID=<client id>
export VPCLOUD_CLIENT_SECRET=<client secret>
```

```python
import vpcloud_client

configuration = vpcloud_client.Configuration()                                       # sea1
# configuration = vpcloud_client.Configuration(host="https://api.iad1.voltagepark.com")  # another region
```

| Setting | Default | Controls |
|---------|---------|----------|
| `host` | `https://api.sea1.voltagepark.com` | The [regional API endpoint](/docs/platform/cluster/get-started/regions.md) for fleets, nodes, Kubernetes, and storage |
| `observatory_host` (or `VPCLOUD_OBSERVATORY_HOST`) | `https://observatory.voltagepark.com` | The [Observability API](/docs/platform/cluster/observability/overview.md#endpoint-and-tokens) endpoint |

The SDK keeps a separate token for each API and sends each request the right one. A token is never sent to an API it wasn't issued for.

## First calls {#first-calls}

```python
with vpcloud_client.ApiClient(configuration) as api_client:
    for fleet in vpcloud_client.FleetsApi(api_client).list_fleets().fleets:
        print(fleet.fleet_id, fleet.name, fleet.status)

    for cluster in vpcloud_client.ClustersApi(api_client).resolve_clusters().clusters or []:
        print(cluster.cluster_id, cluster.metrics_ready, cluster.logs_ready)
```

## What's in the SDK {#what-s-in-the-sdk}

| Module | Covers | Guide |
|--------|--------|-------|
| `FleetsApi`, `NodesApi`, `NodeOperationsApi`, `SSHKeysApi` | Fleets, fleet history and health, nodes, node power, SSH keys | [Fleets](/docs/platform/cluster/fleets-and-nodes/fleets.md), [Nodes](/docs/platform/cluster/fleets-and-nodes/nodes.md), [Fleet health](/docs/platform/cluster/monitoring/fleet-health.md), [SSH keys](/docs/platform/cluster/access/ssh-keys.md) |
| `KubernetesApi`, `StorageApi`, `FleetOperationsApi` | Managed Kubernetes clusters and worker maintenance, storage views | [Managed Kubernetes](/docs/platform/cluster/managed-kubernetes.md), [Storage views](/docs/platform/cluster/storage-views.md) |
| `MonitoringApi`, `ClusterValidationApi`, `AuditApi` | Monitoring dashboards, cluster validation, your account's audit log | [Monitoring dashboards](/docs/platform/cluster/monitoring/dashboards.md), [Cluster validation](/docs/platform/cluster/monitoring/cluster-validation.md), [Audit logs](/docs/platform/cluster/audit-logs.md) |
| `MetricsApi` | PromQL for one cluster or your organization | [Metrics](/docs/platform/cluster/observability/metrics.md) |
| `LogsApi` | LogsQL over a cluster's logs | [Logs](/docs/platform/cluster/observability/logs.md) |
| `KubernetesAuditApi` | A cluster's Kubernetes audit log | [Kubernetes audit](/docs/platform/cluster/observability/kubernetes-audit.md) |
| `ClustersApi` | Your clusters and the endpoint that serves each | [Find your clusters](/docs/platform/cluster/observability/overview.md#find-your-clusters) |
| `vpcloud_client.results` | `decode_result` turns metrics responses into series and samples; `decode_json_lines` decodes log lines and audit events | [Metrics](/docs/platform/cluster/observability/metrics.md) |
| `vpcloud_client.streaming` | `watch` and `tail` (and `awatch`, `atail` for asyncio) follow metrics and logs live | [Streaming metrics](/docs/platform/cluster/observability/metrics.md#stream-metrics-live), [Tailing logs](/docs/platform/cluster/observability/logs.md#tail-logs-live) |

Every `*Api` method has a `*_with_http_info` variant that also returns the status code and headers. Errors raise `vpcloud_client.rest.ApiException`, with `status` and the response `body`.

---

**Navigation**

- Parent: [Get started](/docs/platform/cluster/get-started.md)
