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_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_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_your_key") as client:
job = await client.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")
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 Simi, SimiRateLimitError
async with Simi(max_retries=3) as client:
try:
job = await client.submit_async("Explain our refund policy", idempotency_key="req-1")
except SimiRateLimitError as error:
print(error.status, error.retry_after, error.request_id)
Errors all derive from SimiError: SimiAPIError (with status, request_id, and
retry_after), SimiRateLimitError, SimiJobError, SimiStreamError,
SimiDownloadError, and SimiCancelledError.
Public API
job = client.submit(prompt, *, duration=1, document=None, language=None, idempotency_key=None)job = await client.submit_async(...)— same argumentsvideo = await client.generate(...)— same arguments, waits for completionjobs = await client.list_jobs(*, limit=20, cursor=None, status=None)state = await client.cancel(job_or_id)playback = await client.get_playback(job_or_video_or_id)await client.save(job_or_video, path)await client.aclose()orasync with Simi()api_keyis required inSimi(...)unlessLAMINA_API_KEYis set.durationis 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lamina_sdk-0.3.0.tar.gz.
File metadata
- Download URL: lamina_sdk-0.3.0.tar.gz
- Upload date:
- Size: 28.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
927dc477857bad407bbb0a6543acc6ffe53ca6cdb01658c9ba0557ceca97ea00
|
|
| MD5 |
181dd940d29184a7682a046ddcfa9aac
|
|
| BLAKE2b-256 |
63eda2ffdfcad2c53279f62331622e143aa1d764a1f314e451afbc83ced7c4aa
|
File details
Details for the file lamina_sdk-0.3.0-py3-none-any.whl.
File metadata
- Download URL: lamina_sdk-0.3.0-py3-none-any.whl
- Upload date:
- Size: 22.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e04d2914dc67093acca198078252dd6317f56a03690e329542c38289dd8d7c36
|
|
| MD5 |
c25e245676a004d56ca32638fd558c08
|
|
| BLAKE2b-256 |
3ee80559457f3488021ad875b4e52dbe06b5581e929931cec9c4f12a4048e9a2
|