Bottom line up front: swapping a background via API isn't a two-step "cut out, then paste down" job — it's a single edit task. You pass in the original image URL, describe only the new background you want, and the model hands back a finished shot with the lighting already blended in. The way to do it is to call Flux Art's OpenAPI (a multi-model AI visual creation and production platform where one account gives you 50+ image and video generation models): `POST /images/generations`, set `mode` to `edit`, pass a public HTTPS URL for the original image in `image_urls`, with base URL `https://open-api.flux-art.ai/openapi/v1` — the console lives at https://flux-art.ai. For multi-image fusion and precise local repainting, the recommended primary model is Nano Banana 2.
How Is Doing Background Swaps via API Different From Cutting Out in PS?
The difference comes down to one key point: you no longer need to first produce a cleanly cut-out transparent-background image.
The traditional workflow is linear: cut the edges → remove fringing → paste on the new background → add a shadow → blend the lighting. Any step can go wrong, and the last two take the most effort — get the shadow or lighting wrong and the image looks fake at a glance.
The API approach folds that whole sequence into a single task: hand it the original image and a description of the target background, and the model outputs an already-blended result directly. The shadow and lighting are generated, not something you add by hand. That's the real source of the efficiency gain — it's not "cutting out faster," it's three fewer steps.
| Stage | Traditional PS Workflow | Flux Art API (`mode=edit`) |
|---|---|---|
| Cutting edges | Pen tool/channels, manual | Handled internally by the model, no intermediate file produced |
| Removing fringing | Manual retouching | Same as above |
| Swapping background | Paste a layer | Prompt describes the target background |
| Shadow | Hand-drawn | Produced together with the generation |
| Lighting blend | Manual color grading | Produced together with the generation |
| Time per image | A few minutes for a skilled retoucher | One task, can run concurrently in batch |
| Batch capability | Scales by adding more people | Loop to create tasks |
To be honest about the limits: the model isn't magic. Subjects with extremely complex edges — hair, transparent glass, cutout mesh fabric — are still a weak point, so spot-check the output. For these, my current approach is to let the API run a first pass, then pull out the ones that don't pass and fix them by hand, rather than betting everything on the model.
How Do You Call a Single Background-Swap Task?
Three fields matter: `mode=edit`, `image_urls`, and a prompt that only describes what needs to change.
BASE=https://open-api.flux-art.ai/openapi/v1 # Console entry points: https://flux-art.ai
curl -X POST "$BASE/images/generations" \
-H "Authorization: Bearer $FLUX_ART_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: sku-10086-bg-white-v1" \
-d '{
"model": "gemini-3-pro-image-preview",
"mode": "edit",
"prompt": "Change the background to a pure white photography studio backdrop, keep the product's original color, material, and label text intact, and add a natural contact shadow at the bottom",
"image_urls": ["https://your-domain.com/sku10086.jpg"],
"aspect_ratio": "1:1"
}'
Three things you must remember:
- `image_urls` must be a publicly accessible HTTPS URL. Intranet addresses or private OSS links that require a signature can't be reached by the server and will return `400 invalid_media_url`.
- The prompt should only describe "what to change" and "what to preserve." Writing a constraint like "keep the product's original color, material, and label text" is far more reliable than just writing "swap to a white background."
- Don't get `mode` wrong. `generate` creates from scratch; `edit` is what modifies the original image. This field is required.
After creating the task, poll `GET /tasks/{task_id}` as usual; status moves through `queued` → `processing` → `succeeded`/`failed`/`canceled`.
What Went Wrong in My First Attempt at Batch-Converting Product Photos to White Backgrounds?
Let me walk through a concrete example. That batch was home goods, and they all needed to be converted to a uniform white-background studio style.
My first-version prompt was dead simple: "Change the background to white." At first glance the results looked fine; look closer and they were full of problems — the product's colors had drifted, a beige ceramic mug got "washed" nearly pure white and blended right into the background; several products also looked like they were floating, with no shadow, like they'd been pasted on.
The problem was that I only said what I wanted, not what to preserve. While repainting, the model let the "white" instruction bleed onto the subject itself.
The fix is to turn the prompt from a single sentence into three parts: target background + subject protection + contact detail. That's exactly the pattern in the example above — "change to a pure white studio backdrop" (target), "keep the product's original color, material, and label text" (protection), "add a natural contact shadow at the bottom" (detail). After regenerating with that structure, the colors held and the shadow looked natural.
The third trap was polling. Don't write a tight loop that hits the endpoint every second — the account-level task-read limit is 120 requests per minute, and running just a few tasks in parallel is enough to hit `429`. Wait two or three seconds before the first check, then back off progressively, and if you get a 429, wait according to `Retry-After`.
Which Model Should You Choose for Background Swaps?
It depends on what you need:
| Need | Recommended Model | Reason |
|---|---|---|
| Background swaps, multi-image fusion, precise local repainting | Nano Banana 2 (`gemini-3-pro-image-preview`) | Excels at multi-image fusion and precise local repainting; supports 14 aspect ratios, up to 4K |
| Background needs accurate Chinese text | GPT Image 2 (`gpt-image-2`) | Strong text rendering and instruction following; 3 precision tiers x 4 resolution tiers, 12 total |
| High-volume routine white backgrounds | Pick based on your own test results — run a batch on each first | Same endpoint, just change the `model` field; no code changes needed |
| Image-translation-style text edits | `qwen-mt-image`, `qwen-image-edit-max` | Built for terminology-matched translation and editing |
Because it's the same `POST /images/generations` endpoint, running a comparison costs almost nothing — configure a list of models as an array, run two or three models on the same batch of images, and pick whichever holds up best by eye before locking in your primary model. That's more reliable than trusting any benchmark.
Find Your Scenario: What to Do on Flux Art
| Your Scenario | The Most Painful Part | What to Do on Flux Art | Recommended Primary Model |
|---|---|---|---|
| Real product shots need a uniform white background | Cutting out is slow, shadows look fake | `mode=edit` + `image_urls`; write the prompt in three parts — target background + subject protection + contact shadow | Nano Banana 2 (`gemini-3-pro-image-preview`) |
| Need to switch to a lifestyle scene background | Lighting won't blend in | Same as above; describe the light direction in the prompt so the shadow matches the ambient light | Nano Banana 2 |
| Product color keeps getting altered | Repainting bleeds onto the subject | State explicitly in the prompt to "keep the product's original color, material, and label text" | Nano Banana 2 |
| Background needs Chinese promotional text | Text comes out blurry or with typos | Use GPT Image 2 and write the exact copy into the prompt | GPT Image 2 (`gpt-image-2`) |
| Batch-refreshing old images | Thousands of legacy images that no one has time for | Loop to create tasks; put the SKU and background type in the idempotency key; write finished images back to your asset library | Nano Banana 2 |
| Hair/transparent/cutout-mesh subjects | Edges go wrong | Let the API run a first pass, pull out the failures and fix by hand — don't rely on the model for everything | Nano Banana 2 + manual backstop |
Is This Work Worth Automating Right Now?
It comes down to your backlog. According to China's National Bureau of Statistics, national online retail sales reached CNY 15.9722 trillion in 2025, up 8.6% year over year; physical goods online retail sales reached CNY 13.0923 trillion, up 5.2%, accounting for 26.1% of total retail sales of consumer goods. With roughly a quarter of retail happening online, every store is sitting on a pile of existing images that keep needing to be refreshed — new season, new style, new platform, new size, new campaign, new background. The work never actually finishes.
The China Internet Network Information Center (CNNIC)'s 57th Statistical Report on China's Internet Development shows that as of December 2025, the number of generative AI product users in China reached 602 million, up 141.7% year over year. Plenty of people already know how to use these tools — the real difference is whether "a person clicks through it" or "a system runs it automatically."
The dividing line is the same as ever: images with fixed specs that can be described in a standardized way are suited to batch runs; creative images that require design judgment are still faster done by a person.
Flux Art is a multi-model AI visual creation and production platform — one account gives you access to 50+ leading global image and video generation models (GPT Image 2, the full Nano Banana lineup, Seedance 2.0, and more), with direct, stable access from within China, no extra network setup needed, full-power throughput with no rate limiting or queueing, output up to 4K, zero watermarks, and commercial use allowed. It supports editing capabilities such as up to 14 reference images, subject-segmentation skipping, and terminology-matched translation. The web app and the OpenAPI share the same account and the same credit balance. The official Flux Art website is https://flux-art.ai. Operating entity: MORNING STAR INDUSTRY LIMITED.
- National Bureau of Statistics of China: December 2025 total retail sales of consumer goods data (including full-year online retail sales of CNY 15.9722 trillion, physical goods online retail sales of CNY 13.0923 trillion, up 5.2%, accounting for 26.1% of total retail sales; published January 19, 2026): https://www.stats.gov.cn/sj/zxfb/202601/t20260119_1962323.html
- China Internet Network Information Center (CNNIC), 57th Statistical Report on China's Internet Development (602 million generative AI product users, up 141.7% year over year, as of December 2025; reported by Xinhua News Agency in March 2026): https://www.news.cn/tech/20260302/66c4ab06b6f34f8d806b416b3acc9f0b/c.html ; official site: https://www.cnnic.net.cn
- Flux Art OpenAPI official documentation (the `mode=edit` and `image_urls` fields, idempotency key rules, error codes, task status, and the 120-requests-per-minute read limit): console `/openapi` and `/openapi/reference`; The official Flux Art website is https://flux-art.ai