generate
Creates images from text prompts locally with Qwen-Image 2.1 through ComfyUI, then returns the saved file’s absolute path for direct access.
Instructions
用本地 ComfyUI 的 Qwen-Image 2.1 模型做文生图,返回图片绝对路径。Generate an image locally with Qwen-Image 2.1 on the local ComfyUI and return the absolute file path. 512x512、20 步在本机约 29 秒(已加载);768×768 冷启动约 60 秒、1024×1024 已加载约 80 秒,仅为单次记录。A local test took about 29s at 512x512 warm, 60s at 768x768 cold, and 80s at 1024x1024 warm; timing varies. 超时返回 prompt_id,请用 get_result 继续查询,避免重复提交。Use get_result after a wait timeout instead of submitting again.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"prompt": "<prompt>"
},
"name": "generate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cfg | No | CFG 引导强度,1..8,默认 1(Qwen-Image 官方推荐 1)。CFG scale 1..8, default 1. | |
| seed | No | 随机种子 0..2^53-1;省略则随机生成,并在结果里返回实际使用的 seed(便于复现)。Seed 0..2^53-1; omit for a random one, which is returned in the result so it can be reproduced. | |
| steps | No | 采样步数,1..40,默认 20;越多越慢越细。Sampling steps 1..40, default 20. | |
| width | No | 图片宽度像素:256..1024,必须是 16 的倍数,且 width*height 不超过 1048576;默认 512。768、1024 已在 8GB 显卡上实测可用,更大面积可能显存不足。Image width: 256..1024, multiple of 16, width*height <= 1048576, default 512. 768 and 1024 are verified on an 8GB GPU; larger areas may hit OOM. | |
| height | No | 图片高度像素:256..1024,必须是 16 的倍数;默认 512。768、1024 已在 8GB 显卡上实测可用。Image height: 256..1024, multiple of 16, default 512. | |
| prompt | Yes | 正向提示词,必填,1..4000 字符。Positive prompt (required, 1..4000 chars). | |
| return_image | No | 为 true 且图片不超过 2MB 时,额外返回一个 image 内容块(base64 PNG),模型可直接看图。When true and the file is <=2MB, an extra image content block (base64 PNG) is returned. | |
| wait_seconds | No | 最多等待多少秒,默认 180,上限 600。超时不算失败,返回 status=running,之后可调用 get_result 取图。Max seconds to wait, default 180, cap 600. A timeout is not an error: it returns status=running and get_result can fetch the image later. | |
| filename_prefix | No | 输出文件名前缀,仅允许 [A-Za-z0-9_-],长度 ≤40,非法字符会被替换成 _;默认 DSH_Qwen21。实际文件名还会带一个短运行 ID,避免覆盖旧图。Output filename prefix, [A-Za-z0-9_-] only, <=40 chars, illegal characters become _; default DSH_Qwen21. | |
| negative_prompt | No | 负向提示词,可选,默认空字符串。Negative prompt (optional, default empty). |