GPT-6 Sol & Claude Opus 5.5 are liveGPT-6 Sol at half the price of 5.6 Sol

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.

Kiki, OmniaKey COO7 min read
On this page

Yes, with a text prompt. The GPT-Image 2 edit endpoint changed the outfit on one photo and kept the pose, face and background in our three swaps on October 28, 2026. It has no dedicated garment input, but a second garment photo changed the dress's length in our run. Check each result by eye.

The request is an image edit on OmniaKey's media API: one source photo, a prompt, and optional reference images. We checked the function below on October 28, 2026 with a different prompt (a yellow raincoat) on a 1024-pixel JPEG of the base model, and it returned a 1024x1536 PNG.

What an edit can and cannot do for a try-on

An image edit starts with a source photo and a prompt. The operation is edit, the source goes inline as Base64, and the prompt names the new outfit; OmniaKey's image API docs (checked October 28, 2026) also allow several reference images in an images array. The result is a new frame, so the clothing changes while the person stays put: in our runs the face, pose, hair and studio background held.

Two limits matter for a try-on: there is no separate garment field, so the model draws the garment from your description or a second photo, and the new frame can touch details you did not name. A try-on feature should show the result for review and let the shopper judge the match. The same operation also handles removing an object from a scene; for instruction-led edits, see the FLUX Kontext alternative guide.

Send the photo and the outfit prompt

Send a POST to https://api.omniakey.com/v1/media/tasks with a bearer key, a JSON body, and an Idempotency-Key header; OmniaKey's image API docs (checked October 28, 2026) say creation returns HTTP 202 and a task id. Poll the task URL while the status is queued or processing; succeeded means the assets are ready, and a failed task carries error.code and error.message and is not charged.

Set the task fields like this:

FieldValue
modelgpt-image-2
typeimage
operationedit
input.promptthe outfit instruction
input.imagethe source photo as a data and mime_type object
input.imagesextra reference photos
parameters.sizeWIDTHxHEIGHT
parameters.qualitylow, medium, high or auto
parameters.n1

Keep the request under 1 MiB, because inline Base64 counts toward that cap. The sample count must be 1, and the API always returns an opaque PNG, so read the real dimensions from the downloaded file.

Here is the function:

python
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(
        "vto-base.jpg",
        "Change the outfit: she now wears a red satin slip dress with thin straps that falls to mid-calf. Keep the same pose, face, hair, body, the plain light-gray studio background and the lighting exactly as they are. Photorealistic, no text, no logos.",
        "vto-slip.png",
        size="1024x1536",
    )
    print("task", task)

The signed asset URL lasts about an hour and the file is kept for 24 hours, per the same docs, so download it as soon as the task succeeds. Our check on October 28, 2026 used the yellow raincoat prompt on a 1024-pixel JPEG of the base model, and it returned a 1024x1536 PNG. The script sends a User-Agent header: Python's default was refused with HTTP 403 in our run, and adding the header fixed it.

Three outfit swaps we ran

All three swaps started from the same synthetic photo: a woman in a white crew-neck T-shirt and dark blue jeans against a plain light-gray studio, made at 1024x1536 and quality medium in our runs on October 28, 2026.

Swap 1 asked for a red satin slip dress with thin straps that falls to mid-calf. The dress came out, and the pose, face, hair and background stayed the same. The white sneakers became white strappy heels without being asked.

Swap 2 asked for a dark green wool blazer over a cream silk camisole, with black straight-leg trousers. All three pieces appeared, and the white sneakers stayed.

Swap 3 asked for a navy and white horizontal striped long-sleeve top with a small embroidered red heart on the left chest. The stripes and the heart landed on the left chest; the dark blue jeans and white sneakers stayed.

Four studio portraits: the original white T-shirt and jeans, a red satin slip dress, a dark green blazer, and a striped top
Original and three text-only outfit swaps. Same pose, face and studio background in each.

Every person and scene here is synthetic, and we ran each prompt once, so each image is one sample.

Generated with GPT-Image 2 via the OmniaKey API on October 28, 2026, size 1024x1536, quality medium.

A garment photo as a second reference

For a closer match, send the garment as a second image. We put the person photo first, a flat-lay red satin slip dress second, and used input.images with this prompt: "Dress the woman in the first image in the red satin slip dress shown in the second image. Keep her pose, face, hair, body, the plain light-gray studio background and the lighting exactly as they are. Photorealistic, no text, no logos."

The dress reached the floor, close to the length of the flat-lay photo. The text-only version of the same dress stopped at mid-calf. In our one sample, the garment photo carried the length that the words left loose.

Three panels: a flat-lay red slip dress, the same dress on the model reaching the floor, and a text-only version ending mid-calf
Left: the garment photo we sent. Middle: two images in, the dress follows the photo's length. Right: the same dress described in words only.

What drifted

Drift showed up in the parts we left out of the prompt: the slip swap changed the shoes while the prompt named only the dress. Check the face, hands, hem, shoes and any pattern at full size before you show a result to a shopper. We did not test a garment with a printed logo, a product photo's exact fabric print, or more than two images.

When a dedicated try-on API fits better

A dedicated try-on API takes the person and the garment as separate inputs. Google's Vertex AI page "Generate Virtual Try-On Images" (last updated October 26, 2026; checked October 28, 2026) says: "You provide an image of a person and an image of a clothing product." The same page lists personImage and productImages as Base64 fields, a sampleCount from 1 to 4, and the model ID virtual-try-on-001. It also carries a notice that Vertex AI documentation is no longer being updated.

Choose that kind of endpoint when the garment photo is the source of truth and you need several samples per request. Choose the GPT-Image 2 edit when one pipeline for outfit changes and other edits matters more than samples per call.

OpenAI's pricing page (checked October 28, 2026) says gpt-image-2 is billed by tokens: the page lists token rates and no per-image table, and it points to a calculator in the image generation guide. OmniaKey's current rate is on pricing.

A prompt template for outfit swaps

Use the shape that worked in our runs: name the garment first, then lock the person and the set.

Change the outfit: she now wears [garment, colour, fabric, length]. Keep the same pose, face, hair, body, the plain light-gray studio background and the lighting exactly as they are. Photorealistic, no text, no logos.

  • Garment: one sentence with colour, fabric and length. "A red satin slip dress with thin straps that falls to mid-calf" gave a clear change.
  • Locks: pose, face, hair, body, background, lighting. List them explicitly in the prompt.
  • Finish: "Photorealistic, no text, no logos." Our prompts used that ending.
  • Shoes: name them if they must stay, for example "keep the white sneakers". Our slip swap changed them when footwear was absent.

Add a second image when length matters more than words: put the person first, the garment second, and refer to "the first image" and "the second image" in the prompt, as we did. For the general prompt order, see the GPT Image 2 prompt guide.

FAQ

Is there a dedicated virtual try-on endpoint in the GPT Image 2 API?

No. OmniaKey's model page (checked October 28, 2026) lists text to image and image edit. In our runs a try-on was an edit with a text prompt and an optional second image.

Can I send a garment photo?

Yes, as a second reference image in input.images. In our October 28, 2026 run, it changed the dress length to match the flat-lay photo.

Does the face stay the same?

In our three swaps and the two-reference run it did, by eye. Check every result at full size before you show it.

About an hour, according to OmniaKey's image API docs checked October 28, 2026, and the file is kept for 24 hours. Download it as soon as the task succeeds.

Which size should I request?

Pass size as WIDTHxHEIGHT, for example 1024x1536, then read the real dimensions from the downloaded PNG. Our runs used 1024x1536 at quality medium.

Start with one photo and one outfit prompt. The GPT-Image 2 page covers the model; current rates are separate.

Models in this article

virtual try-on APIGPT Image 2image editingoutfit changeAPI

Related articles

Recent posts