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

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

Подробное подключение Task API для Kling V2.5 Turbo Image-to-Video Pro

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

Эндпоинт

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

Как прикрепить изображение

В запрос модели файл не отправляется напрямую. Сначала загрузите файл в MashaGPT storage, получите публичный URL и передайте его в параметр imageUrl, tailImageUrl.

Не передавайте в JSON blob:, file://, data:, base64 или сырые байты. Storage принимает multipart/form-data с одним полем file. Подробный контракт: /v1/storage/upload.

1. Загрузить файл
curl -X POST "https://api.mashagpt.ru/v1/storage/upload" \
  -H "x-api-key: YOUR_API_KEY" \
  -F "file=@./reference.png"

Ответ вернет URL вида https://static.mashagpt.ru/...

2. Передать URL в модель
curl -X POST "https://api.mashagpt.ru/v1/tasks/kling-v2-5-turbo-image-to-video-pro" \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
  "prompt": "Опишите желаемый результат",
  "imageUrl": "https://static.mashagpt.ru/dl/mashagpt/reference.webp"
}'

Если файл уже доступен по публичному URL, его можно передать сразу. Загрузка через MashaGPT storage надежнее для файлов с компьютера.

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

ПараметрТипОписание
prompt*
stringText prompt describing the video animation (max 2500 characters). Пример — A cinematic camera movement through a futuristic scene.
imageUrl*
stringURL of the initial frame image (JPEG, PNG, WEBP; max 10MB). Пример — https://example.com/image.jpg.
tailImageUrl
stringURL of the final frame image (JPEG, PNG, WEBP; max 10MB). Пример — https://example.com/tail-image.jpg.
duration
stringДопустимые значения: 5, 10. Video duration in seconds. По умолчанию — 5.
negativePrompt
stringNegative prompt to guide what to avoid (max 2496 characters). Пример — blur, distort, and low quality.
cfgScale
numberClassifier-free guidance scale (0-1, controls adherence to prompt). Диапазон 0–1. По умолчанию — 0.5.

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

Запрос
curl -X POST https://api.mashagpt.ru/v1/tasks/kling-v2-5-turbo-image-to-video-pro \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
  "prompt": "A cinematic camera movement through a futuristic scene",
  "imageUrl": "https://example.com/image.jpg",
  "duration": "5",
  "cfgScale": 0.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