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.ru/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.ru/v1/requests/REQUEST_ID?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const API = "https://api.doitong.ru/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.ru/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-TW/developers/docs/mcp)
claude mcp add --transport http doitong-models https://api.doitong.ru/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-TW/developers/models/fooocus/inpaint.md
POST https://api.doitong.ru/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.ru/v1/requests/REQUEST_ID?wait=20,直到狀態變為 "succeeded";檔案位於 outputs[].url。使用相同主體傳送 POST https://api.doitong.ru/v1/quote/fooocus/inpaint,可在執行前取得確切價格。
此請求: ≈$0.055 55 API 點數 · ≈ ₽5.80 在此頁面執行
您的新 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.ru/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.ru/v1/requests/REQUEST_ID?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const API = "https://api.doitong.ru/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.ru/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、最多四個影像提示和 refiner 選擇,每次請求可輸出 1 到 4 張 png、jpeg 或 webp。Strength 和 respective-field 設定可更精細地控制變更幅度。
參數
請傳送標準名稱或原生名稱其中之一,不要同時傳送兩者。 標準名稱
名稱類型
預設值允許值
說明
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
結合圖像提示詞與局部重繪。
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.ru/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
"cancel": "https://api.doitong.ru/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-TW/developers/models/fooocus/inpaint.md. 所有模型與指南: https://doitong.com/developers/llms.txt






