К обзору модели

API-документация

Подробное подключение Task API для Kling 3.0 Omni Text-to-Video

API-документация

Эндпоинт

Базовый URLhttps://api.mashagpt.ru/v1
Эндпоинт
POST
/v1/tasks/kling-3-0-omni-text-to-video
Авторизация
x-api-key: YOUR_API_KEY
илиAuthorization: Bearer YOUR_API_KEY

Параметры запроса

ПараметрТипОписание
prompt*
stringVideo prompt (1-3072 characters).
storyMode
stringДопустимые значения: single, smart, custom. single = one prompt, smart = automatic storyboarding, custom = explicit scenes. По умолчанию — single.
multiShots
arrayCustom storyboard with up to 6 scenes and at most 15s total.
elements
arrayOne-time subject assets. Image subjects use 2-4 images; video subjects use one video. Up to 7 subjects, or 3 video subjects.
audio
booleanПо умолчанию — false.
resolution
stringДопустимые значения: 720p, 1080p, 4k. По умолчанию — 720p.
aspectRatio
stringДопустимые значения: 16:9, 9:16, 1:1, auto. По умолчанию — 16:9.
duration
integerRequested output duration in seconds (3-15). Диапазон 3–15. По умолчанию — 5.

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

Запрос
curl -X POST https://api.mashagpt.ru/v1/tasks/kling-3-0-omni-text-to-video \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
  "prompt": "A beautiful sunset over mountains",
  "storyMode": "single",
  "audio": false,
  "resolution": "720p",
  "aspectRatio": "16:9",
  "duration": 5
}'
Ответ
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "550e8400-e29b-41d4-a716-446655440000",
    "state": "queued"
  }
}

Асинхронная обработка

Модель работает асинхронно. После запроса вы получите taskId задачи для отслеживания статуса.

GET
/v1/tasks/{id}статус задачи
Проверка статуса задачи:
curl -X GET "https://api.mashagpt.ru/v1/tasks/{task_id}" \
  -H "x-api-key: YOUR_API_KEY"

Жизненный цикл задачи:

queuedprocessingcompleted|failed