# Freja Inpaint — Deepixels Edit selected parts of an image with Fooocus inpainting, uploaded masks or automatic clothing detection, plus optional SDXL LoRAs. Model ID: freja/inpaint Revision: freja-inpaint-v2 Playground: https://www.deepixels.co/explore/freja/inpaint API reference: https://www.deepixels.co/explore/freja/inpaint/api Availability: Enabled Categories: Image to image ## API usage Authenticate requests with your Deepixels API key in the x-api-key header. Keep the key server-side; never include it in public source code. Submit POST https://api.deepixels.co/v1/generate with JSON {model, input}. Use the model ID above and the input schema below. Poll GET https://api.deepixels.co/v1/get?jobId=YOUR_JOB_ID with the same x-api-key header, or use a webhook as documented by the API. ## Request body fields - model (string, required): The exact model ID to run. Value: "freja/inpaint". - input (object, required): Model inputs as a JSON object. Supported fields and limits are documented below. - webhook (string, optional): Optional public HTTPS URL. Deepixels sends a POST when the job completes or fails, with the same job body returned by GET /v1/get. Return a 2xx status to acknowledge delivery. Delivery may be retried, so handle repeated job IDs safely. ## Create-job response - jobId (string): The job ID. Use it to read this job's status and result. - status (string): The initial job status. Submission returns before generation finishes. - credit (number): Credits reserved by the server using the current model pricing. This is a response field; do not send it in the request. Expected HTTP 200 response (illustrative; credit is not a quote): ```json { "jobId": "example-job-id", "status": "created", "credit": 1 } ``` ## Get-job response - jobId (string): The job ID. - model (string): The model used by this job. - status (string): Stop polling at completed or failed. Values: created, pending, processing, completed, failed. - input (object | null): The saved model inputs. - webhook (string | null): The callback URL, when supplied. - output (object | null): The current Deepixels job API returns result URL arrays, such as videoUrl, imageUrl or audioUrl when available. It can be null before a result exists. The worker schema below describes worker media metadata, not this job envelope. - date (number | null): Job creation time as a Unix timestamp in milliseconds, when available. - startedAt (number | null): Job start time as a Unix timestamp in milliseconds, when available. - finishedAt (number | null): Job finish time as a Unix timestamp in milliseconds, when available. - durationMs (number | null): Recorded job duration in milliseconds, when available. - resultExpiresAt (number | null): Result expiry time as a Unix timestamp in milliseconds, when available. - recordExpiresAt (number | null): Job record expiry time as a Unix timestamp in milliseconds, when available. Expected HTTP 200 response examples. IDs, URLs and timings are illustrative; stop polling at completed or failed. ### completed ```json { "jobId": "example-job-id", "model": "freja/inpaint", "status": "completed", "input": { "prompt": "A tailored cobalt-blue jacket over a white blouse, realistic fabric folds and natural lighting. Keep the person's face, hair, pose and background unchanged.", "images": [ { "role": "target", "url": "https://r2.deepixels.co/explore/freja/h3-image/examples/9ca91ff7-9fa6-44a8-9eae-a3be4f2ac97a/inputs/character-reference-v1.png" } ], "parameters": { "detect_cloth": true, "detect_expansion": 10, "steps": 30, "guidance_scale": 4, "strength": 1, "seed": 42, "loras": [] } }, "webhook": null, "output": { "imageUrl": [ "https://r2.deepixels.co/results/example-result.png" ] }, "date": 1767225600000, "startedAt": 1767225601000, "finishedAt": 1767225901000, "durationMs": 300000, "resultExpiresAt": 1767312301000, "recordExpiresAt": null } ``` ### processing ```json { "jobId": "example-job-id", "model": "freja/inpaint", "status": "processing", "input": { "prompt": "A tailored cobalt-blue jacket over a white blouse, realistic fabric folds and natural lighting. Keep the person's face, hair, pose and background unchanged.", "images": [ { "role": "target", "url": "https://r2.deepixels.co/explore/freja/h3-image/examples/9ca91ff7-9fa6-44a8-9eae-a3be4f2ac97a/inputs/character-reference-v1.png" } ], "parameters": { "detect_cloth": true, "detect_expansion": 10, "steps": 30, "guidance_scale": 4, "strength": 1, "seed": 42, "loras": [] } }, "webhook": null, "output": null, "date": 1767225600000, "startedAt": 1767225601000, "finishedAt": null, "durationMs": null, "resultExpiresAt": null, "recordExpiresAt": null } ``` ### failed ```json { "jobId": "example-job-id", "model": "freja/inpaint", "status": "failed", "input": { "prompt": "A tailored cobalt-blue jacket over a white blouse, realistic fabric folds and natural lighting. Keep the person's face, hair, pose and background unchanged.", "images": [ { "role": "target", "url": "https://r2.deepixels.co/explore/freja/h3-image/examples/9ca91ff7-9fa6-44a8-9eae-a3be4f2ac97a/inputs/character-reference-v1.png" } ], "parameters": { "detect_cloth": true, "detect_expansion": 10, "steps": 30, "guidance_scale": 4, "strength": 1, "seed": 42, "loras": [] } }, "webhook": null, "output": null, "date": 1767225600000, "startedAt": 1767225601000, "finishedAt": 1767225901000, "durationMs": 300000, "resultExpiresAt": null, "recordExpiresAt": null } ``` ## List requests GET https://api.deepixels.co/v1/model-requests?model=freja%2Finpaint with the same x-api-key header. Only your jobs for this model are returned, newest first, up to 20 per page. Response: {requests: [{response, source, contractVersion, billing}], next_cursor}. response is the full Get-job response. billing has state, reservedCredits, chargedCredits and refundedCredits; unknown amounts are null. source is playground, api or unknown (informational only). Pass next_cursor as cursor for the next page; null means the end. Temporary media can expire without removing request details. ## Model inputs ### prompt Type: string; required Describe the replacement inside the mask, such as a new garment, object or texture. Be specific about color and materials. Minimum length: 1 character Maximum length: 2,000 characters Example: A tailored cobalt-blue jacket with realistic fabric folds. ### target Type: public HTTPS media URL; required Choose the image to edit. Its longest side is reduced to 1024 pixels if larger; smaller images stay at their original size. Maximum length: 8,192 characters Example: A photo of an adult wearing the clothes you want to change. ### mask Type: public HTTPS media URL Optionally upload a black-and-white image matching the target's dimensions. White marks what to repaint; black marks what to keep. A supplied mask overrides automatic clothing detection and expansion. Maximum length: 8,192 characters Example: Paint the jacket white and everything else black; export with an opaque black background. ### parameters.detect_cloth Type: boolean Automatically find clothing when no mask is uploaded. Turn this on if you are not supplying a mask. An uploaded mask always takes priority. Example: Turn on to replace clothing without drawing a mask. Default: false ### parameters.detect_expansion Type: integer Grow the automatic clothing mask by 0–1024 pixels. Larger values may include nearby skin, hair or background. Ignored with an uploaded mask. Minimum: 0 Maximum: 1024 Example: 10 expands the detected region by ten pixels. Default: 0 ### negative_prompt Type: string Optionally describe unwanted details. This applies to the generated region; it does not draw the mask. Maximum length: 2,000 characters Example: blurry fabric, distorted patterns Default: "" ### parameters.steps Type: integer Choose 1–60 processing steps. More steps take longer; start with 30. Minimum: 1 Maximum: 60 Example: 30 Default: 30 ### parameters.guidance_scale Type: number Choose 1–20. Higher values follow the prompt more strongly but may look less natural. Minimum: 1 Maximum: 20 Example: 4 Default: 4 ### parameters.strength Type: number Choose 0.1–1. Higher values allow larger changes inside the edited region. Minimum: 0.1 Maximum: 1 Example: 1 Default: 1 ### parameters.seed Type: integer Leave blank for a random result, or use 0–4294967295 to repeat the starting noise. Minimum: 0 Maximum: 4294967295 Example: 42 ### parameters.loras Type: array Optionally add up to five compatible SDXL Safetensors LoRAs. Each has its own URL and weight. An incompatible adapter fails the job. Maximum items: 5 Example: Paste a public adapter URL and start with weight 0.8. Default: [] ## Input schema ```json { "type": "object", "additionalProperties": false, "required": [ "prompt", "images" ], "properties": { "prompt": { "type": "string", "minLength": 1, "maxLength": 2000, "pattern": "\\S", "description": "Describe what should appear inside the edited region. The public API requires a nonblank prompt, up to 2,000 characters (Deepixels product limit). Keep the edit description focused." }, "negative_prompt": { "type": "string", "maxLength": 2000, "default": "", "description": "Optional details to avoid inside the edited region. Up to 2,000 characters (Deepixels product limit)." }, "images": { "type": "array", "minItems": 1, "maxItems": 2, "contains": { "type": "object", "required": [ "role" ], "properties": { "role": { "const": "target" } } }, "items": { "type": "object", "additionalProperties": false, "required": [ "url", "role" ], "properties": { "url": { "type": "string", "format": "uri", "pattern": "^https://", "maxLength": 8192 }, "role": { "enum": [ "target", "mask" ] } } }, "description": "Exactly one target, optionally one mask. White mask areas repaint; black preserves. A supplied mask skips automatic detection and expansion. Still PNG/JPEG/WebP, at most 30 MiB/64 MP; matching oriented target/mask dimensions. Playground uploads use 10 MiB/12 MP." }, "parameters": { "type": "object", "additionalProperties": false, "default": {}, "properties": { "detect_cloth": { "type": "boolean", "default": false, "description": "Generate a clothing mask when no mask is supplied. Must be true when the mask is omitted; has no effect when a mask is supplied." }, "detect_expansion": { "type": "integer", "minimum": 0, "maximum": 1024, "default": 0, "description": "Grow an automatically detected clothing mask by this many pixels on the capped image. Ignored with supplied masks." }, "seed": { "type": "integer", "minimum": 0, "maximum": 4294967295, "description": "Leave omitted for a random seed." }, "steps": { "type": "integer", "minimum": 1, "maximum": 60, "default": 30 }, "guidance_scale": { "type": "number", "minimum": 1, "maximum": 20, "default": 4 }, "strength": { "type": "number", "minimum": 0.1, "maximum": 1, "default": 1 }, "loras": { "type": "array", "maxItems": 5, "default": [], "description": "Additional compatible SDXL Safetensors adapters. Default offset LoRA and required inpaint patch remain active. Each download is limited to 2 GiB; incompatible adapters fail.", "items": { "type": "object", "additionalProperties": false, "required": [ "url" ], "properties": { "url": { "type": "string", "format": "uri", "pattern": "^https://", "maxLength": 8192 }, "weight": { "type": "number", "minimum": -2, "maximum": 2, "default": 1 }, "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$", "description": "Optional expected SHA-256 checksum of the adapter file." } } } } } } }, "anyOf": [ { "type": "object", "properties": { "images": { "contains": { "type": "object", "required": [ "role" ], "properties": { "role": { "const": "mask" } } } } }, "required": [ "images" ] }, { "type": "object", "required": [ "parameters" ], "properties": { "parameters": { "type": "object", "required": [ "detect_cloth" ], "properties": { "detect_cloth": { "const": true } } } } } ] } ``` ## Worker output schema ```json { "type": "object", "required": [ "schema_version", "results", "metadata" ], "properties": { "schema_version": { "const": 1 }, "results": { "type": "array", "minItems": 1, "maxItems": 1, "items": { "type": "object", "required": [ "type", "url", "content_type", "width", "height", "bytes" ], "properties": { "type": { "const": "image" }, "url": { "type": "string", "format": "uri", "pattern": "^https://", "maxLength": 8192 }, "content_type": { "const": "image/png" }, "width": { "type": "integer", "minimum": 1, "maximum": 1024 }, "height": { "type": "integer", "minimum": 1, "maximum": 1024 }, "bytes": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 }, "metadata": { "type": "object", "properties": { "seed": { "type": "integer", "minimum": 0, "maximum": 4294967295 } } } } } }, "metadata": { "type": "object", "properties": { "model": { "type": "string" }, "processing_seconds": { "type": "number" } } } } } ``` The worker output schema describes model media output. Use the documented Deepixels job response and output URL fields when polling. ## Example: undefined ```json { "model": "freja/inpaint", "input": { "prompt": "A tailored cobalt-blue jacket over a white blouse, realistic fabric folds and natural lighting. Keep the person's face, hair, pose and background unchanged.", "images": [ { "role": "target", "url": "https://r2.deepixels.co/explore/freja/h3-image/examples/9ca91ff7-9fa6-44a8-9eae-a3be4f2ac97a/inputs/character-reference-v1.png" } ], "parameters": { "detect_cloth": true, "detect_expansion": 10, "steps": 30, "guidance_scale": 4, "strength": 1, "seed": 42, "loras": [] } } } ``` ## Submit a generation (cURL) Bash or a compatible shell. Replace the API key placeholder. ```shell curl https://api.deepixels.co/v1/generate \ -H 'Content-Type: application/json' \ -H 'x-api-key: YOUR_DEEPIXELS_API_KEY' \ --data-raw '{"model":"freja/inpaint","input":{"prompt":"A tailored cobalt-blue jacket over a white blouse, realistic fabric folds and natural lighting. Keep the person'\''s face, hair, pose and background unchanged.","images":[{"role":"target","url":"https://r2.deepixels.co/explore/freja/h3-image/examples/9ca91ff7-9fa6-44a8-9eae-a3be4f2ac97a/inputs/character-reference-v1.png"}],"parameters":{"detect_cloth":true,"detect_expansion":10,"steps":30,"guidance_scale":4,"strength":1,"seed":42,"loras":[]}}}' ``` ## Submit a generation (JavaScript) Run server-side with Node.js 18 or newer. Set DEEPIXELS_API_KEY in your environment. ```javascript const apiKey = process.env.DEEPIXELS_API_KEY; if (!apiKey) throw new Error("Set DEEPIXELS_API_KEY first."); const request = { "model": "freja/inpaint", "input": { "prompt": "A tailored cobalt-blue jacket over a white blouse, realistic fabric folds and natural lighting. Keep the person's face, hair, pose and background unchanged.", "images": [ { "role": "target", "url": "https://r2.deepixels.co/explore/freja/h3-image/examples/9ca91ff7-9fa6-44a8-9eae-a3be4f2ac97a/inputs/character-reference-v1.png" } ], "parameters": { "detect_cloth": true, "detect_expansion": 10, "steps": 30, "guidance_scale": 4, "strength": 1, "seed": 42, "loras": [] } } }; const response = await fetch("https://api.deepixels.co/v1/generate", { method: "POST", headers: { "Content-Type": "application/json", "x-api-key": apiKey }, body: JSON.stringify(request), }); const job = await response.json(); if (!response.ok) throw new Error(job.message || "Generation request failed."); console.log(job); ``` ## Submit a generation (Python) Python 3, using only its standard library. Set DEEPIXELS_API_KEY in your environment. ```python import json import os import urllib.request payload = json.loads("{\"model\":\"freja/inpaint\",\"input\":{\"prompt\":\"A tailored cobalt-blue jacket over a white blouse, realistic fabric folds and natural lighting. Keep the person's face, hair, pose and background unchanged.\",\"images\":[{\"role\":\"target\",\"url\":\"https://r2.deepixels.co/explore/freja/h3-image/examples/9ca91ff7-9fa6-44a8-9eae-a3be4f2ac97a/inputs/character-reference-v1.png\"}],\"parameters\":{\"detect_cloth\":true,\"detect_expansion\":10,\"steps\":30,\"guidance_scale\":4,\"strength\":1,\"seed\":42,\"loras\":[]}}}") request = urllib.request.Request( "https://api.deepixels.co/v1/generate", data=json.dumps(payload).encode("utf-8"), headers={ "Content-Type": "application/json", "x-api-key": os.environ["DEEPIXELS_API_KEY"], }, method="POST", ) with urllib.request.urlopen(request, timeout=60) as response: job = json.load(response) print(job) ``` ## Request body (JSON) Send this JSON body to POST /v1/generate with your x-api-key header. ```json { "model": "freja/inpaint", "input": { "prompt": "A tailored cobalt-blue jacket over a white blouse, realistic fabric folds and natural lighting. Keep the person's face, hair, pose and background unchanged.", "images": [ { "role": "target", "url": "https://r2.deepixels.co/explore/freja/h3-image/examples/9ca91ff7-9fa6-44a8-9eae-a3be4f2ac97a/inputs/character-reference-v1.png" } ], "parameters": { "detect_cloth": true, "detect_expansion": 10, "steps": 30, "guidance_scale": 4, "strength": 1, "seed": 42, "loras": [] } } } ``` ## Credit pricing 0.05 credits per successful image. - One PNG is generated per request, with a maximum 1024-pixel longest side. - The price includes 1–60 steps, automatic clothing detection or an uploaded mask, and optional LoRAs. - Credits are reserved before submission. Failed jobs refund the reserved credits. Pricing rules and exact billing details (credits): ```json { "version": "freja-inpaint-credits-v1", "combine": "sum", "minimum_credits": "0", "description": "0.05 credits per successful image.", "notes": [ "One PNG is generated per request, with a maximum 1024-pixel longest side.", "The price includes 1–60 steps, automatic clothing detection or an uploaded mask, and optional LoRAs.", "Credits are reserved before submission. Failed jobs refund the reserved credits." ], "rules": [ { "id": "one-image", "metric": "billing.images", "unit_size": 1, "credits_per_unit": "0.05", "quantity_rounding": "ceil", "when": {}, "aggregation": "sum", "minimum_credits": "0", "rounding": { "mode": "ceil", "scope": "total", "increment": "0.000001" } } ] } ``` ## Limits and behavior - The public API requires a nonblank prompt up to 2,000 characters; negative_prompt also accepts up to 2,000 characters. These are Deepixels product limits, not native Fooocus context limits. - Supply exactly one target and at most one mask. Without a mask, detect_cloth must be true. - An uploaded mask must match the target after image orientation: white repaints, black preserves. Alpha is not treated as a mask; empty masks fail. - Target and mask resize together to at most 1024 pixels on the longest side, without upscaling. Fooocus blends boundaries; preserved regions are not a pixel-exact guarantee. - Automatic clothing segmentation may miss areas or include nearby objects. Expansion grows the mask but does not guarantee coverage. - One PNG per job. No output-count, resolution, video or audio controls. Standard public inputs exclude legacy delivery options and storage credentials. - Results expire after 24 hours unless saved to private assets.