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

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

Подробное подключение Task API для Wan 2.7 Image-to-Video

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

Эндпоинт

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

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

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

Не передавайте в 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/wan-2-7-image-to-video" \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
  "prompt": "Опишите желаемый результат",
  "imageUrls": [
    "https://static.mashagpt.ru/dl/mashagpt/reference.webp"
  ]
}'

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

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

ПараметрТипОписание
prompt*
stringText prompt describing the video motion (max 5000 characters). Пример — The subject slowly turns and smiles at the camera.
imageUrls
string[]Legacy alias for Wan 2.7 frames. imageUrls[0] becomes firstFrameUrl, imageUrls[1] becomes lastFrameUrl. Пример — ["https://example.com/first-frame.jpg","https://example.com/last-frame.jpg"].
firstFrameUrl
stringFirst frame image URL. Required unless firstClipUrl is provided. Пример — https://example.com/first-frame.jpg.
lastFrameUrl
stringOptional last frame image URL for frame interpolation. Пример — https://example.com/last-frame.jpg.
firstClipUrl
stringOptional source video URL for video continuation mode. Пример — https://example.com/source.mp4.
negativePrompt
stringNegative prompt (max 500 characters).
duration
stringДопустимые значения: 5, 10, 15. Video duration in seconds. По умолчанию — 5.
resolution
stringДопустимые значения: 720p, 1080p. Output resolution. По умолчанию — 1080p.
promptExtend
booleanEnable KIE prompt expansion.
watermark
booleanAdd provider watermark.
seed
integerRandom seed for reproducible generation (0-2147483647). Диапазон 0–2147483647.

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

Запрос
curl -X POST https://api.mashagpt.ru/v1/tasks/wan-2-7-image-to-video \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
  "prompt": "The subject slowly turns and smiles at the camera",
  "duration": "5",
  "resolution": "1080p"
}'
Ответ
{
  "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