使用 RunComfy 的 API 运行 blackforestlabs/flux-2/turbo/text-to-image。 可接受的输入与输出请参阅模型的 数据结构说明。
curl --request POST \
--url https://model-api.runcomfy.net/v1/models/blackforestlabs/flux-2/turbo/text-to-image \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <token>" \
--data '{
"prompt": "> `Final prompt:` A photorealistic image of a white ceramic teacup lying on its side on a wrinkled, light gray fabric background. The teacup is filled with dried yellow flowers, with small clustered blossoms and brittle stems emerging from the rim. The flowers spill out naturally, maintaining an organic arrangement. The lighting is soft and diffused, typical of natural window light on an overcast day, creating subtle shadows and highlights on the fabric and cup. The scene is minimalistic and thoughtfully composed, evoking a calm, rustic atmosphere. The camera angle is slightly overhead with a gentle tilt, capturing the full cup at a diagonal orientation, and showing the handle at the bottom right. The photographic style is moody and still-life inspired, focusing on color contrast between the pale background and the muted yellow blossoms. Rendered in ultra-high resolution, 8k, with fine detail, realistic textures, and soft focus depth."
}'将 YOUR_API_TOKEN 环境变量设置为您的 API 密钥(在 个人资料中管理密钥),并在每个请求的 Authorization 标头中以 Bearer 令牌形式携带: Authorization: Bearer $YOUR_API_TOKEN。
提交异步生成任务,将立即获得 request_id 以及用于查询状态、获取结果和取消的 URL。
curl --request POST \
--url https://model-api.runcomfy.net/v1/models/blackforestlabs/flux-2/turbo/text-to-image \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <token>" \
--data '{
"prompt": "> `Final prompt:` A photorealistic image of a white ceramic teacup lying on its side on a wrinkled, light gray fabric background. The teacup is filled with dried yellow flowers, with small clustered blossoms and brittle stems emerging from the rim. The flowers spill out naturally, maintaining an organic arrangement. The lighting is soft and diffused, typical of natural window light on an overcast day, creating subtle shadows and highlights on the fabric and cup. The scene is minimalistic and thoughtfully composed, evoking a calm, rustic atmosphere. The camera angle is slightly overhead with a gentle tilt, capturing the full cup at a diagonal orientation, and showing the handle at the bottom right. The photographic style is moody and still-life inspired, focusing on color contrast between the pale background and the muted yellow blossoms. Rendered in ultra-high resolution, 8k, with fine detail, realistic textures, and soft focus depth."
}'根据 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 地址。确保目标主机允许服务端拉取(无需登录或 Cookie)、未被限流或拦截爬虫。建议:图片 ≤ 50 MB(约 4K),视频 ≤ 100 MB(约 720p 下 2–5 分钟)。私有资源请使用稳定或预签名 URL。
{
"type": "object",
"title": "输入结构",
"required": [
"prompt"
],
"properties": {
"prompt": {
"title": "提示词",
"description": "描述要生成图像的文字提示词。",
"type": "string",
"default": "> `Final prompt:` A photorealistic image of a white ceramic teacup lying on its side on a wrinkled, light gray fabric background. The teacup is filled with dried yellow flowers, with small clustered blossoms and brittle stems emerging from the rim. The flowers spill out naturally, maintaining an organic arrangement. The lighting is soft and diffused, typical of natural window light on an overcast day, creating subtle shadows and highlights on the fabric and cup. The scene is minimalistic and thoughtfully composed, evoking a calm, rustic atmosphere. The camera angle is slightly overhead with a gentle tilt, capturing the full cup at a diagonal orientation, and showing the handle at the bottom right. The photographic style is moody and still-life inspired, focusing on color contrast between the pale background and the muted yellow blossoms. Rendered in ultra-high resolution, 8k, with fine detail, realistic textures, and soft focus depth."
},
"guidance_scale": {
"title": "引导强度",
"description": "控制模型遵循提示词的严格程度(0–20,默认值:2.5)。",
"type": "float",
"minimum": 0,
"maximum": 20,
"default": 2.5
},
"seed": {
"title": "随机种子",
"description": "用于复现结果的随机种子(默认值:0)。",
"type": "integer",
"default": 0
},
"image_size": {
"title": "图像尺寸",
"description": "从固定预设 `square_hd`、`square`、`portrait_4_3`、`portrait_16_9`、`landscape_4_3` 和 `landscape_16_9` 中选择输出尺寸。",
"type": "string",
"enum": [
"square_hd",
"square",
"portrait_4_3",
"portrait_16_9",
"landscape_4_3",
"landscape_16_9"
],
"default": "landscape_4_3"
},
"output_format": {
"title": "输出格式",
"description": "生成图像的文件格式:`jpeg`、`png` 或 `webp`。",
"type": "string",
"enum": [
"jpeg",
"png",
"webp"
],
"default": "png"
}
}
}{
"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工具创作出令人惊叹的艺术作品。