Top.Mail.Ru
Главная icon
Главная
Галерея icon
Галерея
Unitool Labs icon
Unitool Labs
Блог icon
Блог
MCP icon
MCP
← Все модели

Luma UNI-1

luma-uni-1 · Изображения · unitool

Фотомодель Luma: генерация изображений по тексту, до девяти референсов стиля и персонажей, редактирование готовой картинки словами.

Генерация асинхронная: создание, ожидание или опрос, результат по ссылке на 7 дней. Подробно: Генерации медиа

Генерация изображения

Режим t2i · luma-uni-1:t2i

Цена

Зависит от параметров: 7 токенов на примере ниже, база 7. Точную цену своего запроса узнайте через POST /v1/quotes.

Состав цены (pricing из GET /v1/models/{id})
JSON
{
  "unit": "tokens",
  "kind": "by_parameters",
  "base": 7,
  "example_price": 7,
  "matrix": [
    {
      "when": {
        "quality": "high"
      },
      "price": 17
    },
    {
      "when": {
        "quality": "standard"
      },
      "price": 7
    }
  ]
}

Параметры

ПараметрТипОписание
promptобязательныйstring
qualitystandard | highМодель. Max рисует детальнее и стоит дороже.По умолчанию "standard"
aspect_ratio1:1 | 16:9 | 3:2 | 2:1 | 3:1 | 9:16 | 2:3 | 1:2 | 1:3Соотношение сторонПо умолчанию "1:1"
reference_image_urlsarray of file (≤ 9)A file_ref (asset:… or attachment:…), an https URL or a data: URL.

Пример запроса

curl
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-uni-1",
  "mode": "t2i",
  "input": {
    "prompt": "A red fox running through fresh snow at sunrise",
    "quality": "standard",
    "aspect_ratio": "1:1"
  }
}'
Python (requests)
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-uni-1",
  "mode": "t2i",
  "input": {
    "prompt": "A red fox running through fresh snow at sunrise",
    "quality": "standard",
    "aspect_ratio": "1:1"
  }
}''')
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"]])
JavaScript (fetch)
const API = "https://api.unitool.ai/v1";
const headers = { Authorization: `Bearer ${process.env.UNITOOL_API_KEY}`, "Content-Type": "application/json" };
const body = {
  "model": "luma-uni-1",
  "mode": "t2i",
  "input": {
    "prompt": "A red fox running through fresh snow at sunrise",
    "quality": "standard",
    "aspect_ratio": "1:1"
  }
};
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));

Редактирование изображения

Режим edit · luma-uni-1:edit

Цена

Зависит от параметров: 7 токенов на примере ниже, база 7. Точную цену своего запроса узнайте через POST /v1/quotes.

Состав цены (pricing из GET /v1/models/{id})
JSON
{
  "unit": "tokens",
  "kind": "by_parameters",
  "base": 7,
  "example_price": 7,
  "matrix": [
    {
      "when": {
        "quality": "high"
      },
      "price": 17
    },
    {
      "when": {
        "quality": "standard"
      },
      "price": 7
    }
  ]
}

Параметры

ПараметрТипОписание
promptstring
qualitystandard | highМодель. Max рисует детальнее и стоит дороже.По умолчанию "standard"
reference_image_urlsобязательныйarray of fileРеференсы. До восьми дополнительных картинок — с них берут стиль, свет или фактуру. Исходник прикрепите скрепкой к сообщению. A file_ref (asset:… or attachment:…), an https URL or a data: URL.
image_urlsобязательныйarray of file (≤ 1)A file_ref (asset:… or attachment:…), an https URL or a data: URL.

Пример запроса

curl
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-uni-1",
  "mode": "edit",
  "input": {
    "prompt": "A red fox running through fresh snow at sunrise",
    "quality": "standard",
    "reference_image_urls": [
      "https://example.com/input.png"
    ],
    "image_urls": [
      "https://example.com/input.png"
    ]
  }
}'
Python (requests)
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-uni-1",
  "mode": "edit",
  "input": {
    "prompt": "A red fox running through fresh snow at sunrise",
    "quality": "standard",
    "reference_image_urls": [
      "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"]])
JavaScript (fetch)
const API = "https://api.unitool.ai/v1";
const headers = { Authorization: `Bearer ${process.env.UNITOOL_API_KEY}`, "Content-Type": "application/json" };
const body = {
  "model": "luma-uni-1",
  "mode": "edit",
  "input": {
    "prompt": "A red fox running through fresh snow at sunrise",
    "quality": "standard",
    "reference_image_urls": [
      "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));

Мы используем файлы cookie

Продолжая пользоваться сайтом, вы соглашаетесь с Политикой обработки персональных данных.