Skip to main content

Overview

GPT Image 2 is an OpenAI image model for text-to-image generation and reference-guided image editing. Use this page when you are ready to call the API after trying the model in the APIXO playground.

Endpoint and authentication

Base URL:
All requests require your APIXO API key:
Submit requests also require:

Copy-paste async quickstart

This minimal request submits a text-to-image task and returns a taskId.
Successful response:
Save the taskId; you need it to poll for the final result.

Poll for result

Processing response:
Success response:
Failed response:
Parse resultJson after state becomes success:

Request body

Text-to-image

Image-to-image

Parameters

string
default:"async"
required
Result delivery mode. Use async for polling with statusTask, or callback for webhook delivery.
string
Required when request_type is callback. Must be a public HTTPS URL that can receive the final task payload. See Webhooks.
object
required
GPT Image 2 input parameters.

Response format

Submit task response

POST /generateTask/gpt-image-2 returns a task ID when the task is accepted:
integer
API status code. 200 means the task was accepted.
string
Human-readable status message.
string
Unique task identifier used with the status endpoint.

Status response fields

string
Unique task identifier.
string
Current task state: pending, processing, success, or failed.
string
JSON string containing the generated image URLs. Present when state is success.
string
Machine-readable failure code. Present when state is failed.
string
Human-readable failure message. Present when state is failed.
integer
Task creation timestamp in Unix milliseconds.
integer
Task completion timestamp in Unix milliseconds. Present after completion.
integer
Processing duration in milliseconds. Present after successful completion.

Webhook callback mode

Use callback mode when your backend should receive the final result automatically instead of polling.
See Webhooks for delivery requirements and retry behavior.

Billing

GPT Image 2 is billed per generated image. The selected quality and billed resolution determine the unit price. For current route and market comparison pricing, see Pricing.

Latency and polling

Actual latency may vary by prompt complexity, provider route, and current queue load.
For high-concurrency production workloads, use callback mode to avoid frequent polling.

Size rules

  • size can be either a supported ratio value or a custom WIDTHxHEIGHT.
  • Supported ratio values are the same as aspect_ratio: auto, 1:1, 1:2, 2:1, 2:3, 3:2, 4:3, 3:4, 4:5, 5:4, 16:9, 9:16, 21:9.
  • When both size and aspect_ratio are provided, size takes precedence.
  • 1:2 and 2:1 are supported.
  • When resolution=4k, only 16:9, 9:16, 21:9, 1:2, 2:1, or custom WIDTHxHEIGHT with one edge equal to 3840 will keep 4k.
  • When resolution=4k is used with other supported ratios, or with custom WIDTHxHEIGHT whose two edges are both not 3840, the task will be processed as 2k.
  • Custom WIDTHxHEIGHT requires both dimensions to be divisible by 16.
  • Custom WIDTHxHEIGHT cannot exceed 3840 pixels on either edge.
  • Custom WIDTHxHEIGHT total pixels must stay between 655360 and 8294400.
  • Custom WIDTHxHEIGHT aspect ratio cannot exceed 3:1.
  • Custom WIDTHxHEIGHT requires resolution to be 2k or 4k.
Rate limits and concurrency can vary by account, API key, and route. If you receive 429, slow down requests and retry with backoff. For account-level details, see System APIs.

Errors and troubleshooting

HTTP errors

Task failure codes

See Error Codes for the full error reference.