Fooocus Inpainting
集成
模型 id
fooocus/inpaint
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/fooocus/inpaint?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"inpaint_image_url": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
}'
# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const API = "https://api.doitong.com/v1";
const headers = {
"Authorization": "Bearer " + process.env.DOITONG_API_KEY,
"Content-Type": "application/json",
};
// Run the model; wait up to 20 s for the finished result in the same call
let res = await fetch(API + "/run/fooocus/inpaint?wait=20", {
method: "POST",
headers,
body: JSON.stringify({
"inpaint_image_url": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
}),
});
let request = await res.json();
if (!res.ok) throw new Error(request.error.code + ": " + request.error.message);
// Not finished yet: long-poll until it is
while (request.status === "queued" || request.status === "running") {
res = await fetch(API + "/requests/" + request.id + "?wait=20", { headers });
request = await res.json();
}
if (request.status !== "succeeded") throw new Error(JSON.stringify(request.error));
console.log(request.outputs.map((o) => o.url), request.cost.credits + " API credits ($" + request.cost.usd + ")");
import os
import requests
API = "https://api.doitong.com/v1"
headers = {"Authorization": "Bearer " + os.environ["DOITONG_API_KEY"]}
payload = {
"inpaint_image_url": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/fooocus/inpaint", params={"wait": 20}, json=payload, headers=headers)
request = r.json()
if not r.ok:
raise RuntimeError(request["error"]["code"] + ": " + request["error"]["message"])
# Not finished yet: long-poll until it is
while request["status"] in ("queued", "running"):
request = requests.get(API + "/requests/" + request["id"], params={"wait": 20}, headers=headers).json()
if request["status"] != "succeeded":
raise RuntimeError(request["error"])
print([o["url"] for o in request["outputs"]], request["cost"]["credits"], "API credits", "$" + request["cost"]["usd"])
# 1. Connect once (Claude Code; Cursor, VS Code, Claude Desktop: https://doitong.com/zh-CN/developers/docs/mcp)
claude mcp add --transport http doitong-models https://api.doitong.com/v1/mcp \
--header "Authorization: Bearer $DOITONG_API_KEY"
# 2. Your agent calls the "run" tool with:
{
"model_id": "fooocus/inpaint",
"input": {
"inpaint_image_url": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
}
}
通过 Doitong API 调用 Fooocus Inpainting 模型(fooocus/inpaint)。智能体文档:https://doitong.com/zh-CN/developers/models/fooocus/inpaint.md
POST https://api.doitong.com/v1/run/fooocus/inpaint?wait=20
Authorization: Bearer $DOITONG_API_KEY
Content-Type: application/json
{
"inpaint_image_url": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
}
如果响应状态为 "queued" 或 "running",请轮询 GET https://api.doitong.com/v1/requests/REQUEST_ID?wait=20,直到状态变为 "succeeded";文件位于 outputs[].url。使用相同请求体 POST https://api.doitong.com/v1/quote/fooocus/inpaint,可在运行前返回确切价格。
此请求: ≈$0.055 55 API 积分 在此页面运行
你的新 API 密钥。 它只会在此时显示,并且已填入下方的代码和 API 密钥字段中。请妥善保管:切勿将其放入在浏览器中运行的代码里。
构建请求
控件根据模型架构生成。修改控件时,代码和价格会同步更新。
POST
/run/fooocus/inpaint?wait=20
报价 → $0.055
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/fooocus/inpaint?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"inpaint_image_url": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
}'
# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const API = "https://api.doitong.com/v1";
const headers = {
"Authorization": "Bearer " + process.env.DOITONG_API_KEY,
"Content-Type": "application/json",
};
// Run the model; wait up to 20 s for the finished result in the same call
let res = await fetch(API + "/run/fooocus/inpaint?wait=20", {
method: "POST",
headers,
body: JSON.stringify({
"inpaint_image_url": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
}),
});
let request = await res.json();
if (!res.ok) throw new Error(request.error.code + ": " + request.error.message);
// Not finished yet: long-poll until it is
while (request.status === "queued" || request.status === "running") {
res = await fetch(API + "/requests/" + request.id + "?wait=20", { headers });
request = await res.json();
}
if (request.status !== "succeeded") throw new Error(JSON.stringify(request.error));
console.log(request.outputs.map((o) => o.url), request.cost.credits + " API credits ($" + request.cost.usd + ")");
import os
import requests
API = "https://api.doitong.com/v1"
headers = {"Authorization": "Bearer " + os.environ["DOITONG_API_KEY"]}
payload = {
"inpaint_image_url": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/fooocus/inpaint", params={"wait": 20}, json=payload, headers=headers)
request = r.json()
if not r.ok:
raise RuntimeError(request["error"]["code"] + ": " + request["error"]["message"])
# Not finished yet: long-poll until it is
while request["status"] in ("queued", "running"):
request = requests.get(API + "/requests/" + request["id"], params={"wait": 20}, headers=headers).json()
if request["status"] != "succeeded":
raise RuntimeError(request["error"])
print([o["url"] for o in request["outputs"]], request["cost"]["credits"], "API credits", "$" + request["cost"]["usd"])
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "run",
"arguments": {
"model_id": "fooocus/inpaint",
"input": {
"inpaint_image_url": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
},
"wait_seconds": 20
}
}
}
关于 Fooocus Inpainting
通过重新生成蒙版区域或扩展图像边界来编辑现有图像。提供 `inpaint_image_url`,并可选提供 `mask_image_url`,然后选择 `inpaint_mode`:普通局部重绘/外扩、细节改进或内容修改。还支持 LoRA、最多四个图像提示词、细化器选择,以及每次请求 1 到 4 个 png、jpeg 或 webp 输出。Strength 和相应字段设置可更精细地控制修改程度。
参数
发送规范名称或原生名称之一,不要同时发送两者。 规范名称
名称类型
默认值允许值
描述
prompt可选
类型string
默认值
描述要生成的图像;尽可能提供详细信息以获得最佳结果。
negative_prompt可选
类型string
默认值
指定要排除的图像细节的负面提示词,包括颜色、对象、场景或更细致的特征。例如胡须、模糊或低分辨率。
styles可选
类型enum[]
默认值["Fooocus Enhance","Fooocus Sharp","Fooocus V2"]
生成期间应用的风格。
performance可选
类型enum
默认值Extreme Speed
SpeedQualityExtreme SpeedLightning
性能选项:Speed 或 Quality。
guidance_scale可选
类型number
默认值4
1 – 30
图像选择的提示词遵循强度,以 CFG(Classifier Free Guidance)表示。
sharpness可选
类型number
默认值2
0 – 30
输出图像的锐度设置。提高该值会使图像及其纹理更加锐利。
aspect_ratio可选
类型string
默认值1024x1024
输出图像尺寸,可从预设中选择,或指定自定义宽度和高度。两个自定义尺寸都必须能被 8 整除。
num_images可选
num_outputs
类型integer
默认值1
1 – 4
每个请求生成的图像数量。
loras可选
类型object[]
默认值[{"path":"https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_offset_example-lora_1.0.safetensors","scale":0.1}]
合并用于最终图像生成的 LoRA,最多 5 个 LoRA。
loras[].path必填
类型string
LoRA 权重的位置,以 URL 或路径指定。
loras[].scale可选
类型number
默认值0.1
0 – 1
合并到基础模型前应用于 LoRA 权重的倍数。
refiner_model可选
类型enum
默认值None
NonerealisticVisionV60B1_v51VAE.safetensors
精修器选择:SDXL 或 SD 1.5。
refiner_switch可选
类型number
默认值0.8
0 – 1
精修器切换值:真实感 SD1.5 模型使用 0.4,动漫 SD1.5 模型使用 0.667,XL-refiners 使用 0.8。在两个 SDXL 模型之间切换时可使用任意值。
output_format可选
类型enum
默认值jpeg
pngjpegwebp
生成图像的文件格式。
seed可选
类型integer | null
用于在 Stable Diffusion 中复现图像的种子。保持模型版本、提示词和种子不变,即可在每次运行中完全复现图像。
inpaint_image_url必填
类型url · image
修复过程中使用的参考图像。
mask_image_url可选
类型url · image
图像生成期间应用的蒙版图像。
inpaint_mode可选
类型enum
默认值Inpaint or Outpaint (default)
Inpaint or Outpaint (default)Improve Detail (face, hand, eyes, etc.)Modify Content (add objects, change background, etc.)
修复期间应用的模式。
inpaint_additional_prompt可选
类型string
默认值
所需修复内容的描述。
outpaint_selections可选
类型enum[]
默认值[]
扩图延展图像的方向。
override_inpaint_options可选
类型boolean
默认值false
高级修复设置的覆盖开关:`inpaint_disable_initial_latent`、`inpaint_engine`、`inpaint_strength`、`inpaint_respective_field` 和 `inpaint_erode_or_dilate`。设为 true 会覆盖这些选项;否则使用其默认值。
inpaint_disable_initial_latent可选
类型boolean
默认值false
初始预处理开关:true 会禁用该预处理。
inpaint_engine可选
类型enum
默认值v2.6
Nonev1v2.5v2.6
Fooocus 修复的模型版本。
inpaint_strength可选
类型number
默认值1
≤ 1> 0
修复的去噪强度,相当于 A1111 的修复设置。不适用于扩图,扩图始终使用 1.0。
inpaint_respective_field可选
类型number
默认值0.618
0 – 1
使用 A1111 的对应值选择修复区域:"Only Masked" 对应 0,"Whole Image" 对应 1。扩图忽略此设置,始终使用 1.0。
inpaint_erode_or_dilate可选
类型number
默认值0
-64 – 64
在反转前调整蒙版的白色区域,默认值为 0。使用正值扩大该区域,使用负值缩小该区域。
invert_mask可选
类型boolean
默认值false
蒙版反转开关;true 会反转蒙版。
image_prompt_1可选
类型object
image_prompt_1.type可选
类型enum
默认值ImagePrompt
ImagePromptPyraCannyCPDSFaceSwap
image_prompt_1.image_url可选
类型url · image
image_prompt_1.stop_at可选
类型number
默认值0.5
0 – 1
image_prompt_1.weight可选
类型number
默认值1
0 – 2
image_prompt_2可选
类型object
image_prompt_2.type可选
类型enum
默认值ImagePrompt
ImagePromptPyraCannyCPDSFaceSwap
image_prompt_2.image_url可选
类型url · image
image_prompt_2.stop_at可选
类型number
默认值0.5
0 – 1
image_prompt_2.weight可选
类型number
默认值1
0 – 2
image_prompt_3可选
类型object
image_prompt_3.type可选
类型enum
默认值ImagePrompt
ImagePromptPyraCannyCPDSFaceSwap
image_prompt_3.image_url可选
类型url · image
image_prompt_3.stop_at可选
类型number
默认值0.5
0 – 1
image_prompt_3.weight可选
类型number
默认值1
0 – 2
image_prompt_4可选
类型object
image_prompt_4.type可选
类型enum
默认值ImagePrompt
ImagePromptPyraCannyCPDSFaceSwap
image_prompt_4.image_url可选
类型url · image
image_prompt_4.stop_at可选
类型number
默认值0.5
0 – 1
image_prompt_4.weight可选
类型number
默认值1
0 – 2
mixing_image_prompt_and_inpaint可选
类型boolean
默认值false
将 图像 提示词 与 Inpaint 结合。
enable_safety_checker可选
类型boolean
默认值true
安全检查器开关;设置为 false 会禁用检查。
必填
规范名称,也可接受
文件参数接受公开的 https:// URL、最大 10 MB 的 data: URI,或上传文件的 file_url。 文件
输出
GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
"id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
"object": "request",
"model": "fooocus/inpaint",
"status": "succeeded",
"created_at": "2026-10-20T12:00:00Z",
"started_at": "2026-10-20T12:00:02Z",
"completed_at": "2026-10-20T12:00:09Z",
"queue_position": null,
"cost": {
"credits": 55,
"usd": "0.055",
"charged": 55,
"refunded": 0
},
"input": {
"inpaint_image_url": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
},
"output": {
"images": [
{
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
"content_type": "image/jpeg",
"file_name": "0-output.jpeg",
"file_size": 1843200,
"width": 1024,
"height": 768
}
],
"timings": {},
"has_nsfw_concepts": [
false
]
},
"outputs": [
{
"type": "image",
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
"content_type": "image/jpeg",
"file_size": 1843200,
"width": 1024,
"height": 768,
"stored": true
}
],
"error": null,
"metrics": {
"inference_seconds": 6.8
},
"urls": {
"self": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
"cancel": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
}
}
文件由你选择每个 outputs[].url 都是我们存储中的副本:可永久保存(按 GB-月付费),也可免费保存 7 天,由账户设置或 ?storage= 决定。
所有模型的结构一致图像、视频和音频的字段均为 type、url、content_type、width、height 和 duration。output 是模型自身的结果对象。
输出字段
- images
- array of object {url, content_type, file_name, file_size, width, height}生成图像的文件信息。
- timings
- object生成耗时。
- has_nsfw_concepts
- array of boolean指示生成的图像中是否出现 NSFW 概念。
其他 Fooocus 变体
更多模型:图像编辑
对于 AI 代理:此页面的 Markdown 版本位于 https://doitong.com/zh-CN/developers/models/fooocus/inpaint.md. 所有模型和指南: https://doitong.com/developers/llms.txt






