About GPT Image 2
GPT Image 2 edit takes a prompt, up to ten image_urls and an optional mask_url, typically in about 88 seconds.
Call it with the model name openai/gpt-image-2/edit on POST /jobs/createTask, from $0.01165.
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 have | Mode |
|---|---|
| a written brief | GPT Image 2 Text to image |
| an image to change | GPT 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
| Parameter | Required | Description |
|---|---|---|
aspect_ratio | No | The 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 |
background | No | Keep, remove or replace the background. auto · opaque · Default: auto |
image_urls | Yes | Photos to edit or combine. Say in the prompt what each one adds. |
input_fidelity | No | How closely to keep the look of your source pictures. low · high · Default: low |
mask_url | No | Paint over the area that should change. |
num_outputs | No | How many results to make in one go. ≥ 1 · ≤ 10 · Default: 1 |
output_format | No | File type of the result. png · jpeg · webp · Default: png |
output_quality | No | Compression for JPEG and WebP. Higher keeps more detail and makes bigger files. ≥ 0 · ≤ 100 |
prompt | Yes | Describe what you want to make. |
quality | No | Choose one of this model’s quality settings. low · medium · high · Default: medium |
resolution | No | Choose an available output size. 1k · 2k · 4k · Default: 1k |
Pricing
Prices are in USD and charged to your PopNow balance. When a task is accepted, we reserve the maximum quoted amount from your PopNow balance. On completion, we charge for actual usage, never more than the hold, and release the remainder. If the task fails, the hold is released.
| Option | USD per image |
|---|---|
| aspect_ratio 1:3 · quality low · resolution 1K | $0.00182 |
| aspect_ratio 3:1 · quality low · resolution 1K | $0.00182 |
| aspect_ratio 21:9 · quality low · resolution 1K | $0.00244 |
| aspect_ratio 9:21 · quality low · resolution 1K | $0.00244 |
| aspect_ratio 1:2 · quality low · resolution 1K | $0.00276 |
| aspect_ratio 2:1 · quality low · resolution 1K | $0.00276 |
| aspect_ratio 1:3 · quality low · resolution 2K | $0.00288 |
| aspect_ratio 3:1 · quality low · resolution 2K | $0.00288 |
| aspect_ratio 16:9 · quality low · resolution 1K | $0.00304 |
| aspect_ratio 9:16 · quality low · resolution 1K | $0.00304 |
| aspect_ratio 2:3 · quality low · resolution 1K | $0.00357 |
| aspect_ratio 3:2 · quality low · resolution 1K | $0.00357 |
Send the same request body to POST /jobs/quote to see the estimated and maximum USD charge before running. A quote does not run the task or charge your balance.
Use cases
Retype and restyle finished artwork
Swap the words on a poster or cover, change a product colour or a garment, and use a mask to keep the edit focused on the intended area.
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
- Create an API key. Sign in to PopNow and create a key in the API console. Keys start with sk-popnow-. API calls are billed in USD from your PopNow balance.
- 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.
- 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.
About the GPT Image 2 Edit Image endpoint
It retypes text while keeping the typeface when the prompt asks for the same font, which suits cover and packaging localisation.
Two portraits can be combined into a new poster with a new title, each keeping their face via input_fidelity.
Up to ten outputs can be requested, each billed.
background is opaque only on this model.
GPT Image 2 API questions
How much does the GPT Image 2 API cost?
GPT Image 2 starts at $0.01165 per image with Edit Image, its lowest-priced task. Prices by option: 1:3 · low · 1K $0.00182 per image, 3:1 · low · 1K $0.00182 per image, 21:9 · low · 1K $0.00244 per image, 9:21 · low · 1K $0.00244 per image. API usage is charged in USD to your PopNow balance. When a task is accepted, we reserve the maximum quoted amount from your PopNow balance. On completion, we charge for actual usage, never more than the hold, and release the remainder. If the task fails, the hold is released.
What are the limits of the GPT Image 2 · Edit Image 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.
More about GPT Image 2
- Endpoints
- GPT Image 2 · Create Image