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

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

Подробное подключение Task API для Seedream V4 Text-to-Image

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

Эндпоинт

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

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

ПараметрТипОписание
prompt*
stringText prompt describing the image(s) to generate (max 5000 characters). Пример — A serene mountain landscape at sunset with dramatic clouds.
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-text-to-image \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
  "prompt": "A serene mountain landscape at sunset with dramatic clouds",
  "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