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-2OpenAI quality tiers, custom sizes, larger outputs, and image editing.
gpt-image-1.5Fast GPT image generation and editing with strong text rendering.

GPT Image fields

FieldTypeRequiredDescription
modelstringYesUse gpt-image-2 or gpt-image-1.5.
promptstringYesImage prompt, up to the selected model's prompt limit.
imagestring or string[]Required for editInput image URL, or an array of image URLs when multiple references are supported.
nnumberNoNumber of images. Only 1 is currently supported.
sizestringNoauto, popular preset sizes such as 1024x1024, 1536x1024, or 1024x1536, or a custom WIDTHxHEIGHT value.
qualitystringNolow, medium, high, or auto when supported.

Custom sizes must use the WIDTHxHEIGHT format, stay within the provider limits, and fit the selected output tier.

Pricing

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

gpt-image-1.5 is billed for 1K sizes only (1024x1024, 1536x1024, 1024x1536, or auto): low/medium/high is 1/4/14. It does not support 2K or 4K outputs.

For gpt-image-2, credits follow the size and quality matrix below. 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" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "Replace the background with a bright studio setup",
    "image": "https://cdn.example.com/input.png",
    "size": "auto",
    "quality": "auto"
  }'

Response

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