Используйте API RunComfy для запуска tongyi-mai/z-image/turbo/inpainting. Допустимые входы и выходы см. в схеме.
curl --request POST \
--url https://model-api.runcomfy.net/v1/models/tongyi-mai/z-image/turbo/inpainting \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <token>" \
--data '{
"prompt": "Replace the girl’s current top with a short red polka-dot swimsuit top. Keep the girl’s face, hairstyle, body proportions, and pose unchanged. The lighting should be natural and consistent with a beach environment, with realistic colors and details.",
"image_url": "https://playgrounds-storage-public.runcomfy.net/tools/7294/media-files/input-1-1.png",
"mask_image_url": "https://playgrounds-storage-public.runcomfy.net/tools/7294/media-files/mask.png"
}'Задайте для переменной окружения YOUR_API_TOKEN ваш API-ключ (управление в Профиль) и передавайте в каждом запросе Bearer-токен в заголовке Authorization : Authorization: Bearer $YOUR_API_TOKEN.
Отправьте асинхронную задачу генерации и сразу получите request_id и URL для статуса, результатов и отмены.
curl --request POST \
--url https://model-api.runcomfy.net/v1/models/tongyi-mai/z-image/turbo/inpainting \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <token>" \
--data '{
"prompt": "Replace the girl’s current top with a short red polka-dot swimsuit top. Keep the girl’s face, hairstyle, body proportions, and pose unchanged. The lighting should be natural and consistent with a beach environment, with realistic colors and details.",
"image_url": "https://playgrounds-storage-public.runcomfy.net/tools/7294/media-files/input-1-1.png",
"mask_image_url": "https://playgrounds-storage-public.runcomfy.net/tools/7294/media-files/mask.png"
}'Текущее состояние по request_id: «in_queue», «in_progress», «completed» или «cancelled».
curl --request GET \
--url https://model-api.runcomfy.net/v1/requests/{request_id}/status \
--header "Authorization: Bearer <token>"Финальные выходные данные и метаданные для request_id; если задача не завершена, в ответе — текущее состояние для дальнейшего опроса.
curl --request GET \
--url https://model-api.runcomfy.net/v1/requests/{request_id}/result \
--header "Authorization: Bearer <token>"Отмена задачи в очереди по request_id; выполняющиеся задачи отменить нельзя.
curl --request POST \
--url https://model-api.runcomfy.net/v1/requests/{request_id}/cancel \
--header "Authorization: Bearer <token>"Укажите публично доступный HTTPS URL. Хост должен разрешать серверные запросы (без входа и cookie), без жёсткого лимита и блокировки ботов. Рекомендуется: изображения ≤ 50 МБ (~4K), видео ≤ 100 МБ (~2–5 мин при 720p). Для приватных ресурсов — стабильные или подписанные URL.
{
"type": "object",
"title": "Схема входа",
"required": [
"prompt",
"image_url",
"mask_image_url"
],
"properties": {
"prompt": {
"title": "Промпт",
"description": "",
"type": "string",
"default": "Replace the girl’s current top with a short red polka-dot swimsuit top. Keep the girl’s face, hairstyle, body proportions, and pose unchanged. The lighting should be natural and consistent with a beach environment, with realistic colors and details."
},
"image_url": {
"title": "Изображение",
"description": "Действительный URL исходного изображения для инпейнтинга.",
"type": "string",
"default": "https://playgrounds-storage-public.runcomfy.net/tools/7294/media-files/input-1-1.png"
},
"mask_image_url": {
"title": "Изображение маски",
"description": "Действительный URL маски, которая задаёт область редактирования.",
"type": "string",
"default": "https://playgrounds-storage-public.runcomfy.net/tools/7294/media-files/mask.png"
},
"control_start": {
"title": "Начало управления",
"description": "Точка начала действия ControlNet в диапазоне от 0 до 1.",
"type": "float",
"minimum": 0,
"maximum": 1,
"default": 0
},
"strength": {
"title": "Сила инпейнтинга",
"description": "Регулирует силу условий инпейнтинга.",
"type": "float",
"minimum": 0,
"maximum": 1,
"default": 1
},
"image_size": {
"title": "Соотношение сторон (Ш:В)",
"description": "",
"type": "string",
"enum": [
"square_hd",
"square",
"portrait_4_3",
"portrait_16_9",
"landscape_4_3",
"landscape_16_9",
"auto"
],
"default": "auto"
},
"num_inference_steps": {
"title": "Количество шагов генерации",
"description": "Регулирует количество шагов диффузии.",
"type": "integer",
"minimum": 1,
"maximum": 30,
"default": 20
},
"seed": {
"title": "Сид",
"description": "",
"type": "integer",
"default": 0
},
"output_format": {
"title": "Формат вывода",
"description": "Задаёт формат файла созданного изображения.",
"type": "string",
"enum": [
"jpeg",
"png",
"webp"
],
"default": "png"
},
"control_scale": {
"title": "Сила управления",
"description": "Задаёт силу условий ControlNet для инпейнтинга.",
"type": "float",
"minimum": 0,
"maximum": 1,
"default": 0.75
},
"control_end": {
"title": "Конец управления",
"description": "Точка завершения действия ControlNet в диапазоне от 0 до 1.",
"type": "float",
"minimum": 0,
"maximum": 1,
"default": 0.6
}
}
}{
"output": {
"type": "object",
"properties": {
"image": {
"type": "string",
"format": "uri",
"description": "URL одного изображения"
},
"video": {
"type": "string",
"format": "uri",
"description": "URL одного видео"
},
"images": {
"type": "array",
"description": "несколько URL изображений",
"items": {
"type": "string",
"format": "uri"
}
},
"videos": {
"type": "array",
"description": "несколько URL видео",
"items": {
"type": "string",
"format": "uri"
}
}
}
}
}RunComfy - ведущая ComfyUI платформа, предлагающая ComfyUI онлайн среду и услуги, а также рабочие процессы ComfyUI с потрясающей визуализацией. RunComfy также предоставляет AI Models, позволяя художникам использовать новейшие инструменты AI для создания невероятного искусства.