---
title: API Reference
description: The Lightning SDK is the Python interface for managing Lightning AI resources
canonical: 'https://lightning.ai/docs/sdk/stable/api'
---
# API Reference {#api-reference}

The Lightning SDK is the Python interface for managing Lightning AI resources
from scripts, notebooks, services, and CI jobs. Use it when you need the same
resource control exposed by the CLI, but want it inside Python code with typed
objects, method references, and reusable application logic.

## Install {#install}

Install or upgrade the package:

```bash
pip install lightning-sdk -U
```

## Authenticate {#authenticate}

For local development, authenticate once with the CLI:

```bash
lightning login
```

For automation, configure credentials with environment variables:

```bash
export LIGHTNING_API_KEY=your-api-key
```

## Core Resources {#core-resources}

Studios are persistent development environments. Start with
[`Studio`](/docs/sdk/2026.11.04/api/studio.md#lightning_sdk.Studio) when you need to create or control an
interactive workspace, and use [`Machine`](/docs/sdk/2026.11.04/api/machine.md#lightning_sdk.Machine) when selecting compute.

Jobs run code in managed cloud compute. Use [`lightning_sdk.Job.run`](/docs/sdk/2026.11.04/api/job.md#lightning_sdk.Job.run) for
single-node work and [`lightning_sdk.MMT.run`](/docs/sdk/2026.11.04/api/mmt.md#lightning_sdk.MMT.run) for multi-machine training.

Deployments turn model servers and applications into managed services. Use
[`Deployment`](/docs/sdk/2026.11.04/api/deployment.md#lightning_sdk.Deployment) with the deployment helper classes in
[Deployment](/docs/sdk/2026.11.04/api/deployment.md) for environment variables, secrets, authentication,
health checks, and rollout behavior.

Teamspaces, organizations, and users define the account context for SDK calls.
Use [`Teamspace`](/docs/sdk/2026.11.04/api/teamspace.md#lightning_sdk.Teamspace), [`Organization`](/docs/sdk/2026.11.04/api/organization.md#lightning_sdk.Organization),
and [`User`](/docs/sdk/2026.11.04/api/user.md#lightning_sdk.User) when you need to resolve or switch the scope
of an operation.

Use [`Organization`](/docs/sdk/2026.11.04/api/organization.md#lightning_sdk.Organization) to query usage/cost activity for an
organization, or one or more of its teamspaces, and to download or export
that activity as a CSV or JSON report.

## Quick Example {#quick-example}

```python
from lightning_sdk import Machine, Studio

studio = Studio("my-studio")
studio.start()

job = studio.run("python train.py", machine=Machine.A10G)
job.wait()

studio.stop()
```

## Reference Pages {#reference-pages}

- [Studio](/docs/sdk/2026.11.04/api/studio.md)
- [Job](/docs/sdk/2026.11.04/api/job.md)
- [Machine](/docs/sdk/2026.11.04/api/machine.md)
- [Teamspace](/docs/sdk/2026.11.04/api/teamspace.md)
- [Multi-Machine Training](/docs/sdk/2026.11.04/api/mmt.md)
- [Deployment](/docs/sdk/2026.11.04/api/deployment.md)
- [Agent](/docs/sdk/2026.11.04/api/agent.md)
- [K8s Cluster](/docs/sdk/2026.11.04/api/k8s-cluster.md)
- [Owner](/docs/sdk/2026.11.04/api/owner.md)
- [Organization](/docs/sdk/2026.11.04/api/organization.md)
- [User](/docs/sdk/2026.11.04/api/user.md)
- [Status](/docs/sdk/2026.11.04/api/status.md)
- [Models](/docs/sdk/2026.11.04/api/models.md)
- [Experiment](/docs/sdk/2026.11.04/api/experiment.md)

---

**Navigation**

- Parent: [Lightning SDK](/docs/sdk/2026.11.04.md)
- Children:
  - [Studio](/docs/sdk/2026.11.04/api/studio.md)
  - [Job](/docs/sdk/2026.11.04/api/job.md)
  - [Machine](/docs/sdk/2026.11.04/api/machine.md)
  - [Teamspace](/docs/sdk/2026.11.04/api/teamspace.md)
  - [Multi-Machine Training](/docs/sdk/2026.11.04/api/mmt.md)
  - [Deployment](/docs/sdk/2026.11.04/api/deployment.md)
  - [Agent](/docs/sdk/2026.11.04/api/agent.md)
  - [K8s Cluster](/docs/sdk/2026.11.04/api/k8s-cluster.md)
  - [Owner](/docs/sdk/2026.11.04/api/owner.md)
  - [Organization](/docs/sdk/2026.11.04/api/organization.md)
  - [User](/docs/sdk/2026.11.04/api/user.md)
  - [Status](/docs/sdk/2026.11.04/api/status.md)
  - [Models](/docs/sdk/2026.11.04/api/models.md)
  - [Experiment](/docs/sdk/2026.11.04/api/experiment.md)
