GPT Image 2
gpt-image-2 and gpt-image-2 4K use the OpenAI Images-compatible PopGo endpoints for text-to-image generation and image editing. Clients use the public PopGo model ID and do not handle channel mappings.
Endpoints
POST https://api.popgo.site/v1/images/generations
POST https://api.popgo.site/v1/images/edits
Authorization: Bearer YOUR_API_KEY
Use JSON for /generations and multipart/form-data for /edits. Editing requires at least one image reference file.
Models
| Model | Use | Specification |
|---|---|---|
gpt-image-2 | Text-to-image and editing | Use the sizes and quality options shown on the live model page |
gpt-image-2 4K | Text-to-image and editing | Intended for the 4K output tier; use the live size configuration |
Generation fields
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | gpt-image-2 or gpt-image-2 4K |
prompt | string | Yes | Scene, subject, composition, action, and style |
size | string | No | WIDTHxHEIGHT or a supported auto; use ASCII x, not × |
quality | string | No | Send only when allowed by the live model page |
n | integer | No | Number of results, default 1; larger values increase usage |
response_format | string | No | url or b64_json, if enabled for the model |
curl https://api.popgo.site/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_MODEL",
"prompt": "A rainy city cafe at night, cinematic photography",
"size": "1024x1024",
"n": 1,
"response_format": "url"
}'
Editing fields and example
Use image for one file. Repeat image[] for multiple references; order is preserved.
curl https://api.popgo.site/v1/images/edits \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=YOUR_MODEL" \
-F "image[]=@input.png" \
-F "image[]=@style.png" \
-F "prompt=Keep the subject from the first image and apply the palette of the second"
mask is optional and must only be sent when the live model page lists mask editing. Do not put a local file path in JSON; upload the file through multipart.
Response and Base64
{
"created": 1781837823,
"data": [{ "url": "https://api.popgo.site/generated/FILE.png" }]
}
With response_format=b64_json, an item normally becomes {"b64_json":"iVBORw0KGgo..."}. This is Base64 image data without a data:image/png;base64, prefix. Add the correct MIME type when displaying it in a browser, or decode it to a file.
Limits and errors
Keep size, quality, and n within the selected model's live configuration. HTTP 400 usually means an invalid model, field, size, quality, count, or multipart field. URLs may expire, so download successful results promptly. Billing follows the models and pricing page; n can affect the consumed amount.