# Stable Diffusion with LoRAs · Inpaint API

> Inpainting e kidime Stable Diffusion bazutne modelosa thaj LoRAs, vodime kalo-parno maskasa

Editisarel kipeskere kotora e `image_url` thaj kalo-parno `mask_url`, e Stable Diffusion modelosa setime ande `model_name`. `noise_strength` džal 0 dži 1. Podržinel phandlede LoRAs, embeddings, ControlNets, IP adapters thaj varesave schedulerura, e stepsenca katar 1 dži 150. O rezultato si png vaj jpeg.

- Model id: `lora/inpaint`
- Made by: Open model
- Category: Image Editing
- Output: image
- Estimated price per run: $0.184 / image (cheapest run $0.184 (184 API credits))
- Run: `POST https://api.doitong.com/v1/run/lora/inpaint`
- Quote: `POST https://api.doitong.com/v1/quote/lora/inpaint`
- Docs page: https://doitong.com/rom/developers/models/lora/inpaint

## Pricing

Price: **$0.184 / image**. Estimated from the typical cost of one run, per output (`num_images`). The quote is exactly what the run charges.

The full example input below costs $0.184 = 184 API credits (1 image × 184 API credits).

Prices are the upstream price in USD, paid from the API balance in API credits (1000 API credits = 1 USD). `POST https://api.doitong.com/v1/quote/lora/inpaint` with the same JSON body returns the exact price for that input; the quote is exactly what a run charges. Invalid input is never charged and failed or canceled requests are refunded automatically.

## Input parameters

Send either the canonical name or the native field name (not both). Canonical names are the same across models.

| Parameter | Canonical name | Type | Required | Default | Allowed values / range | Description |
|---|---|---|---|---|---|---|
| `model_name` |  | string | yes |  |  | Base modelo vaś keripe e kipesko, identifikime vaj e URL-esa vaj e HuggingFace ID-esa. |
| `unet_name` |  | string \| null | no |  |  | Custom U-Net selekcija baši kiponge keripe; dino vaj lesko HuggingFace ID vaj lesko URL. |
| `variant` |  | string \| null | no |  |  | HuggingFace modelo variant selekcija; 'fp16' si jekh primer. |
| `prompt` |  | string | yes |  |  | Phen o kipo savo kames te kerel pes, use but detail sar šaj te avel maj lačho rezultato. |
| `negative_prompt` |  | string | no | `` |  | Negativno prompto savo phenel save detajura na kamen pe o kipo. Šaj te isključil boje, objektura, pejzažo vaj maj cikne detajura thaj kvalitetura, sar mustaći, mutno dikhimos vaj teluni rezolucija. |
| `prompt_weighting` |  | boolean | no | `false` |  | Savo kerel o prompt-weighting: true mukhel tele o 77 tokeno limitos vaš embedding averaging thaj kerel weighting syntax. |
| `image_url` | `image` | string (image URL) \| null | no |  |  | Source kipo URL vaš image-to-image keripe vaj inpainting. |
| `mask_url` | `mask` | string (image URL) \| null | no |  |  | Inpainting mask URL kaj sikavel pe jekh kalo-thaj-parno kipo. |
| `noise_strength` |  | number | no | `0.5` | ≤ 1, > 0 | Kontrolinel keci kipo noise dino pe skala kaj 1.0 si pherdo noise thaj value pas 0 si cikno noise. Kerel pes numa kana si dino image_url. |
| `loras` |  | array of object {path, scale} | no | `[]` |  | LoRA-ja savenge jekhipen kerel o generime kipo, bi limitosko pe lengero gindo. |
| `loras[].path` |  | string | yes |  |  | Lokacia e LoRA vazipnaski, specifikime sar URL vaj drom. |
| `loras[].scale` |  | number | no | `1` | 0 – 4 | Multiplikator dino e LoRA vazipnaske anglal mergipen ande o bazno modelo. |
| `embeddings` |  | array of object {path, tokens} | no | `[]` |  | Embeddingura dino ande o kipo-keripe, te mapinel o prompto tokenura pe embedding weights. Akana, numa jekh embedding hin podpora. |
| `embeddings[].path` |  | string | yes |  |  | Embedding weights specifičime URL-esa vaj fajloske pathesa. |
| `embeddings[].tokens` |  | array of string \| null | no |  |  | Prompto tokenura mapome pe embedding weights. Te na den len, kerel jekh tokeno vaš sako vector ando embedding-fajlo, navalo <s0>, <s1>, ...; labaren kadala tokenura ande tumare promptura. |
| `controlnets` |  | array of object {path, config_url, variant, image_url, mask_url, conditioning_scale, start_percentage, end_percentage, ip_adapter_index} | no | `[]` |  | Control netura dino te keren pes pe o kipo ande specifikime timesteps ande o keripe, bi limito savo numero den. |
| `controlnets[].path` |  | string | yes |  |  | Than e ControlNet vektorengo, specifikime sar URL vaj drom. |
| `controlnets[].config_url` |  | string \| null | no |  |  | Optional URL savo sikavel e ControlNet-esko config.json fajlo. |
| `controlnets[].variant` |  | string \| null | no |  |  | Optionalo variant vaš use e Hugging Face repository key-sa. |
| `controlnets[].image_url` |  | string (image URL) | yes |  |  | Kipo URL dino sar o ControlNet inputo. |
| `controlnets[].mask_url` |  | string (image URL) \| null | no |  |  | ControlNet maska, savo, te dino, musaj te avel jekhbaro le control kipesa; o width thaj o height musaj te aven divisible by 32. |
| `controlnets[].conditioning_scale` |  | number | no | `1` | 0 – 2 | Skaliripe savo aplikil pe e ControlNet pharimatengo anglal te aven kethane thode ando bazutno modelo. |
| `controlnets[].start_percentage` |  | number | no | `0` | 0 – 1 | Procento total timesteps-engo kana ControlNet startarel te influencinel kipesko keripe. |
| `controlnets[].end_percentage` |  | number | no | `1` | 0 – 1 | Procento total timesteps-engo kana ControlNet stoparel te influencinel kipesko keripe. |
| `controlnets[].ip_adapter_index` |  | integer \| null | no |  |  | IP adapteros savo alosarav pe index vaš InstantID ControlNet; aver ControlNetura na kamen kadava settingo. |
| `controlnet_guess_mode` |  | boolean | no | `false` |  | Te hin true, o ControlNet alkalmazako mukhel numa conditional predictions. |
| `ip_adapter` |  | array of object {ip_adapter_image_url, ip_adapter_mask_url, path, model_subfolder, weight_name, insight_face_model_path, scale, scale_json, unconditional_noising_factor, image_projection_shortcut} | no | `[]` |  | IP adapterura labarde te keren kipo. Sako entry mangel image_encoder_path. |
| `ip_adapter[].ip_adapter_image_url` |  | string (image URL) \| array of image URL | yes |  |  | Kipo URL dino sar o IP adapter inputo. |
| `ip_adapter[].ip_adapter_mask_url` |  | string (image URL) \| null | no |  |  | IP adapter maska; te dino, lake dimenzi musaj te aven sar le adapter kipeske dimenzi. |
| `ip_adapter[].path` |  | string | yes |  |  | IP adapter weights thavdipe, dino sar URL vaj path. |
| `ip_adapter[].model_subfolder` |  | string \| null | no |  |  | IP adapter weight thavdipe, dino sar subfolder ande o modelo directory. |
| `ip_adapter[].weight_name` |  | string \| null | no |  |  | Nav le weightske fajloste. |
| `ip_adapter[].insight_face_model_path` |  | string \| null | no |  |  | InsightFace modelo weights thavdipe, dino sar URL vaj path. |
| `ip_adapter[].scale` |  | number | no | `1` | ≥ 0 | Scaling factor vaš IP adapter weights, aplikime angl te phandenas len ande o base modelo. |
| `ip_adapter[].scale_json` |  | object \| null | no |  |  | Scaling factor vaš IP adapter weights, aplikime angl te phandenas len ande o base modelo. |
| `ip_adapter[].unconditional_noising_factor` |  | number | no | `0` | 0 – 1 | Factor savo kontrolinel o unconditional noising vaš o IP adapter. |
| `ip_adapter[].image_projection_shortcut` |  | boolean | no | `true` |  | Kipo projection shortcut setting, le True sar standardno. Labaren False vaš FaceID plus V1 modelo thaj True vaš FaceID plus V2 modelo. |
| `image_encoder_path` |  | string \| null | no |  |  | Kipo encoder dino sar HTTPS URL vaj Hugging Face ID. Kompatibiliteta pherel le IP-Adapter weightsar: SD1.5 labarel image_encoder_subfolder='models/image_encoder', a h94/IP-Adapter SDXL labarel h94/IP-Adapter thaj image_encoder_subfolder='sdxl_models/image_encoder'. Encodero hin musaj kana ip_adapter si les jekh value. |
| `image_encoder_subfolder` |  | string \| null | no |  |  | Subdirectory ande image_encoder_path kaj si le kipo encoder weights. |
| `image_encoder_weight_name` |  | string \| null | no | `pytorch_model.bin` |  | Alosar le kipo encoder weights pe nav, te labaren len kipo-keripeste. |
| `ic_light_model_url` |  | string \| null | no |  |  | IC Light modelo URL labardo kana keren kipo. |
| `ic_light_model_background_image_url` |  | string (image URL) \| null | no |  |  | IC Light kipo-keripasko modelo-kompatibilno backgroundo, dino sar kipo URL. |
| `ic_light_image_url` |  | string (image URL) \| null | no |  |  | Inputo kipo URL vaš keripe le IC Light modelosa. |
| `seed` |  | integer \| null | no |  |  | Seed vaš reprodukcia e kipengo ande Stable Diffusion. O kipo šaj te reprodukčarel pes ekzaktno pe sa keripena te mukhes isto o modelesko version, prompto thaj seed. |
| `num_inference_steps` |  | integer | no | `30` | 1 – 150 | Kontrolisarel keci keripaski faza kerel Stable Diffusion; majbut faze šaj te anen maj detalno finalno kipo. |
| `guidance_scale` |  | number | no | `7.5` | 0 – 20 | Zor e promptoske pačajipaski vaś izbor e kiposko, sikavdi sar CFG (Classifier Free Guidance). |
| `clip_skip` |  | integer | no | `0` | 0 – 2 | Na kerel jekh kotor le kipo-keripestar, te renderinel sigeder; o rezultato si cikno aver. |
| `scheduler` |  | enum (string) \| null | no |  | `DPM++ 2M`, `DPM++ 2M Karras`, `DPM++ 2M SDE`, `DPM++ 2M SDE Karras`, `Euler`, `Euler A`, `Euler (trailing timesteps)`, `LCM`, `LCM (trailing timesteps)`, `DDIM`, `TCD` | Scheduler vaj sampler savo si labarde vaš e kipesko nevešaripen. |
| `timesteps` |  | object {method, array} | no | `{"array":[],"method":"default"}` |  | Denoising timestep schedule override, mutually exclusive with sigmas. Bi override — standardno — o scheduler kalkulinkerel timesteps anda num_inference_steps; custom schedule kerel num_inference_steps bizo. Override mangel scheduler support vaš timesteps argumento ande set_timesteps. |
| `timesteps.method` |  | enum (string) | no | `default` | `default`, `array` | Alosar sar aven determinime timesteps: 'default', o standardno settingo, mukhel le scheduler te labarel `num_inference_steps`. Te den tumaro schedule, alosar 'array' thaj thaven le schedule ande o `array` field. |
| `timesteps.array` |  | array of integer | no | `[]` |  | Timestep schedule aplikime kana o alosardo metodo si 'custom'. |
| `sigmas` |  | object {method, array} | no | `{"array":[],"method":"default"}` |  | Denoising sigma schedule override, mutually exclusive with timesteps. Bi override — standardno — o scheduler kalkulinkerel sigmas anda num_inference_steps; custom schedule kerel num_inference_steps bizo. Override mangel scheduler support vaš sigmas argumento ande set_sigmas. |
| `sigmas.method` |  | enum (string) | no | `default` | `default`, `array` | Alosar sar aven determinime sigmas: 'default', o standardno settingo, labarel le scheduler-eske sigma value. Te den tumaro sigma schedule, alosar 'custom' thaj thaven le schedule ande o `array` field. |
| `sigmas.array` |  | array of number | no | `[]` |  | Sigma schedule aplikime kana o alosardo metodo si 'custom'. |
| `prediction_type` |  | enum (string) | no | `epsilon` | `v_prediction`, `epsilon` | Alosar o prediction type vaš kipo-keripe; te na alosaren aver, labarel pes `epsilon`. |
| `rescale_betas_snr_zero` |  | boolean | no | `false` |  | Kontrolinel whether o sampler kerel rescale_betas_snr_zero. |
| `image_format` |  | enum (string) | no | `png` | `jpeg`, `png` | Fajlo-formato e rezultato kipoqo. |
| `num_images` | `num_outputs` | integer | no | `1` | 1 – 8 | Thaven keci kipo kerel jekh mangipen; bare batchura den buter keripesko vakti. |
| `enable_safety_checker` |  | boolean | no | `false` |  | Safety-checker aktivacia; true aktivarel checking. |
| `tile_width` |  | integer | no | `4096` | 128 – 4,096 | Thaven keci baro si sako tile kana keren kipo. |
| `tile_height` |  | integer | no | `4096` | 128 – 4,096 | Thaven keci baro si sako tile kana keren kipo. |
| `tile_stride_width` |  | integer | no | `2048` | 64 – 2,048 | Thaven o phandipe maškar successiv tile positions kana keren kipo. |
| `tile_stride_height` |  | integer | no | `2048` | 64 – 2,048 | Thaven o phandipe maškar successiv tile positions kana keren kipo. |
| `eta` |  | number | no | `0` | 0 – 1 | Eta settingo labardo kana keren kipo. |
| `debug_latents` |  | boolean | no | `false` |  | Te true, garavel latents vaš debugging. |
| `debug_per_pass_latents` |  | boolean | no | `false` |  | Kerel debugging sako passoske kana thaven kadava pe true; garavel le latents anda sako pass. |

File parameters (`image`, `mask`, `ic_light_model_background_image_url`, `ic_light_image_url`) take a public `https://` URL, a `data:` URI up to 10 MB, or the `file_url` of an upload from `POST /files`.

## Example input

Required parameters only:

```json
{
  "model_name": "stabilityai/stable-diffusion-xl-base-1.0",
  "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}
```

A fuller example:

```json
{
  "model_name": "stabilityai/stable-diffusion-xl-base-1.0",
  "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}
```

## Run it

Set `DOITONG_API_KEY` to a key from https://doitong.com/developers/dashboard#keys. `?wait=20` returns the finished request in the same call when it is ready within 20 seconds; otherwise poll `GET /requests/{id}` (it also accepts `?wait=`), or pass `webhook_url`.

### curl

```bash
# 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/lora/inpaint?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model_name": "stabilityai/stable-diffusion-xl-base-1.0",
    "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
  }'

# 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"
```

### JavaScript

```javascript
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/lora/inpaint?wait=20", {
  method: "POST",
  headers,
  body: JSON.stringify({
    "model_name": "stabilityai/stable-diffusion-xl-base-1.0",
    "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
  }),
});
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 + ")");
```

### Python

```python
import os
import requests

API = "https://api.doitong.com/v1"
headers = {"Authorization": "Bearer " + os.environ["DOITONG_API_KEY"]}

payload = {
    "model_name": "stabilityai/stable-diffusion-xl-base-1.0",
    "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
}

# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/lora/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"])
```

### MCP

The MCP server at `https://api.doitong.com/v1/mcp` exposes the tools `search_models`, `get_model`, `quote`, `run`, `get_request`, `cancel_request`, `list_requests`, `create_upload` and `get_account`. A `run` call for this model:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "run",
    "arguments": {
      "model_id": "lora/inpaint",
      "input": {
        "model_name": "stabilityai/stable-diffusion-xl-base-1.0",
        "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
      },
      "wait_seconds": 20
    }
  }
}
```

## Response

Every call returns a request object. `status` is one of `queued`, `running`, `succeeded`, `failed`, `canceled`. `outputs` lists the generated files with URLs on our storage (kept forever, or 7 days with `?storage=temporary`; `storage` says which); `output` is the model's own result object with the same URLs.

```json
{
  "id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
  "object": "request",
  "model": "lora/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": 184,
    "usd": "0.184",
    "charged": 184,
    "refunded": 0
  },
  "input": {
    "model_name": "stabilityai/stable-diffusion-xl-base-1.0",
    "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
  },
  "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
      }
    ],
    "seed": 42,
    "has_nsfw_concepts": [
      false
    ],
    "debug_latents": {
      "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
    },
    "debug_per_pass_latents": {
      "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
    }
  },
  "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"
  }
}
```

### Output fields (`output`)

| Field | Type | Description |
|---|---|---|
| `images` | array of object {url, content_type, file_name, file_size, width, height} | Fajloskere informacie vaš e kerde kipura. |
| `seed` | integer | Kipo-generiripeqo seed, inkludirindoj o randomno kidlo valoro kana o inputo na sas seed; averčes, repetirisar o dindo valoro. |
| `has_nsfw_concepts` | array of boolean | Sikavel te si NSFW koncepto ande generirime kipo. |
| `debug_latents` | object {url, content_type, file_name, file_size} \| null | Latent data garavdino vaš debugging. |
| `debug_per_pass_latents` | object {url, content_type, file_name, file_size} \| null | Per-pass latent data garavdino vaš debugging. |

## Related models

- [Stable Diffusion with LoRAs](https://doitong.com/developers/models/lora.md) (`lora`): $0.057 / image
- [Stable Diffusion with LoRAs · Image to Image](https://doitong.com/developers/models/lora/image-to-image.md) (`lora/image-to-image`): $0.264 / image
- [FLUX.1 Kontext \[pro\]](https://doitong.com/developers/models/flux-pro/kontext.md) (`flux-pro/kontext`): $0.04 / image
- [GPT Image 2.5 Edit](https://doitong.com/developers/models/openai/gpt-image-2.5/flare/edit.md) (`openai/gpt-image-2.5/flare/edit`): from $0.12 / image
- [Nano Banana 2 Edit](https://doitong.com/developers/models/nano-banana-2/edit.md) (`nano-banana-2/edit`): from $0.06 / image
- [Nano Banana Pro Edit](https://doitong.com/developers/models/nano-banana-pro/edit.md) (`nano-banana-pro/edit`): from $0.15 / image
- [Qwen Image 3 Edit](https://doitong.com/developers/models/alibaba/qwen-image-3/edit.md) (`alibaba/qwen-image-3/edit`): from $0.04 / image
- [Seedream 5.0 Pro Edit](https://doitong.com/developers/models/bytedance/seedream/v5/pro/edit.md) (`bytedance/seedream/v5/pro/edit`): from $0.0675 / run of output image

## Links

- HTML page: https://doitong.com/developers/models/lora/inpaint
- All models and guides for AI agents: https://doitong.com/developers/llms.txt
- OpenAPI 3.1 with this model's typed request body: https://doitong.com/developers/openapi.json?model=lora/inpaint
- Errors: https://doitong.com/developers/docs/errors
- Model details as JSON: https://api.doitong.com/v1/models/lora/inpaint
