leptonai
Lepton AI Platform
What it is and what it does
Lepton AI is a Python framework that wraps research and modeling code into deployable AI services. You define a Photon class with handler methods, and the framework exposes them as HTTP endpoints with automatic documentation, client bindings, and built-in features like autobatching and background jobs. It includes shortcuts to launch popular models from HuggingFace (like GPT-2, Llama2, SDXL, Whisper) with a single command, and provides a Python client that lets you call your service as if it were a local function.
The package is built on fastapi and uvicorn for the service layer, ray for distributed compute, and integrates with huggingface_hub for model loading. It's designed for researchers and ML engineers who want to turn a notebook or script into a production-ready service without writing boilerplate HTTP code.
Use it for:
- Launch a HuggingFace model (e.g., GPT-2, Llama2) as a local HTTP service with one CLI command.
- Wrap custom Python ML code into a service by decorating handler methods with @Photon.handler.
- Build a text-to-image service using prebuilt examples like SDXL and access it via Python client or Gradio UI.
- Deploy background jobs and autobatch requests across multiple GPU workers using ray integration.
- Serve multiple models from a single Photon class and call them as native Python functions from a client.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Lepton AI is a Python framework for building and deploying AI services from research and modeling code, with built-in support for launching HuggingFace models, autobatching, background jobs, and a client for calling services as native Python functions.
Yes, if you need to quickly turn Python ML code or HuggingFace models into a service. The framework is actively maintained, has low install friction, and abstracts away HTTP boilerplate. Verify the license status before use in proprietary projects. Not suitable if you need deep control over HTTP routing or prefer a lower-level framework.
Install
leptonai on PyPI
pip
pip install leptonaiuv
uv add leptonaipoetry
poetry add leptonaiInstalling leptonai
Before you install
Low install friction with a pure-Python wheel. Active maintenance with a release within the last 70 days. Depends on 20 runtime packages including fastapi, uvicorn, ray, and huggingface_hub, which are all standard ecosystem tools.
Quickstart
pip install -U leptonai
from leptonai.photon import Photon
class Echo(Photon):
@Photon.handler
def echo(self, inputs: str) -> str:
return inputs
# Then run: lep photon runlocal -n echo -m my_photon.py
# Access with:
from leptonai.client import Client, local
c = Client(local(port=8080))
c.echo(inputs="hello world")
Verify before relying
- Whether the Apache 2.0 license mentioned in the description excerpt is the authoritative license (meta.license_spdx is null).
- Whether all HuggingFace models work or only standard pipelines, as the description notes custom-code models are not supported.
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (<3.14,>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 20 — anyio, click, cloudpickle, contextlib2, exceptiongroup, fastapi, httpx, prometheus-fastapi-instrumentator, rich, typing-extensions, uvicorn, loguru, requests, pydantic, python-multipart, pillow, pyyaml, huggingface_hub, ledoc-ui, ray |
| Maintenance | actively maintained — 70 days since the last release |
| First released | |
| Downloads | 580,469/month — #5,912 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: leptonai-0.27.3-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
vastaiProvides a CLI and Python SDK for managing GPU…
permissive · top 5,000 on PyPI
datarobot-genaiA toolkit for building and deploying AI agents…
permissive · top 15,000 on PyPI
aip-agents-binaryA local execution agent library for building…
unclear · top 15,000 on PyPI
ai-parrotAI-Parrot is an async-first Python framework…
permissive · top 15,000 on PyPI
mlx-vlmMLX-VLM runs vision language models and omni…
permissive · top 5,000 on PyPI
crewai-coreProvides shared utilities, telemetry, and…
unclear · top 5,000 on PyPI
pipecat-aiPipecat is a Python framework for building…
permissive · top 5,000 on PyPI
ouroboros-aiOuroboros is an Agent OS that turns vague AI…
permissive · top 15,000 on PyPI
crewaiCrewAI is a Python framework for building…
unclear · top 5,000 on PyPI