跳转到内容

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"

此请求: ≈$0.055 55 API 积分 在此页面运行

获取 API 密钥
Open model 图像编辑 #stylized#editing

使用可选蒙版对图像进行局部重绘或外扩,支持细节修复和内容修改模式

Open model · 图像

你的第一个结果会显示在这里

在下方构建请求,并使用你的 API 密钥运行。输出会复制到我们的存储中,可永久保存,也可免费保存 7 天。

构建请求

控件根据模型架构生成。修改控件时,代码和价格会同步更新。

默认

描述要生成的图像;尽可能提供详细信息以获得最佳结果。

•必填
拖放文件,或

修复过程中使用的参考图像。

默认 1024x1024

输出图像尺寸,可从预设中选择,或指定自定义宽度和高度。两个自定义尺寸都必须能被 8 整除。

num_images 默认 1

每个请求生成的图像数量。

高级 negative_prompt · inpaint_additional_prompt · mask_image_url · performance · output_format · inpaint_engine · refiner_model · inpaint_mode · guidance_scale · sharpness · refiner_switch · inpaint_strength · inpaint_respective_field · inpaint_erode_or_dilate · seed · override_inpaint_options · inpaint_disable_initial_latent · invert_mask · mixing_image_prompt_and_inpaint · enable_safety_checker · styles · outpaint_selections · loras · image_prompt_1 · image_prompt_2 · image_prompt_3 · image_prompt_4
默认

指定要排除的图像细节的负面提示词,包括颜色、对象、场景或更细致的特征。例如胡须、模糊或低分辨率。

默认

所需修复内容的描述。

拖放文件,或

图像生成期间应用的蒙版图像。

performance 默认 Extreme Speed

性能选项:Speed 或 Quality。

output_format 默认 jpeg

生成图像的文件格式。

inpaint_engine 默认 v2.6

Fooocus 修复的模型版本。

默认 None

精修器选择:SDXL 或 SD 1.5。

默认 Inpaint or Outpaint (...

修复期间应用的模式。

默认 4

图像选择的提示词遵循强度,以 CFG(Classifier Free Guidance)表示。

默认 2

输出图像的锐度设置。提高该值会使图像及其纹理更加锐利。

默认 0.8

精修器切换值:真实感 SD1.5 模型使用 0.4,动漫 SD1.5 模型使用 0.667,XL-refiners 使用 0.8。在两个 SDXL 模型之间切换时可使用任意值。

默认 1

修复的去噪强度,相当于 A1111 的修复设置。不适用于扩图,扩图始终使用 1.0。

默认 0.618

使用 A1111 的对应值选择修复区域:"Only Masked" 对应 0,"Whole Image" 对应 1。扩图忽略此设置,始终使用 1.0。

默认 0

在反转前调整蒙版的白色区域,默认值为 0。使用正值扩大该区域,使用负值缩小该区域。

用于在 Stable Diffusion 中复现图像的种子。保持模型版本、提示词和种子不变,即可在每次运行中完全复现图像。

默认 ["Fooocus Enhance","F...

生成期间应用的风格。

默认 []

扩图延展图像的方向。

默认 [{"path":"https://hug...

合并用于最终图像生成的 LoRA,最多 5 个 LoRA。

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"

运行此请求

你的密钥会保留在此浏览器中:仅发送到 Doitong API;只有勾选“记住”后才会保存到 localStorage。 获取 API 密钥

关于 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 概念。

更多模型:图像编辑

对于 AI 代理:此页面的 Markdown 版本位于 https://doitong.com/zh-CN/developers/models/fooocus/inpaint.md. 所有模型和指南: https://doitong.com/developers/llms.txt