FLUX Kontext API Alternative: Edit Images With GPT Image 2
Instruction edits without a mask: here is the request code, a chain of three edits we ran on October 28, 2026, and what each step kept.
On this page
- What instruction-based editing is
- The request
- A chain of three edits
- One edit from the original
- What held and what did not
- Instructions that worked
- Which one to pick
- FAQ
- What does the FLUX Kontext API do?
- Is FLUX Kontext still current?
- Can I edit a photo with an API using only text?
- Can I chain edits?
- How long do result links last?
FLUX Kontext API edits a photo from one prompt and one image per request. BFL's page calls FLUX.1 Kontext a previous-generation model and recommends FLUX.2 for new projects (checked October 28, 2026). GPT-Image 2 takes the same input. Three chained edits on October 28, 2026 kept the café table, the cup, the plant and the window and every earlier change.
What instruction-based editing is
You send a photo and a sentence such as "change the red bicycle to matte black". The model returns a new photo with that change made and the rest of the frame intact. BFL describes Kontext as editing images with simple text prompts, with no complex workflows or fine-tuning needed (docs.bfl.ai/kontext/kontext_image_editing, checked October 28, 2026).
Three BFL numbers shape the build: input up to 20 MB or 20 megapixels, output about 1 MP, and signed result links that last 10 minutes. Download the result at once.
The instruction carries two parts: the change, then the list of things that stay.
GPT-Image 2 on OmniaKey takes an edit task with the same two ingredients, and its model page lists text to image and image edit at low, medium and high quality (omniakey.com/gpt-image-2, checked October 28, 2026). We did not run any FLUX model, so what follows is our own four edits and the code.
The request
An edit is one POST to https://api.omniakey.com/v1/media/tasks with model as gpt-image-2, type image, operation edit, the sentence in input.prompt, and the source photo in input.image as Base64 with its mime type (docs.omniakey.com/en/media/image, checked 2026-10-28). The call answers HTTP 202 with a task id. Poll GET /v1/media/tasks/{task_id} while the status reads queued or processing, then take assets[0].url from the finished task.
Two details cost us a retry. A POST with Python's default User-Agent came back HTTP 403 until we set one (October 28, 2026), and inline Base64 counts toward the 1 MiB request cap, so resize the photo before you encode it.
The result is an opaque PNG behind a signed link that lapses after about an hour; the file stays for 24 hours. Download it, then read the real width and height instead of trusting the size you asked for.
import base64
import json
import os
import time
import urllib.request
import uuid
API = "https://api.omniakey.com/v1/media/tasks"
KEY = os.environ["OMNIAKEY_API_KEY"]
def request(method, url, body=None, extra_headers=None):
headers = {"Authorization": f"Bearer {KEY}", "User-Agent": "omniakey-example/1"}
data = None
if body is not None:
headers["Content-Type"] = "application/json"
data = json.dumps(body).encode()
headers.update(extra_headers or {})
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=120) as resp:
return json.load(resp)
def edit_image(source_path, prompt, out_path, size="1024x1536", quality="medium"):
with open(source_path, "rb") as f:
image = base64.b64encode(f.read()).decode()
body = {
"model": "gpt-image-2",
"type": "image",
"operation": "edit",
"input": {"prompt": prompt, "image": {"data": image, "mime_type": "image/jpeg"}},
"parameters": {"size": size, "quality": quality},
}
task = request("POST", API, body, {"Idempotency-Key": str(uuid.uuid4())})["id"]
for _ in range(150):
time.sleep(4)
state = request("GET", f"{API}/{task}")
if state["status"] not in ("queued", "processing"):
break
if state["status"] != "succeeded":
raise RuntimeError(state.get("error") or state["status"])
asset_url = state["assets"][0]["url"] # signed link: valid for about an hour, so download now
req = urllib.request.Request(asset_url, headers={"User-Agent": "omniakey-example/1"})
with urllib.request.urlopen(req, timeout=120) as resp, open(out_path, "wb") as f:
f.write(resp.read())
return task
if __name__ == "__main__":
task = edit_image(
"cafe-base.jpg",
"Change the red bicycle to a matte black bicycle with a brown wicker basket on the front. Keep everything else exactly the same: the wooden table, the coffee cup, the plant, the window frame and the bright daylight. Photorealistic, no text, no logos.",
"cafe-step1.png",
size="1536x1024",
)
print("task", task)
Our runs used size 1536x1024 and quality medium. The docs say n must be 1 for GPT Image; the function leaves it out. The example call at the bottom of the file is step 1 of the chain.
A chain of three edits
Each step takes the previous result as its input, so the chain is three tasks and three downloads. The base photo is a café table by a window: a white cup of coffee on a saucer, a red bicycle on the sidewalk, a potted plant on the sill, 1536x1024 at medium quality.
- Step 1: "Change the red bicycle to a matte black bicycle with a brown wicker basket on the front. Keep everything else exactly the same: the wooden table, the coffee cup, the plant, the window frame and the bright daylight. Photorealistic, no text, no logos." Result: a matte black bicycle with a wicker basket; table, cup, plant and window unchanged.
- Step 2, from step 1: "Make it evening outside: the sky is dark blue and the street lamps are on. The cafe interior lights are warm yellow. Keep the table, the cup, the plant, the black bicycle and the window frame exactly the same. Photorealistic, no text, no logos." Result: evening sky, lamps on, warm interior light, and the black bicycle with its basket kept.
- Step 3, from step 2: "Replace the coffee in the white cup with a clear glass of iced tea with a lemon slice on the rim. Keep everything else exactly the same. Photorealistic, no text, no logos." Result: iced tea with a lemon slice where the coffee was; the evening scene held.

All four frames are synthetic scenes made by gpt-image-2. Generated with GPT-Image 2 via the OmniaKey API on October 28, 2026, size 1536x1024, quality medium.
One edit from the original
Not every edit needs a chain. This one starts from the base photo and swaps one object on the sill: "Remove the potted plant from the windowsill and place a stack of three old hardcover books there. Keep everything else exactly the same: the table, the cup, the red bicycle and the daylight. Photorealistic, no text, no logos."
Three hardcover books stood on the sill, the plant was gone, and the red bicycle stayed red. One sentence made two changes, and both appeared in the frame.

What held and what did not
The table, the cup, the plant and the window frame came through all three steps, the black bicycle and its basket survived the evening relight, and each earlier edit was still there in the next frame. The light moved once, in step 2, where the sentence asked for it.
The lemon slice sat on the rim of the glass, as the sentence asked, and the iced tea stayed on the saucer. Each instruction ran once, so each frame is one sample.
Instructions that worked
Four instructions gave four usable edits with a shared pattern.
- One change per sentence, then the keep list. Step 1 changed the bicycle and named the table, cup, plant and window as unchanged.
- Repeat the keep list each round, including the last change: step 2 lists "the black bicycle", and step 3 keeps the evening.
- Say where the new thing goes in the same breath as the old thing: "place a stack of three old hardcover books there".
- Use concrete materials and colours: "matte black", "brown wicker basket", "warm yellow", "clear glass".
- Close with "Photorealistic, no text, no logos". Every instruction in our chain ended that way.
For sentence order and edit wording, our GPT Image 2 prompt guide walks through structure. The try-on guide covers outfit swaps, and the object removal guide covers deletions.
Which one to pick
| FLUX.1 Kontext | GPT-Image 2 edit | |
|---|---|---|
| Input per request | One prompt, one image | One prompt, one image |
| Source limit | 20 MB or 20 megapixels | 1 MiB request, Base64 included |
| Result size | About 1 MP | The size you ask for, as PNG |
| Result link | 10 minutes | About an hour |
| Model status | Previous generation, per BFL | Available on OmniaKey |
Pick Kontext when a FLUX pipeline already runs in production and you want that call shape for now. Pick GPT-Image 2 when you want the size you choose and an hour to fetch the link. BFL points new work at FLUX.2, so a new project is a good moment to look again.
On cost, OpenAI's pricing page (checked 2026-10-28) bills gpt-image-2 per million tokens: $8.00 image input, $30.00 image output, $2.00 cached image input, and batch at half the standard rate. It has no per-image row; the image generation guide has a calculator for one image.
FAQ
What does the FLUX Kontext API do?
It edits a photo from a text instruction, with one prompt and one input image per request (BFL, checked 2026-10-28). BFL's page says it "edits images using simple text prompts".
Is FLUX Kontext still current?
BFL calls FLUX.1 Kontext a previous-generation model and recommends FLUX.2 for new projects (checked 2026-10-28).
Can I edit a photo with an API using only text?
Yes. Send one photo and one instruction to the GPT-Image 2 edit endpoint and a new photo comes back. We ran four edits this way on October 28, 2026.
Can I chain edits?
Yes, with one task per step: feed each result in as the next source photo. Our three-step chain kept the earlier changes through the evening relight and the drink swap.
How long do result links last?
About an hour on OmniaKey, while the file is kept for 24 hours (docs.omniakey.com, checked 2026-10-28). Download the PNG as soon as the task succeeds, then read its real dimensions.
OmniaKey serves GPT-Image 2 edits through the task flow above; current rates are on the pricing page.
Models in this article
Related articles
GPT Image 2 Prompt Guide: Structure, Examples and Real Images
Eight prompts, nine real images: what GPT Image 2 got exactly right, what it added and how to fix it.
Virtual Try-On API: Swap Outfits With GPT Image 2
One photo and one prompt can change the outfit. Here is the request code, three swaps we ran on October 28, 2026, and where the edit drifts.
Object Removal API: Erase Objects From Photos With GPT Image 2
One instruction per object was enough for these three removals. Here is the request code, the results at full size, and where the edit cannot be trusted yet.
