Appearance
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
| Operation | Endpoint | Mode |
|---|---|---|
| Image generation | POST /v1/images/generations | Sync |
| Image generation task | POST /v1/async/images/generations | Async |
| Image editing | POST /v1/images/edits | Sync |
| Image editing task | POST /v1/async/images/edits | Async |
Model ids
| Model id | Best for |
|---|---|
gpt-image-1.5 | Fast GPT image generation and editing with strong text rendering. |
gpt-image-2 | OpenAI quality tiers, custom sizes, larger outputs, and image editing. |
GPT Image fields
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Use gpt-image-1.5 or gpt-image-2. |
prompt | string | Yes | Image prompt, up to the selected model's prompt limit. |
image | file or file[] | Required for edit | Input image file for /v1/images/edits. |
n | number | No | Number of images. |
size | string | No | auto, preset sizes, or a valid custom WIDTHxHEIGHT size. |
quality | string | No | low, medium, high, or auto when supported. |
response_format | string | No | url 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
| Model | Credits per image |
|---|---|
gpt-image-1.5 | from 1 |
gpt-image-2 | from 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 tier | Long edge | low | medium | high / auto |
|---|---|---|---|---|
| 1K | <= 1536px | 1 | 4 | 14 |
| 2K | <= 2048px | 2 | 17 | 67 |
| 4K | <= 3840px | 4 | 34 | 133 |
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"
}
]
}