Editing · REPRODUCIBLE GUIDE

AI Inpainting API: Masking Workflow and Test Cases

Plan an inpainting workflow that preserves protected regions and records edit-specific acceptance checks.

One API gateway for multiple AI models.

APIMart is a multi-model AI API gateway with an OpenAI-compatible endpoint. Use one account to access supported image models, compare current pricing, and choose a cost-efficient option for each workload.

Create an APIMart account ↗
Browse all guides
WHY THIS GUIDE EXISTS

Test the workflow,
not the marketing claim.

Targets repair, object replacement, localized retouching, and controlled product edits.

Editing

Remove tabletop object

Remove the red ceramic cup from the table and reconstruct the walnut grain and its soft window reflection; preserve every other object, crop, color, and shadow.
Localized object removal3:2
Editing

Replace shirt mark

Inside the supplied mask only, replace the chest graphic with a plain unprinted fabric area matching the shirt weave, folds, light direction, and color; do not change the person.
Localized apparel edit4:5
Editing

Repair vintage portrait

Repair scratches and missing emulsion in the masked areas of the vintage portrait, preserve original facial features and film grain, maintain monochrome tonality, do not beautify or modernize.
Photo restoration fixture4:5
PYTHON QUICKSTART

Keep the request reproducible.

Store credentials in the environment. Record the exact model identifier, dimensions, test date, and retry count with the resulting asset.

import os
from openai import OpenAI

client = OpenAI(
  api_key=os.environ["APIMART_API_KEY"],
  base_url="https://api.apimart.ai/v1",
)

result = client.images.generate(
  model="gpt-image-1-official",
  prompt=PROMPT,
  size="1024x1024",
  n=1,
)
REVIEW CHECKLIST

Before you publish a result