Recraft 背景移除
接口
POST /images/generations
完整 URL: https://modelfold.ai/v1/images/generations
鉴权:所有请求都需要
Authorization: Bearer <API_KEY>请求头。
模型参数直接放在 JSON 请求体中,不要套 input。请求等待生成完成后返回 data[].url;支持的媒体模型也可使用 异步创建、轮询及回调。示例素材地址须替换为自己的公开可访问文件。计费及错误说明见 API 网关。
图像去背景任务的输入参数
请求参数
请求体 (application/json)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 用于处理任务的模型名称。必填字段。 - 该端点必须使用 recraft/remove-background 模型 默认值:"recraft/remove-background"。 可选值:recraft/remove-background。 示例:recraft/remove-background。 |
image | string | 是 | 待去除背景的图像。支持格式:PNG、JPG、WEBP。最大 5MB,最大 1600 万像素,最大尺寸 4096px,最小尺寸 256px。(为上传后的文件 URL,而非文件内容;支持类型:image/jpeg、image/png、image/webp;最大大小:5.0MB) 示例:https://file.aiquickdraw.com/custom-page/akr/section-images/1757057285447k9qcbki1.webp。 |
prompt | string | 是 | 本站网关要求传入 prompt,最长 2000 字。 maxLength: 2000. |
请求示例
bash
curl -X POST "https://modelfold.ai/v1/images/generations" \
-H "Authorization: Bearer $MODELFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "recraft/remove-background",
"image": "https://file.aiquickdraw.com/custom-page/akr/section-images/1757057285447k9qcbki1.webp",
"prompt": "A paper boat drifting down a rainy street."
}'json
{
"model": "recraft/remove-background",
"image": "https://file.aiquickdraw.com/custom-page/akr/section-images/1757057285447k9qcbki1.webp",
"prompt": "A paper boat drifting down a rainy street."
}响应
200 — 生成完成。usage 返回实际计费明细;结果地址仅作结构示例。
json
{
"ok": true,
"created": 1792134000,
"data": [
{
"url": "https://modelfold.ai/uploads/outputs/result.png"
}
],
"usage": {}
}