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

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

Подробное подключение Task API для Seedream V4 Edit

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

Эндпоинт

Базовый URLhttps://api.mashagpt.ru/v1
Эндпоинт
POST
/v1/tasks/seedream-v4-edit
Авторизация
x-api-key: YOUR_API_KEY
илиAuthorization: Bearer YOUR_API_KEY

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

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

Не передавайте в 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/seedream-v4-edit" \
  -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 desired edits (max 5000 characters). Пример — Transform this image to have vibrant sunset colors.
imageUrls*
string[]Array of image URLs to edit (up to 10 images, JPEG/PNG/WEBP; max 10MB each). Пример — ["https://example.com/image1.jpg","https://example.com/image2.jpg"].
nsfwChecker
booleanWhether to run the provider NSFW checker. По умолчанию — false.
imageSize
stringДопустимые значения: square, square_hd, portrait_4_3, portrait_3_2, portrait_16_9, landscape_4_3, landscape_3_2, landscape_16_9, landscape_21_9. Image aspect ratio. По умолчанию — square_hd.
imageResolution
stringДопустимые значения: 1K, 2K, 4K. Image resolution. По умолчанию — 1K.
maxImages
integerMaximum number of images to generate (1-6). Note: Must match the quantity mentioned in the prompt. Диапазон 1–6. По умолчанию — 1.
seed
integerRandom seed for reproducibility.

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

Запрос
curl -X POST https://api.mashagpt.ru/v1/tasks/seedream-v4-edit \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
  "prompt": "Transform this image to have vibrant sunset colors",
  "imageUrls": [
    "https://example.com/image1.jpg",
    "https://example.com/image2.jpg"
  ],
  "nsfwChecker": false,
  "imageSize": "square_hd",
  "imageResolution": "1K",
  "maxImages": 1
}'
Ответ
{
  "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