Skip to main content

lamina-sdk

Async-first Python SDK for Lamina video generation. Duration values are whole minutes, from 1 to 5.

Install

pip install lamina-sdk

Python 3.11 or newer is required.

Quick Start

from lamina import simi

async with simi(api_key="lamina_live_your_key") as client:
    video = await client.generate("A blue sphere moving across white background", duration=1)
    await video.save("out.mp4")

You can also set LAMINA_API_KEY and call simi() with no arguments. Requests go to https://api.laminalabs.ai unless you set base_url=....

Submit And Stream Events

from lamina import simi

async with simi(api_key="lamina_live_your_key") as client:
    job = await client.submit_async(
        "A blue sphere moving across white background",
        duration=1,
        document="brief.txt",
    )

    async for event in client.stream_events(job):
        if event.is_progress():
            print(event.payload["phase"], event.payload.get("progress"))
        else:
            print(event.type)

Events use a small public vocabulary: progress, chunk, output, job.completed, job.failed, and job.cancelled. If the stream drops, the SDK reconnects and resumes from the last sequence it delivered, so you will not see an event twice.

Callback Style

from lamina import simi

async with simi(api_key="lamina_live_your_key") as lamina:
    job = await lamina.submit_async("A narrated lesson about derivatives")
    job.onstream(lambda event: print(event.type))
    job.oncompletion(lambda video: print(f"Ready: {video.job_id}"))
    await job.wait()

Listing And Cancelling

async with simi() as client:
    jobs = await client.list_jobs(limit=10, status="complete")
    for job in jobs:
        print(job.job_id, job.status)

    await client.cancel("job_abc123")

Organizations And Billing

If your key belongs to an organization manager and carries the organizations:write scope, you can provision managed end-users, mint embed tokens for them, and schedule generation on their behalf. This is the path for mirroring your own users into Lamina.

async with simi() as client:
    created = await client.organizations.create_managed_user(
        org_id, username="ada", password="a-strong-password"
    )
    print(created.login_email)

    embed = await client.organizations.create_embed_token(org_id, "ada")
    # Hand embed.token to your frontend to render the player as that user.

    await client.organizations.create_schedule(
        org_id,
        "ada",
        prompt="Weekly product recap",
        scheduled_at="2026-09-01T15:00:00Z",
        duration=2,
        language="English",
    )

With the billing:read scope you can read credits and usage, which is what you need to meter and bill your own customers.

async with simi() as client:
    credits = await client.billing.credits()
    print(credits.available_credits, credits.credit_buckets)

    usage = await client.billing.usage(limit=100)

Creating or renaming an organization, and adding or removing human members, requires a signed-in dashboard session and cannot be done with an API key.

Retries And Errors

Reads are retried automatically on 429 and 5xx with exponential backoff, honouring retry-after. A submit is only retried when you pass an idempotency_key, so a retry can never create a second video.

from lamina import LaminaRateLimitError, simi

async with simi(max_retries=3) as client:
    try:
        job = await client.submit_async("Explain our refund policy", idempotency_key="req-1")
    except LaminaRateLimitError as error:
        print(error.status, error.retry_after, error.request_id)

Errors all derive from LaminaError: LaminaAPIError (with status, request_id, and retry_after), LaminaRateLimitError, LaminaJobError, LaminaStreamError, LaminaDownloadError, and LaminaCancelledError.

Public API

  • job = lamina.submit(prompt, *, duration=1, document=None, language=None, idempotency_key=None)
  • job = await lamina.submit_async(...) — same arguments
  • video = await lamina.generate(...) — same arguments, waits for completion
  • jobs = await lamina.list_jobs(*, limit=20, cursor=None, status=None)
  • state = await lamina.cancel(job_or_id)
  • playback = await lamina.get_playback(job_or_video_or_id)
  • await lamina.save(job_or_video, path)
  • await lamina.aclose() or async with simi()
  • api_key is required in simi(...) unless LAMINA_API_KEY is set.
  • duration is in minutes (1-5).

Use async with in async code. with is supported only outside a running event loop and will tell you so if you get it wrong.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lamina_sdk-0.2.0.tar.gz (29.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lamina_sdk-0.2.0-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file lamina_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: lamina_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 29.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for lamina_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9fab25e059e31ff13b1f1ec8cbfa55a5f055c0215a8b9efd9e06b9b23cc7cd07
MD5 3502508980749c1def8d65de27f57096
BLAKE2b-256 d74f055b00f2a954147637232ba76108a8973d0ff18f0fb54c13eb6075788b95

See more details on using hashes here.

File details

Details for the file lamina_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: lamina_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for lamina_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3a4ece0b571606acc7a6b7e97315544bcaa1a8cb1e3235cb66a3ef94193a85c6
MD5 ab8ba4c436149bdef94fbc524a1b5626
BLAKE2b-256 a6ea98760be846de09737778e3ddf89f55989f2ab13f99ff4d272dc66fe3ce42

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.0

2 files

This release

0.2.0 This release

2 files

0.1.4

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page