Skip to content

GPT Image

GPT Image models are useful when prompt adherence, text rendering, clean composition, or large output sizes matter. Pixapi exposes them through OpenAI-compatible image endpoints.

API surface

OperationEndpointMode
Image generationPOST /v1/images/generationsSync
Image generation taskPOST /v1/async/images/generationsAsync
Image editingPOST /v1/images/editsSync
Image editing taskPOST /v1/async/images/editsAsync

Model ids

Model idBest for
gpt-image-1.5Fast GPT image generation and editing with strong text rendering.
gpt-image-2OpenAI quality tiers, custom sizes, larger outputs, and image editing.

GPT Image fields

FieldTypeRequiredDescription
modelstringYesUse gpt-image-1.5 or gpt-image-2.
promptstringYesImage prompt, up to the selected model's prompt limit.
imagefile or file[]Required for editInput image file for /v1/images/edits.
nnumberNoNumber of images.
sizestringNoauto, preset sizes, or a valid custom WIDTHxHEIGHT size.
qualitystringNolow, medium, high, or auto when supported.
response_formatstringNourl or b64_json when supported.

Custom sizes must be multiples of 16, stay between 655,360 and 8,294,400 pixels, and keep aspect ratio at 3:1 or lower.

Pricing

ModelCredits per image
gpt-image-1.5from 1
gpt-image-2from 1

For gpt-image-2, credits per image follow the documented size and quality matrix. quality=auto is billed as high, and size=auto defaults to the 1K tier.

Size tierLong edgelowmediumhigh / auto
1K<= 1536px1414
2K<= 2048px21767
4K<= 3840px434133

The displayed costCredits for a request equals the matrix value times n.

Generate example

ts
const response = await fetch('https://api.pixapi.ai/v1/images/generations', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.PIXAPI_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    model: 'gpt-image-2',
    prompt: 'A clean SaaS hero image showing API model orchestration',
    n: 1,
    size: '1536x1024',
    quality: 'high',
  }),
});

const image = await response.json();

Edit example

bash
curl https://api.pixapi.ai/v1/images/edits \
  -H "Authorization: Bearer $PIXAPI_KEY" \
  -F "model=gpt-image-2" \
  -F "prompt=Replace the background with a bright studio setup" \
  -F "image=@input.png" \
  -F "size=auto" \
  -F "quality=auto"

Response

json
{
  "created": 1766880000,
  "data": [
    {
      "url": "https://cdn.pixapi.ai/generated/gpt-image.png"
    }
  ]
}