---
agent:
  instructions: "Search the site by keyword or question. The search API returns Markdown."
  endpoint: "https://platform.invideo.io/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Luma

> Generate video and images through Platform with the Luma SDK and Dream Machine’s API format.

Base URL:

```text
https://platform-api.invideo.io/luma
```


```python
import os, time
from lumaai import LumaAI

client = LumaAI(auth_token=os.environ["INVIDEO_API_KEY"], base_url="https://platform-api.invideo.io/luma/dream-machine/v1")
generation = client.generations.create(prompt="A red fox running through snow", model="veo-3-fast", duration="4s")
while (generation := client.generations.get(generation.id)).state in ("queued", "dreaming"):
    time.sleep(5)
if generation.state != "completed":
    raise RuntimeError(generation.failure_reason or f"Generation ended in {generation.state}")
print(generation.assets.video)
```

Routes: `POST /dream-machine/v1/generations` (video), `/generations/image`, `GET /dream-machine/v1/generations/{id}`. `keyframes.frame0` and `frame1` are the first and last frame. `callback_url` is not supported yet.
