GPT Image 2

Generate and edit images with a Discount Group API key, billed per delivered image.

Discount Group · model: gpt-image-2 · Per-delivered-image billing

This page covers API keys created in the Discount Group. The key selects the group, so keep the public model ID gpt-image-2 in every request and do not add a group field.

At a glance

ItemDiscount Group behavior
API keyMust belong to the Discount Group
Public model IDgpt-image-2
SubmissionAsynchronous, returns 202 Accepted
Billed onImages successfully delivered × the resolution tier
PricingDiscount Group 1K, 2K, and 4K rates on the model list

Generate an image

APIPOOL_ENDPOINT="https://app.apipool.dev"

curl "$APIPOOL_ENDPOINT/v1/images/generations" \
  -H "Authorization: Bearer $APIPOOL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "An editorial photograph of a green leaf",
    "size": "1:1",
    "resolution": "2k",
    "n": 1
  }'

Edit an uploaded image

Use multipart/form-data for file uploads:

curl "$APIPOOL_ENDPOINT/v1/images/edits" \
  -H "Authorization: Bearer $APIPOOL_API_KEY" \
  -F "model=gpt-image-2" \
  -F "prompt=Change the blue circle to green" \
  -F "image=@./source.png" \
  -F "size=1:1" \
  -F "resolution=4k" \
  -F "n=1"

Request parameters

FieldRequiredValues and meaning
modelYesAlways gpt-image-2
promptYesImage generation or editing instruction
imageFor file editingOne uploaded source image on /v1/images/edits
sizeNoOutput aspect ratio, for example 1:1
resolutionRecommendedBilling and output tier: 1k, 2k, or 4k; omitted, auto, and 1k use the default tier
nNoCurrently supported value: 1; default 1

Set resolution explicitly so the output and billing tier stay unambiguous. The Discount Group currently documents one output per request, so send n: 1 or omit it. The image endpoints reject stream: true.

Submission and polling

The submission returns a task rather than the finished images:

{
  "id": "imgtask_01...",
  "object": "image_generation.task",
  "status": "submitted",
  "model": "gpt-image-2",
  "created_at": 1787068800
}

Poll the task using the same API key:

TASK_ID="imgtask_01..."

curl "$APIPOOL_ENDPOINT/v1/tasks/$TASK_ID" \
  -H "Authorization: Bearer $APIPOOL_API_KEY"

See Asynchronous image tasks for all status values, polling rules, temporary result URLs, and retryable responses.

Completed task

{
  "id": "imgtask_01...",
  "object": "image_generation.task",
  "status": "completed",
  "model": "gpt-image-2",
  "created_at": 1787068800,
  "completed_at": 1787068842,
  "data": [
    {
      "url": "https://objects.example/results/0.png?...",
      "expires_at": 1787072442
    }
  ],
  "result_expires_at": 1787155242
}

Discount Group responses return no token usage; the data array is the record of what was delivered.

Billing

You are charged for the successfully delivered data items, at the resolution tier locked in at submission time. Current 1K, 2K, and 4K rates are shown under the Discount Group on the model list; this page does not repeat prices that can change.

For token-based billing and standardized usage, use a key from the Official Group.