openai/gpt-image-2/editFrom 1 credit per image· Edit Image

OpenAI's GPT Image 2 image editing takes 1 to 10 source images and a text description of the change, such as a garment, a background or a line of type. An optional PNG mask limits the repaint to one area; output is 1K to 4K.

Call it with the model name openai/gpt-image-2/edit on POST /jobs/createTask, from 1 credit per image ($0.01). New accounts get 30 free credits to try it in the Playground first.

  • Create Image
  • Edit Image
  • Up to 4K
  • Up to 10 reference images
  • 15 aspect ratios
  • Up to 10 per run

Introduction

GPT Image 2 Edit runs OpenAI's gpt-image-2 model on images you already have. Give it one to ten source images and an instruction: change a garment or a colour, retype a headline, relight a scene, or combine people and places from several sources into one frame. An optional PNG mask confines the repaint to a single area.

Choose a mode by starting material

What you haveMode
a written briefGPT Image 2 Text to image
an image to changeGPT Image 2 Edit

Key features

Instruction editing, masked when needed

Without a mask the model works out from the prompt what to change and redraws the rest to match. With a mask, only the transparent pixels are repainted and everything else is kept.

Up to ten sources in one request

Refer to each source by its order: the first image supplies the person, the second the setting, the third the product. The model combines them into a single new frame.

Fidelity and shape control

Input fidelity high holds faces, fabric and printed details closer to the sources. Aspect ratio auto keeps the shape of the first source; any of fifteen fixed ratios gives the result that shape instead.

Request parameters

ParameterRequiredDescription
aspect_ratioNoThe shape of the frame: wide, square or tall. auto · 1:1 · 1:2 · 1:3 · 2:1 · 2:3 · 3:1 · 3:2 · 3:4 · 4:3 · 4:5 · 5:4 · 9:16 · 9:21 · 16:9 · 21:9 · Default: auto
backgroundNoKeep, remove or replace the background. auto · opaque · Default: auto
image_urlsYesPhotos to edit or combine. Say in the prompt what each one adds.
input_fidelityNoHow closely to keep the look of the source images. low · high · Default: low
mask_urlNoPaint over the area that should change.
num_outputsNoHow many results to make in one go. ≥ 1 · ≤ 10 · Default: 1
output_formatNoFile type of the result. png · jpeg · webp · Default: png
output_qualityNoCompression quality for JPEG and WebP, from 0 to 100. ≥ 0 · ≤ 100
promptYesSay what to change and what must stay the same.
qualityNoTrades speed and price for finer detail. low · medium · high · Default: medium
resolutionNoOutput size. Bigger sizes look sharper and cost more. 1k · 2k · 4k · Default: 1k

Pricing

Prices are in credits, the same credits you use on the website (1 credit = $0.01). The hold is taken when the task is accepted and settled to the actual charge when it finishes; failed tasks are refunded.

OptionCredits per image≈ USD
aspect_ratio 1:3 · quality low · resolution 1K0.27$0.0027
aspect_ratio 3:1 · quality low · resolution 1K0.27$0.0027
aspect_ratio 21:9 · quality low · resolution 1K0.37$0.0037
aspect_ratio 9:21 · quality low · resolution 1K0.37$0.0037
aspect_ratio 1:2 · quality low · resolution 1K0.41$0.0041
aspect_ratio 2:1 · quality low · resolution 1K0.41$0.0041
aspect_ratio 1:3 · quality low · resolution 2K0.43$0.0043
aspect_ratio 3:1 · quality low · resolution 2K0.43$0.0043
aspect_ratio 16:9 · quality low · resolution 1K0.46$0.0046
aspect_ratio 9:16 · quality low · resolution 1K0.46$0.0046
aspect_ratio 2:3 · quality low · resolution 1K0.54$0.0054
aspect_ratio 3:2 · quality low · resolution 1K0.54$0.0054

Each task is rounded up to whole credits, so one run at the lowest tier costs 1 credit per image ($0.01).

For an exact number before you run, send the same body to POST /jobs/quote.

Use cases

Retype and restyle finished artwork

Swap the words on a poster or cover, change a product colour or a garment, and keep the photograph underneath exactly as it was approved.

Composite scenes from references

Put a person from one photograph into the setting of another, or pair two people from separate shots, without rebuilding the layout from a text prompt.

Localised versions of one visual

Keep the photograph and replace the headline with a translated line for each market, one edit per language.

Prompt guide & pro tips

Say what stays as well as what changes

List the change first, then name what must not move: face, pose, lighting, background, logo. Anything you do not protect may be redrawn.

Number your sources

Write "the woman from the first image" and "the boat from the second image". The order of image_urls is the only way the model can tell them apart.

Use a mask for small fixes

For a single object or a patch of background, a PNG mask the same size as the first source is more reliable than describing the area in words.

Keep auto for faithful framing

Leave aspect ratio on auto when the edit should keep the framing of the source; pick a fixed ratio only when the result needs a new shape.

API quick start

Call the GPT Image 2 API in three steps

  1. Create an API key. Sign in to PopNow and create a key in the API console. Keys start with sk-popnow- and use the same credits as the website.
  2. Send the request. POST /jobs/createTask with model openai/gpt-image-2/edit and an input object that follows the parameter table. The response returns a task ID straight away.
  3. Get the result. Poll GET /jobs/recordInfo with the task ID, or pass a callBackUrl and we post the result to it. Download the output links when the task succeeds.
# 1. Create the task. Keep the Idempotency-Key if you retry after a network error.
export IDEMPOTENCY_KEY="$(uuidgen)"
curl -X POST https://api.popnow.ai/api/v1/jobs/createTask \
  -H "Authorization: Bearer $POPNOW_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -d '{
  "model": "openai/gpt-image-2/edit",
  "input": {
    "prompt": "A ceramic teapot on a linen cloth, soft window light, muted palette",
    "image_urls": [
      "https://media.popnow.ai/influencer/examples/marco.webp"
    ],
    "aspect_ratio": "auto",
    "resolution": "1k",
    "quality": "medium",
    "num_outputs": 1,
    "input_fidelity": "low"
  }
}'

# 2. Copy data.taskId from the response, then poll until state is succeeded, failed, canceled or expired.
TASK_ID="TASK_ID_FROM_RESPONSE"
curl "https://api.popnow.ai/api/v1/jobs/recordInfo?taskId=$TASK_ID" \
  -H "Authorization: Bearer $POPNOW_API_KEY"

Replace the prompt and any links with your own. The API tab has the response, polling and callback reference.

GPT Image 2 API questions

How much does the GPT Image 2 API cost?

GPT Image 2 starts at 1 credit ($0.01) per image with Edit Image, its cheapest task. Prices by option: 1:3 · low · 1K 0.27 credits per image, 3:1 · low · 1K 0.27 credits per image, 21:9 · low · 1K 0.37 credits per image, 9:21 · low · 1K 0.37 credits per image. Credits are the same as on the website (1 credit = $0.01), new accounts get 30 free credits, and failed tasks are refunded.

What is the model name for GPT Image 2 in the API?

Put openai/gpt-image-2/text-to-image for Create Image; openai/gpt-image-2/edit for Edit Image in the model field of POST /jobs/createTask.

Does it support transparent backgrounds?

Not GPT Image 2: OpenAI does not offer transparent output on this model. GPT Image 2.5 Sunburst and Flare do, through the background option.

Which OpenAI image model should I choose?

GPT Image 2 for dependable text and editing at three quality tiers; GPT Image 2.5 Sunburst when fine detail and edit precision matter most; GPT Image 2.5 Flare when speed matters.

What are the limits of the GPT Image 2 API?

Resolutions: 1K · 2K · 4K; Aspect ratios: auto · 1:1 · 1:2 · 1:3 · 2:1 · 2:3 +10; Outputs per call: 1–10; Reference images: 10; Prompt length (characters): 5,000. Requests outside these limits are rejected before anything is charged.

Can I try GPT Image 2 without writing code?

Yes. The Playground runs GPT Image 2 on your PopNow credits, needs no API key, and shows the matching code for every run.

All GPT Image models

GPT Image 2.5 Flare and Sunburst add transparent backgrounds, higher quality tiers and 16-photo edits.

More about GPT Image 2