Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.livepeer.org/llms.txt

Use this file to discover all available pages before exploring further.


Two official SDKs wrap the Livepeer AI gateway REST API: @livepeer/ai for JavaScript and TypeScript, and livepeer-ai for Python. Both are generated programmatically from the ai-runner OpenAPI specification and cover the same set of pipeline endpoints.
@livepeer/ai is in alpha. Pin your dependency to a specific version to avoid unintended breaking changes on update.

@livepeer/ai

The JavaScript SDK supports Node.js, Bun, and browser runtimes. It requires zod as a peer dependency. Installation:
npm install @livepeer/ai zod
# or
yarn add @livepeer/ai zod
# or
pnpm add @livepeer/ai zod
Initialisation:
import { Livepeer } from '@livepeer/ai';

const livepeer = new Livepeer({
  httpBearer: '<YOUR_GATEWAY_TOKEN>',
});
For development against the public community gateway at dream-gateway.livepeer.cloud, no bearer token is required. Pass an empty string or omit the field for unauthenticated access. Text-to-image example:
import { Livepeer } from '@livepeer/ai';

const livepeer = new Livepeer({
  httpBearer: '',
});

const result = await livepeer.generate.textToImage({
  modelId: 'ByteDance/SDXL-Lightning',
  prompt: 'A fox sitting on a moonlit rooftop',
  width: 1024,
  height: 1024,
});

console.log(result.imageResponse?.images?.[0]?.url);
Error handling: The SDK throws typed errors. SDKValidationError indicates the response did not match the expected schema. HTTPError covers gateway-level HTTP errors.
import { Livepeer } from '@livepeer/ai';
import { HTTPError, SDKValidationError } from '@livepeer/ai/models/errors';

try {
  const result = await livepeer.generate.textToImage({ ... });
} catch (err) {
  if (err instanceof SDKValidationError) {
    console.error(err.pretty());
  } else if (err instanceof HTTPError) {
    console.error(err.statusCode, err.body);
  }
}
Custom gateway URL:
const livepeer = new Livepeer({
  serverURL: 'https://your-gateway.example.com',
  httpBearer: '<YOUR_TOKEN>',
});

Livepeer AI

The Python SDK supports Python 3.8 and later. Installation:
pip install livepeer-ai
Initialisation:
from livepeer_ai import Livepeer

client = Livepeer(
    http_bearer='<YOUR_GATEWAY_TOKEN>',
)
Text-to-image example:
from livepeer_ai import Livepeer
from livepeer_ai.models import components

client = Livepeer(http_bearer='')

result = client.generate.text_to_image(
    components.TextToImageParams(
        model_id='ByteDance/SDXL-Lightning',
        prompt='A fox sitting on a moonlit rooftop',
        width=1024,
        height=1024,
    )
)

print(result.image_response.images[0].url)
Async usage: The Python SDK exposes an async client for use in async applications:
import asyncio
from livepeer_ai import AsyncLivepeer
from livepeer_ai.models import components

async def main():
    client = AsyncLivepeer(http_bearer='')
    result = await client.generate.text_to_image(
        components.TextToImageParams(
            model_id='ByteDance/SDXL-Lightning',
            prompt='A fox sitting on a moonlit rooftop',
        )
    )
    print(result.image_response.images[0].url)

asyncio.run(main())

Pipeline Method Reference

Both SDKs expose a generate namespace containing one method per pipeline type. The method names use camelCase in JavaScript and snake_case in Python.

Repositories and Versioning

Both SDKs are generated from the ai-runner OpenAPI spec and published independently:
  • JavaScript: github.com/livepeer/livepeer-ai-js: published to npm as @livepeer/ai
  • Python: github.com/livepeer/livepeer-ai-python: published to PyPI as livepeer-ai
The deprecated livepeer/livepeer-ai-sdks repository contains older auto-generated SDKs and is no longer maintained. The AI SDKs wrap the gateway inference endpoints. For the full endpoint reference with request schemas and curl examples, see AI pipelines.

AI Pipelines

Endpoint shapes and curl examples for all nine pipeline types.

AI Jobs Quickstart

First API call in under ten minutes using curl or the SDK.

AI API Reference

Full OpenAPI-derived schema reference for all pipeline endpoints.

Overview

Pipeline categories and access model overview.
Last modified on May 19, 2026