Luma Ray 3.2
luma-ray-3-2 · Video · unitool
Видеомодель Luma нового поколения: генерация по тексту и картинке, переход из первого кадра в последний, монтаж готового ролика по промпту, смена формата кадра, HDR и бесшовный цикл.
Generations are async: create, wait or poll, the result by link for 7 days. Details: Media generations
Генерация видео
Mode t2v · luma-ray-3-2:t2v
Price
Depends on the parameters: 48 tokens for the example below, base 48. Get the exact price of your request from POST /v1/quotes.
Price make-up (pricing from GET /v1/models/{id})
{
"unit": "tokens",
"kind": "by_parameters",
"base": 48,
"example_price": 48,
"matrix": [
{
"when": {
"duration": "5",
"resolution": "360p"
},
"price": 10
},
{
"when": {
"duration": "10",
"resolution": "360p"
},
"price": 29
},
{
"when": {
"duration": "5",
"resolution": "540p"
},
"price": 24
},
{
"when": {
"duration": "10",
"resolution": "540p"
},
"price": 73
},
{
"when": {
"duration": "5",
"resolution": "720p"
},
"price": 48
},
{
"when": {
"duration": "10",
"resolution": "720p"
},
"price": 145
},
{
"when": {
"duration": "5",
"resolution": "1080p"
},
"price": 193
},
{
"when": {
"duration": "10",
"resolution": "1080p"
},
"price": 577
}
],
"addons": [
{
"when": {
"hdr": true
},
"multiply": 2
}
]
}Parameters
| Parameter | Type | Description |
|---|---|---|
promptrequired | string | |
aspect_ratio | 16:9 | 9:16 | 1:1 | 4:3 | 3:4 | 21:9 | Соотношение сторонDefault "16:9" |
resolution | 360p | 540p | 720p | 1080p | КачествоDefault "720p" |
duration | 5 | 10 | ДлительностьDefault "5" |
hdr | boolean | HDR. 16-битный цвет и расширенный динамический диапазон. Только 720p или 1080p и только 5 секунд. Дороже вдвое. Cannot be combined with: loop.Default false |
loop | boolean | Зациклить. Конец сшивается с началом — видео крутится без склейки. Только 5 секунд, несовместимо с HDR. Cannot be combined with: hdr.Default false |
image_urls | array of file (≤ 1) | A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
Example request
curl https://api.unitool.ai/v1/generations \
-H "Authorization: Bearer $UNITOOL_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Prefer: wait=60" \
-d '{
"model": "luma-ray-3-2",
"mode": "t2v",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "16:9",
"resolution": "720p",
"duration": "5",
"hdr": false,
"loop": false
}
}'import json, os, time, uuid, requests
API = "https://api.unitool.ai/v1"
headers = {"Authorization": f"Bearer {os.environ['UNITOOL_API_KEY']}"}
body = json.loads(r'''{
"model": "luma-ray-3-2",
"mode": "t2v",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "16:9",
"resolution": "720p",
"duration": "5",
"hdr": false,
"loop": false
}
}''')
gen = requests.post(f"{API}/generations", json=body,
headers={**headers, "Idempotency-Key": str(uuid.uuid4()), "Prefer": "wait=60"}).json()
while gen["status"] in ("queued", "running"):
time.sleep(5)
gen = requests.get(f"{API}/generations/{gen['id']}", headers=headers).json()
print(gen["status"], [o["url"] for o in gen["outputs"]])const API = "https://api.unitool.ai/v1";
const headers = { Authorization: `Bearer ${process.env.UNITOOL_API_KEY}`, "Content-Type": "application/json" };
const body = {
"model": "luma-ray-3-2",
"mode": "t2v",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "16:9",
"resolution": "720p",
"duration": "5",
"hdr": false,
"loop": false
}
};
let gen = await (await fetch(`${API}/generations`, {
method: "POST", body: JSON.stringify(body),
headers: { ...headers, "Idempotency-Key": crypto.randomUUID(), Prefer: "wait=60" },
})).json();
while (gen.status === "queued" || gen.status === "running") {
await new Promise((resolve) => setTimeout(resolve, 5000));
gen = await (await fetch(`${API}/generations/${gen.id}`, { headers })).json();
}
console.log(gen.status, gen.outputs.map((output) => output.url));Из первого кадра в последний
Mode frames · luma-ray-3-2:frames
Price
Depends on the parameters: 48 tokens for the example below, base 48. Get the exact price of your request from POST /v1/quotes.
Price make-up (pricing from GET /v1/models/{id})
{
"unit": "tokens",
"kind": "by_parameters",
"base": 48,
"example_price": 48,
"matrix": [
{
"when": {
"resolution": "360p"
},
"price": 10
},
{
"when": {
"resolution": "540p"
},
"price": 24
},
{
"when": {
"resolution": "720p"
},
"price": 48
},
{
"when": {
"resolution": "1080p"
},
"price": 193
}
],
"addons": [
{
"when": {
"hdr": true
},
"multiply": 2
}
]
}Parameters
| Parameter | Type | Description |
|---|---|---|
prompt | string | |
last_frame_urlrequired | file | Последний кадр. Обязателен: кадр, которым видео закончится. Первый кадр прикрепите скрепкой к сообщению. A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
aspect_ratio | 16:9 | 9:16 | 1:1 | 4:3 | 3:4 | 21:9 | Соотношение сторонDefault "16:9" |
resolution | 360p | 540p | 720p | 1080p | КачествоDefault "720p" |
hdr | boolean | HDR. 16-битный цвет. Только 720p или 1080p. Дороже вдвое.Default false |
image_urlsrequired | array of file (≤ 1) | A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
Example request
curl https://api.unitool.ai/v1/generations \
-H "Authorization: Bearer $UNITOOL_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Prefer: wait=60" \
-d '{
"model": "luma-ray-3-2",
"mode": "frames",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "16:9",
"resolution": "720p",
"hdr": false,
"last_frame_url": "https://example.com/input.png",
"image_urls": [
"https://example.com/input.png"
]
}
}'import json, os, time, uuid, requests
API = "https://api.unitool.ai/v1"
headers = {"Authorization": f"Bearer {os.environ['UNITOOL_API_KEY']}"}
body = json.loads(r'''{
"model": "luma-ray-3-2",
"mode": "frames",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "16:9",
"resolution": "720p",
"hdr": false,
"last_frame_url": "https://example.com/input.png",
"image_urls": [
"https://example.com/input.png"
]
}
}''')
gen = requests.post(f"{API}/generations", json=body,
headers={**headers, "Idempotency-Key": str(uuid.uuid4()), "Prefer": "wait=60"}).json()
while gen["status"] in ("queued", "running"):
time.sleep(5)
gen = requests.get(f"{API}/generations/{gen['id']}", headers=headers).json()
print(gen["status"], [o["url"] for o in gen["outputs"]])const API = "https://api.unitool.ai/v1";
const headers = { Authorization: `Bearer ${process.env.UNITOOL_API_KEY}`, "Content-Type": "application/json" };
const body = {
"model": "luma-ray-3-2",
"mode": "frames",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "16:9",
"resolution": "720p",
"hdr": false,
"last_frame_url": "https://example.com/input.png",
"image_urls": [
"https://example.com/input.png"
]
}
};
let gen = await (await fetch(`${API}/generations`, {
method: "POST", body: JSON.stringify(body),
headers: { ...headers, "Idempotency-Key": crypto.randomUUID(), Prefer: "wait=60" },
})).json();
while (gen.status === "queued" || gen.status === "running") {
await new Promise((resolve) => setTimeout(resolve, 5000));
gen = await (await fetch(`${API}/generations/${gen.id}`, { headers })).json();
}
console.log(gen.status, gen.outputs.map((output) => output.url));Монтаж готового видео
Mode edit · luma-ray-3-2:edit
Price
Depends on the parameters: 1 tokens for the example below, base 35. Get the exact price of your request from POST /v1/quotes.
Price make-up (pricing from GET /v1/models/{id})
{
"unit": "tokens",
"kind": "by_parameters",
"base": 35,
"example_price": 1,
"matrix": [
{
"when": {
"resolution": "360p"
},
"rate": 18,
"per": "video_url_duration_sec"
},
{
"when": {
"resolution": "540p"
},
"rate": 24,
"per": "video_url_duration_sec"
},
{
"when": {
"resolution": "720p"
},
"rate": 35,
"per": "video_url_duration_sec"
},
{
"when": {
"resolution": "1080p"
},
"rate": 70,
"per": "video_url_duration_sec"
}
]
}Parameters
| Parameter | Type | Description |
|---|---|---|
prompt | string | |
video_urlrequired | file | Исходное видео. Ролик до 18 секунд и до 200 МБ. Цена считается за каждую секунду исходника. A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
resolution | 360p | 540p | 720p | 1080p | КачествоDefault "720p" |
Example request
curl https://api.unitool.ai/v1/generations \
-H "Authorization: Bearer $UNITOOL_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Prefer: wait=60" \
-d '{
"model": "luma-ray-3-2",
"mode": "edit",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"resolution": "720p",
"video_url": "https://example.com/input.mp4"
}
}'import json, os, time, uuid, requests
API = "https://api.unitool.ai/v1"
headers = {"Authorization": f"Bearer {os.environ['UNITOOL_API_KEY']}"}
body = json.loads(r'''{
"model": "luma-ray-3-2",
"mode": "edit",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"resolution": "720p",
"video_url": "https://example.com/input.mp4"
}
}''')
gen = requests.post(f"{API}/generations", json=body,
headers={**headers, "Idempotency-Key": str(uuid.uuid4()), "Prefer": "wait=60"}).json()
while gen["status"] in ("queued", "running"):
time.sleep(5)
gen = requests.get(f"{API}/generations/{gen['id']}", headers=headers).json()
print(gen["status"], [o["url"] for o in gen["outputs"]])const API = "https://api.unitool.ai/v1";
const headers = { Authorization: `Bearer ${process.env.UNITOOL_API_KEY}`, "Content-Type": "application/json" };
const body = {
"model": "luma-ray-3-2",
"mode": "edit",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"resolution": "720p",
"video_url": "https://example.com/input.mp4"
}
};
let gen = await (await fetch(`${API}/generations`, {
method: "POST", body: JSON.stringify(body),
headers: { ...headers, "Idempotency-Key": crypto.randomUUID(), Prefer: "wait=60" },
})).json();
while (gen.status === "queued" || gen.status === "running") {
await new Promise((resolve) => setTimeout(resolve, 5000));
gen = await (await fetch(`${API}/generations/${gen.id}`, { headers })).json();
}
console.log(gen.status, gen.outputs.map((output) => output.url));Сменить формат кадра
Mode reframe · luma-ray-3-2:reframe
Price
Depends on the parameters: 1 tokens for the example below, base 20. Get the exact price of your request from POST /v1/quotes.
Price make-up (pricing from GET /v1/models/{id})
{
"unit": "tokens",
"kind": "by_parameters",
"base": 20,
"example_price": 1,
"matrix": [
{
"when": {
"resolution": "360p"
},
"rate": 5,
"per": "video_url_duration_sec"
},
{
"when": {
"resolution": "540p"
},
"rate": 10,
"per": "video_url_duration_sec"
},
{
"when": {
"resolution": "720p"
},
"rate": 20,
"per": "video_url_duration_sec"
},
{
"when": {
"resolution": "1080p"
},
"rate": 58,
"per": "video_url_duration_sec"
}
]
}Parameters
| Parameter | Type | Description |
|---|---|---|
prompt | string | |
video_urlrequired | file | Исходное видео. Ролик до 10 секунд и до 200 МБ. Цена считается за каждую секунду исходника. A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
aspect_ratio | 9:16 | 16:9 | 1:1 | 4:3 | 3:4 | 21:9 | Новый форматDefault "9:16" |
resolution | 360p | 540p | 720p | 1080p | КачествоDefault "720p" |
Example request
curl https://api.unitool.ai/v1/generations \
-H "Authorization: Bearer $UNITOOL_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Prefer: wait=60" \
-d '{
"model": "luma-ray-3-2",
"mode": "reframe",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "9:16",
"resolution": "720p",
"video_url": "https://example.com/input.mp4"
}
}'import json, os, time, uuid, requests
API = "https://api.unitool.ai/v1"
headers = {"Authorization": f"Bearer {os.environ['UNITOOL_API_KEY']}"}
body = json.loads(r'''{
"model": "luma-ray-3-2",
"mode": "reframe",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "9:16",
"resolution": "720p",
"video_url": "https://example.com/input.mp4"
}
}''')
gen = requests.post(f"{API}/generations", json=body,
headers={**headers, "Idempotency-Key": str(uuid.uuid4()), "Prefer": "wait=60"}).json()
while gen["status"] in ("queued", "running"):
time.sleep(5)
gen = requests.get(f"{API}/generations/{gen['id']}", headers=headers).json()
print(gen["status"], [o["url"] for o in gen["outputs"]])const API = "https://api.unitool.ai/v1";
const headers = { Authorization: `Bearer ${process.env.UNITOOL_API_KEY}`, "Content-Type": "application/json" };
const body = {
"model": "luma-ray-3-2",
"mode": "reframe",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "9:16",
"resolution": "720p",
"video_url": "https://example.com/input.mp4"
}
};
let gen = await (await fetch(`${API}/generations`, {
method: "POST", body: JSON.stringify(body),
headers: { ...headers, "Idempotency-Key": crypto.randomUUID(), Prefer: "wait=60" },
})).json();
while (gen.status === "queued" || gen.status === "running") {
await new Promise((resolve) => setTimeout(resolve, 5000));
gen = await (await fetch(`${API}/generations/${gen.id}`, { headers })).json();
}
console.log(gen.status, gen.outputs.map((output) => output.url));