Qwen 图片编辑
接口
POST /images/generations
完整 URL: https://modelfold.ai/v1/images/generations
鉴权:所有请求都需要
Authorization: Bearer <API_KEY>请求头。
模型参数直接放在 JSON 请求体中,不要套 input。请求等待生成完成后返回 data[].url;支持的媒体模型也可使用 异步创建、轮询及回调。示例素材地址须替换为自己的公开可访问文件。计费及错误说明见 API 网关。
生成任务的输入参数
请求参数
请求体 (application/json)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 用于生成任务的模型名称。必填字段。 - 该端点必须使用 qwen/image-edit 模型 默认值:"qwen/image-edit"。 可选值:qwen/image-edit。 示例:qwen/image-edit。 |
prompt | string | 是 | 本站网关要求传入 prompt,最长 2000 字。用于图像生成的文本提示词(最大长度:2000 字符) maxLength: 2000. 示例:把天空改成温暖的日落。。 |
image_url | string | 是 | 待编辑图像的 URL。(为上传后的文件 URL,非文件内容;支持的类型:image/jpeg、image/png、image/webp;最大文件大小:10.0MB) 示例:https://file.aiquickdraw.com/custom-page/akr/section-images/1755603225969i6j87xnw.jpg。 |
acceleration | string | 否 | 图像生成的加速级别。可选值:'none'(无加速)、'regular'(常规加速)、'high'(高速加速)。加速级别越高,生成速度越快。'regular' 模式在速度与画质间取得平衡。默认值:"none" 默认值:"none"。 可选值:none / regular / high。 示例:none。 |
image_size | string | 否 | 生成图像的尺寸规格。默认值:landscape_4_3 默认值:"landscape_4_3"。 可选值:square / square_hd / portrait_4_3 / portrait_16_9 / landscape_4_3 / landscape_16_9。 示例:landscape_4_3。 |
num_inference_steps | number | 否 | 推理步数。默认值:30(最小值:2,最大值:49,步长:1) 默认值:25。 minimum: 2. maximum: 49. 示例:25。 |
seed | integer | 否 | 随机种子值。相同的种子值、提示词和模型版本,每次生成的图像结果完全一致。 |
guidance_scale | number | 否 | CFG(无分类器引导)系数,用于控制模型生成图像时贴合提示词的程度。默认值:4(最小值:0,最大值:20,步长:0.1) 默认值:4。 minimum: 0. maximum: 20. 示例:4。 |
enable_safety_checker | boolean | 否 | 安全校验开关。若设置为 true,将启用内容安全校验。默认值:true(布尔值:true/false) 示例:true。 |
output_format | string | 否 | 生成图像的输出格式。默认值:"png" 默认值:"png"。 可选值:jpeg / png。 示例:png。 |
negative_prompt | string | 否 | 反向提示词,用于规避生成指定内容。默认值:" "(最大长度:500 字符) maxLength: 500. 示例:模糊、丑陋。 |
nsfw_checker | boolean | 否 | 默认 false。为 false 时不额外进行内容过滤,结果由模型直接返回。 |
请求示例
bash
curl -X POST "https://modelfold.ai/v1/images/generations" \
-H "Authorization: Bearer $MODELFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen/image-edit",
"prompt": "把天空改成温暖的日落。",
"image_url": "https://file.aiquickdraw.com/custom-page/akr/section-images/1755603225969i6j87xnw.jpg",
"acceleration": "none",
"image_size": "landscape_4_3",
"num_inference_steps": 25,
"guidance_scale": 4,
"output_format": "png"
}'json
{
"model": "qwen/image-edit",
"prompt": "把天空改成温暖的日落。",
"image_url": "https://file.aiquickdraw.com/custom-page/akr/section-images/1755603225969i6j87xnw.jpg",
"acceleration": "none",
"image_size": "landscape_4_3",
"num_inference_steps": 25,
"guidance_scale": 4,
"output_format": "png"
}响应
200 — 生成完成。usage 返回实际计费明细;结果地址仅作结构示例。
json
{
"ok": true,
"created": 1792134000,
"data": [
{
"url": "https://modelfold.ai/uploads/outputs/result.png"
}
],
"usage": {}
}