Key Takeaways for Production Teams
- AI inpainting edits only masked regions of an image while preserving surrounding pixels, using a source image, binary mask, and text prompt.
- Production-scale pricing varies sharply: ModelsLab starts at $0.002 per image, while Black Forest Labs FLUX.2 Fill Pro reaches $0.045 per image at 300k monthly volume.
- Python integration patterns differ by provider, with Stability AI using multipart form data, Fal.ai accepting URLs via SDK, and Replicate requiring pinned model version hashes.
- Self-hosted tools such as AUTOMATIC1111 and ComfyUI remove per-image API costs but add hardware, maintenance, and engineering overhead.
- For creator teams focused on content production rather than product development, access built-in inpainting in Sozee without API keys or per-image billing.
Top AI Inpainting APIs Compared on Cost
The table below compares leading providers on the metrics that matter most at production scale. Pricing and model data are drawn from provider documentation cited inline.
| Provider | Inpainting Model(s) | Price per Image (est.) | Est. Cost at 300k/mo |
|---|---|---|---|
| Stability AI | SD 3.5 Medium, SDXL, Stable Image Ultra | $0.009 (SDXL) – $0.080 (Ultra) | ~$900 (SDXL) – ~$10,500 (SD 3.5 Medium) |
| Fal.ai | FLUX.1 Fill Pro, SDXL, FLUX schnell | $0.0023 (SDXL) – $0.03 (FLUX.2 Pro) | ~$690 (SDXL) – ~$9,000 (FLUX.2 Pro) |
| Replicate | FLUX schnell, SDXL, community models | $0.003 (FLUX schnell flat) – variable (community) | ~$900 (flat) – unpredictable (GPU-second billing) |
| ModelsLab (Segmind-adjacent) | SD 1.5 Inpaint, SDXL Inpaint, Flux Fill | $0.002 (SD 1.5) – $0.004 (SDXL) | ~$600 (SD 1.5) – $1,200 (SDXL); $199/mo unlimited plan |
| Black Forest Labs (FLUX direct) | FLUX.2 Fill Pro (inpaint/outpaint) | $0.045 per inpainting edit (1.5× generation rate) | ~$13,500 |
Picsart’s API documentation does not publish per-image inpainting rates comparable to the providers above, so pricing is available only through enterprise sales and cannot be compared like-for-like in this table.
Python Integration Patterns for Inpainting APIs
Every provider expects the same three logical inputs, which are source image, mask, and prompt, but the wire format differs. The snippets below show minimal Python patterns for the most commonly integrated endpoints.
Stability AI (REST, credit-based)
Stability AI inpainting accepts multipart form data. The mask uses white pixels for editable regions and black pixels to preserve content. Prompts should describe the entire scene, not just the masked area.
import requests, os response = requests.post( "https://api.stability.ai/v2beta/stable-image/edit/inpaint", headers={ "authorization": f"Bearer {os.environ['STABILITY_API_KEY']}", "accept": "image/*", }, files={ "image": open("photo.png", "rb"), "mask": open("mask.png", "rb"), }, data={ "prompt": "replace background with cozy cafe interior, warm light", "output_format": "png", }, ) with open("result.png", "wb") as f: f.write(response.content)
Fal.ai (FLUX.1 Fill Pro)
Fal’s FLUX.1 Fill endpoint accepts image and mask as URLs in formats such as JPEG, PNG, WebP, GIF, or AVIF and supports an optional enhance_prompt flag. The mask must match the source image dimensions exactly.
import fal_client, os result = fal_client.subscribe( "fal-ai/flux-pro/v1/fill", arguments={ "image_url": "https://example.com/photo.png", "mask_url": "https://example.com/mask.png", "prompt": "remove the logo, match surrounding wall texture", "enhance_prompt": True, }, ) print(result["images"][0]["url"])
Replicate (FLUX schnell / community models)
Replicate bills official models flat per image but charges community models per GPU-second, which makes costs unpredictable for complex prompts. Always pin to a specific model version hash in production.
import replicate, os output = replicate.run( "black-forest-labs/flux-fill-pro", input={ "image": open("photo.png", "rb"), "mask": open("mask.png", "rb"), "prompt": "seamless brick wall, matching mortar color", }, ) print(output[0])
ModelsLab (SD Inpaint endpoint)
ModelsLab’s POST /api/v3/inpaint accepts image and mask as URLs with additional parameters for inference steps, guidance scale, and strength.
import requests, os payload = { "key": os.environ["MODELSLAB_API_KEY"], "init_image": "https://example.com/photo.png", "mask_image": "https://example.com/mask.png", "prompt": "white ceramic mug on wooden table", "num_inference_steps": 30, "guidance_scale": 7.5, "strength": 0.8, } r = requests.post("https://stablediffusionapi.com/api/v3/inpaint", json=payload) print(r.json())
Free Inpainting API Options for Prototyping
Several providers offer limited free access to inpainting endpoints, but each carries meaningful constraints at production scale.
- Stability AI provides 25 free credits on signup with access to all endpoints including inpainting, and credits do not renew monthly.
- Pixazo.ai’s Stable Diffusion Inpainting API (SD 1.5) is free during preview, subject to rate limits.
- Alibaba Cloud’s wanx-x-painting model is available as a free trial with a 500-image quota, and paid usage is not supported after quota exhaustion.
- Fal.ai and Replicate both require a funded account for sustained use and do not publish a permanently free inpainting tier.
Free tiers work well for prototyping and quality evaluation. None of the options above sustain 300,000 images per month without a shift to paid plans. For teams that need to eliminate per-image costs entirely at high volume, self-hosting shifts the cost model from usage-based billing to fixed infrastructure and maintenance overhead.
Self-Hosted Inpainting from GitHub and Open Source
Self-hosted inpainting removes per-image API costs and rate limits, but it introduces hardware and maintenance overhead that your team must absorb.
- AUTOMATIC1111’s Stable Diffusion web UI provides a one-click installer with advanced inpainting, outpainting, and upscaling, and requires at least 4 GB VRAM for SD 1.5 models.
- ComfyUI is a GPL-3.0 node-based workflow engine for building complex inpainting pipelines on Mac, Windows, and Linux.
- InvokeAI (Apache-2.0) provides a streamlined interface for local text-to-image and inpainting generation.
- Krita AI Diffusion integrates Stable Diffusion inpainting into the Krita painting application via a local ComfyUI server and supports Flux 2, SD 1.5, and SDXL.
Self-hosted open models on cloud GPUs cost roughly $3–$40 for 10,000 images per month, which scales linearly to an estimated $100–$1,200 for 300,000 images per month. SDXL self-hosted on spot RTX 4090 hardware costs around $0.23 per 1,000 images. VRAM requirements vary by model and optimization.
Flux AI Inpainting in Production Workflows
Black Forest Labs offers dedicated inpainting and outpainting via the FLUX.1 Fill model, which accepts a source image, a mask, and a text prompt. flux-fill-pro on Replicate exposes the same professional inpainting and outpainting capability for seamless object removal, replacement, and image extension.
Flux 1.1 Pro Ultra is available at $0.06 per image via Replicate and fal.ai as a text-to-image model, and teams often pair it with FLUX.1 Fill for high-end editing workflows.
Flux.1 [dev] is competitive in prompt fidelity, anatomy, and photorealism, which makes it a strong baseline for quality-focused workflows. Flux.2 [dev] builds on this foundation and performs well on the Artificial Analysis Text-to-Image Arena, which shows measurable improvement in prompt adherence. Optimized Flux.2 variants generate images in under a second to about seven seconds on high-end hardware, while Flux Dev and other variants typically take 20–60 seconds depending on setup. This speed gap directly affects throughput and GPU capacity planning at 300,000 images per month.
Serverless and Web-Based Inpainting APIs
Serverless inpainting APIs remove infrastructure management and shift costs to pure usage, but they introduce rate-limit and cold-start realities that affect high-volume pipelines. Teams choose serverless when volume is unpredictable or when they want to avoid upfront GPU commitments, accepting less control over rate limits and latency.
- getimg.ai offers a single pay-as-you-go API key across 60+ models, including built-in inpainting, ControlNet, and upscaling.
- Wireflow’s Stable Diffusion API uses pay-per-image pricing for turbo checkpoints and supports inpainting by passing a mask image alongside the prompt, with no monthly minimums or idle GPU fees.
- Runflow’s Reference Inpaint API uses fixed pricing of $0.55 per request for reference-guided inpainting that matches style, texture, and context from a provided reference image.
- Apiframe authenticates all image editing requests using an X-API-Key header and returns a jobId that must be polled until status is COMPLETED, which adds latency to synchronous workflows.
Fal.ai offers automatic volume discounts at high image generation volumes, while Replicate offers enterprise pricing via direct contact that may include volume discounts. Neither publishes a public rate-limit ceiling for inpainting endpoints, so teams must test practical throughput.
Pricing Reality at 300k Images per Month
The cost gap between providers at 300,000 images per month is substantial and shapes which models are viable for production. AI image API prices in 2026 span roughly 90×, from $0.002 to $0.21 per standard 1024×1024 image, depending on the model, provider, and billing structure.
- ModelsLab SD 1.5 at $0.002 per image sits near the low end of the range, and its unlimited plan at $199 per month caps spend while supporting up to 15 parallel generations.
- Stability AI SDXL at $0.009 per image moves into a midrange tier, while SD 3.5 Medium at $0.035 per image pushes total monthly cost into five figures.
- Fal.ai SDXL at $0.0023 per image remains close to ModelsLab on cost, while FLUX.2 Pro at $0.03 per image targets teams that prioritize quality over budget.
- Black Forest Labs FLUX.2 Fill Pro inpainting at $0.045 per image represents a premium tier for high-end editing.
- Self-hosted open models on cloud GPUs cluster between $100 and $1,200 per month at 300,000 images, but they require engineering time for infrastructure management.
Engineering overhead compounds these figures and often rivals API spend. Async polling, mask preprocessing, error handling, retry logic, and model versioning each demand dedicated development time before a single production image ships, so teams should factor internal hourly rates into total cost of ownership.
When to Skip the API Layer Entirely
API integration makes sense when masked editing is a core feature of a product that already has engineering resources allocated. It makes far less sense when the primary need is consistent, high-volume content production for a creator brand, agency roster, or influencer campaign, because the integration work does not create content.
In this context, friction means time and complexity spent on infrastructure instead of images. Three common scenarios share this pattern and see more cost than value from APIs:
- Solo developers shipping content, not products. Writing async polling loops, managing mask dimensions, and debugging GPU-second billing is engineering work that produces no content. The output is infrastructure, not images.
- Agencies managing multiple creator accounts. Each client requires consistent likeness, reusable environments, and predictable output. APIs return images, but they do not lock identity across a set or reuse a saved bedroom environment across 50 shoots.
- Micro-influencers fulfilling brand deliverables. A sponsorship brief that needs a product in four outfits, three settings, and six angles cannot be fulfilled by writing Python. It requires a studio that drops the product into an Object slot and generates the full set.
Sozee’s built-in inpainting, available in the Refine suite, accepts a brush mask, a description of the change, and an optional reference image. No API key, no mask dimension matching, and no polling are required. The same tool that locks likeness across a Photo Shoot set also handles localized edits, so a creator can remove a prop, swap a background, or fix an artifact without leaving the studio or writing code.

Every environment, outfit, and object built in Sozee is saved as a reusable asset. A bedroom set built once can be used in every shoot for a year. A sponsor’s product dropped into the Object slot generates across every setting in the library. AI image generation costs have dropped substantially since 2022, but the integration cost of building a reliable inpainting pipeline has not fallen at the same rate. Start building reusable assets in Sozee instead of rebuilding prompts for every image.

Decision Framework for APIs vs Sozee
Use an AI inpainting API when the product and team match these conditions:
- Masked editing is a feature inside a product with a dedicated engineering team.
- Volume exceeds 300,000 images per month and self-hosting on spot GPU instances is operationally viable.
- Output must integrate with an existing image pipeline that already handles async job management.
- Model-level control such as ControlNet, LoRA, or custom checkpoints is a hard requirement.
Use Sozee when the goal is content production with minimal engineering:
- The goal is content production, not product development.
- Likeness consistency across a set is non-negotiable.
- Reusable environments, outfits, and objects need to compound across shoots rather than be re-described in every prompt.
- The team has no engineering resources or cannot afford the integration timeline.
- Scheduling, analytics, and multi-platform publishing need to close the loop without exporting to additional tools.
Frequently Asked Questions
Is there a genuinely free AI inpainting option for ongoing use?
No provider offers a permanently free inpainting tier suitable for ongoing production use. The free options detailed earlier, including Stability AI’s 25 non-renewing credits, Pixazo.ai’s rate-limited preview, and Alibaba Cloud’s 500-image trial, are all capped or time-limited. For sustained use without per-image costs, self-hosting via AUTOMATIC1111 or ComfyUI on local or cloud GPU hardware is the only genuinely free path, though it requires hardware investment and ongoing maintenance. Sozee does not charge per image for inpainting edits made within the platform’s Refine suite, because edits are part of the studio workflow rather than a separately metered API call.
What is the cheapest inpainting API for a prototype?
For prototyping, ModelsLab’s SD 1.5 inpainting endpoint at $0.002 per image offers one of the lowest published pay-as-you-go rates among major providers. Pixazo.ai’s free preview tier is the lowest-cost option for very small volumes, subject to rate limits. Wireflow’s pay-per-image pricing with no monthly minimums is a practical starting point for developers who need a clean REST interface without committing to a subscription. For non-technical creators who need inpainting without writing code, Sozee’s Refine suite provides brush-based inpainting inside the same studio used for generation, with no separate API integration required.
How do I call an AI inpainting API in Python?
Every major inpainting API requires the same three logical inputs, which are a source image, a binary mask image with identical pixel dimensions, and a text prompt. The wire format varies by provider. Stability AI uses multipart form data posted to its REST endpoint with an API key in the Authorization header. Fal.ai uses its Python SDK with image and mask supplied as public URLs. Replicate uses its Python client with the model identifier pinned to a specific version hash. ModelsLab accepts a JSON payload with image and mask as URLs. In almost all cases, the mask convention is white pixels for the region to regenerate and black pixels for areas to preserve, with the exception of OpenAI’s GPT Image 2, which uses a PNG alpha channel where transparent pixels mark the edit region. Async polling is required for most providers, and only synchronous endpoints return the result directly in the response body.
What open-source GitHub repositories support AI inpainting at scale?
The most widely deployed open-source inpainting stacks are AUTOMATIC1111’s Stable Diffusion web UI, ComfyUI, and InvokeAI. AUTOMATIC1111 provides a one-click installer and supports SD 1.5, SDXL, and Flux models with inpainting, outpainting, and ControlNet. ComfyUI is a node-based workflow engine suited to building complex multi-step inpainting pipelines and is the backend used by Krita AI Diffusion. InvokeAI offers a cleaner interface for teams that do not need the full AUTOMATIC1111 feature set. For Flux-based inpainting specifically, the FLUX.1 Fill model weights are available from Black Forest Labs and can be loaded into ComfyUI with appropriate node packages. Hardware requirements for 300,000 images per month at acceptable throughput start at a dedicated RTX 4090 (24 GB VRAM) for SDXL and move to A100-class hardware for Flux.1 [dev] at production speed.
Conclusion: Matching Inpainting Tools to Your Workflow
The AI inpainting API landscape in July 2026 delivers strong quality at every price point, from ModelsLab’s $0.002-per-image SD 1.5 endpoint to Black Forest Labs’ $0.045-per-image FLUX.2 Fill Pro. The key evaluation criteria are integration complexity, cost at your actual volume, rate-limit headroom, model quality for your specific use case, and whether your team has the engineering capacity to build and maintain the pipeline.
For developers building inpainting into a product, the comparison table and Python snippets above provide a direct starting point. For creator teams, agencies, and micro-influencers whose goal is content production rather than infrastructure, the API layer adds engineering overhead without adding the consistency, reusability, or scheduling that a production content workflow actually requires.
Sozee’s inpainting is one tool inside a complete studio, the same platform that locks likeness, saves environments and outfits as reusable assets, generates Photo Shoot sets, schedules across platforms, and measures what works. No API key, no mask dimension debugging, and no per-image billing for edits. Try Sozee’s complete studio to see how inpainting, likeness locking, and reusable assets work together.