Lepton AI
The Python library and lep CLI for NVIDIA DGX Cloud Lepton
Homepage •
Examples •
Documentation •
CLI References
The LeptonAI Python library lets you operate the NVIDIA DGX Cloud Lepton platform from Python and the command line. Key features include:
- A
lep command-line tool to create and manage endpoints, Dynamo graph deployments, batch jobs, dev pods, Ray clusters, fine-tuning jobs, storage, secrets, and more, plus inspect managed Slurm clusters and jobs.
- Pythonic configuration specs that are readily shipped to the cloud.
- Skills that let agents operate the Lepton platform for you.
Getting started
Install the library, which also installs the lep command-line tool:
pip install -U leptonai
To install the latest development version from the main branch (requires Git):
pip install -U "git+https://github.com/leptonai/leptonai.git@main"
Log in to your workspace (this opens a browser to fetch credentials if you don't pass them in):
lep login
Deploy a container image as an endpoint, then inspect it:
lep endpoint create -n my-endpoint --container-image my-registry/my-app:latest \
--resource-shape gpu.a10 --node-group my-node-group
lep endpoint list
lep endpoint status -n my-endpoint
In workspaces with secure endpoint defaults enabled, an endpoint created without
--tokens is protected automatically. The create command prints the generated API
token; save that value so clients can authenticate. You can instead provide one or
more repeatable --tokens values, or explicitly opt out with
--allow-unauthenticated-access (the CLI displays a warning). The --public option
only controls IP reachability and does not disable API-token authentication.
lep endpoint status reports these dimensions separately as IP Access and
API Token Authentication.
SDK callers that leave endpoint authentication unspecified should use
client.deployment.create_with_response(...) and save the token from the returned
resource. The older create(...) method keeps its boolean return contract and cannot
return a server-generated credential, so it emits a RuntimeWarning for requests that
may ask the server to generate one. SDK updates may not clear api_tokens by sending
an empty list alone: set allow_unauthenticated_access=true in the same update, or
replace the list with at least one token.
lep endpoint get redacts literal tokens by default. Use --show-tokens only when you
need a credential-bearing response or reusable spec export, and handle that output as
a secret. The former hidden update --remove-tokens option is rejected; use
--allow-unauthenticated-access for an explicit opt-out.
Authentication-mode updates are explicit:
# Replace tokens and enable token authentication
lep endpoint update -n my-endpoint --tokens MY_TOKEN
# Clear tokens and explicitly allow requests without API-token authentication
lep endpoint update -n my-endpoint --allow-unauthenticated-access
You can also launch batch jobs and dev pods:
# Run a batch job
lep job create -n my-job --container-image my-registry/my-trainer:latest --command "python train.py" \
--resource-shape gpu.a10 --node-group my-node-group
# Launch an interactive dev pod
lep pod create -n my-pod --resource-shape gpu.a10 --node-group my-node-group
# Open a shell in the pod through the workspace API (no SSH setup needed)
lep pod shell -n my-pod
# Connect to a pod with Teleport SSH enabled (requires local tsh)
lep pod ssh -n my-pod --transport teleport
lep pod shell, lep endpoint shell, lep job shell, and lep raycluster shell
open the same interactive shell as the dashboard terminal. The session is
tunnelled through the workspace API over HTTPS, so it needs no SSH key, public
IP, or Teleport client. They follow the dashboard's rules: a pod must be Ready
and opens in its newest replica, an endpoint or job with several running
replicas requires --replica, archived jobs and platform-managed tuning jobs
have no shell, and a Ray cluster shell opens on the head node of a cluster that
is not stopped unless --replica selects another node. Idle shells send a
keepalive so the workspace ingress does not close them.
Teleport SSH commands require tsh v18 or newer in your PATH. The CLI checks
the client version before reading login profiles or starting SSO; missing, older,
or unrecognized clients produce an actionable error. This minimum version check
does not guarantee compatibility with every Teleport cluster version.