curl --request POST \
--url https://api.poyo.ai/api/generate/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2",
"callback_url": "https://your-domain.com/callback",
"input": {
"prompt": "A premium product photo of a silver espresso machine on a clean white studio background, realistic lighting, high detail",
"quality": "low",
"size": "1:1"
}
}
'{
"code": 200,
"data": {
"task_id": "task-unified-1757165031-uyujaw3d",
"status": "not_started",
"created_time": "2026-04-19T21:19:42"
}
}{
"code": 400,
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"code": 401,
"error": {
"message": "Unauthorized - Invalid API key",
"type": "authentication_error"
}
}OpenAI
GPT Image 2
The GPT Image 2 API generates one image from text or edits one or more reference images. Resolution runs from 1K to 4K, with custom sizes up to a 3840-pixel edge.
POST
/
api
/
generate
/
submit
curl --request POST \
--url https://api.poyo.ai/api/generate/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2",
"callback_url": "https://your-domain.com/callback",
"input": {
"prompt": "A premium product photo of a silver espresso machine on a clean white studio background, realistic lighting, high detail",
"quality": "low",
"size": "1:1"
}
}
'{
"code": 200,
"data": {
"task_id": "task-unified-1757165031-uyujaw3d",
"status": "not_started",
"created_time": "2026-04-19T21:19:42"
}
}{
"code": 400,
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"code": 401,
"error": {
"message": "Unauthorized - Invalid API key",
"type": "authentication_error"
}
}- After submission, a
task_idwill be returned. If you provided acallback_url, when the task status becomesfinishedorfailed, a POST request will be sent to thecallback_url. - Regardless of whether
callback_urlis provided, you can retrieve the result through the unified Query Task Status endpoint.
Models
- gpt-image-2 - Text-to-image generation, and optional reference-image-guided generation
- gpt-image-2-edit - Image editing based on one or more reference images and a text instruction
Resolution
Theresolution parameter controls the output image resolution.
| Resolution | Description |
|---|---|
1K (default) | Standard resolution |
2K | High resolution |
4K | Ultra-high resolution (true 4K sizes only) |
Resolution Rules
- Images with
sizeset toautoor without asizeparameter will always use 1K resolution, regardless of theresolutionparameter. - Custom size (
WIDTHxHEIGHT) requiresresolutionto be2Kor4K. 4Kapplies to16:9,9:16,21:9, or custom sizes with a 3840-pixel edge. All other 4K selections are automatically downgraded to 2K.
Custom Size Constraints
Custom sizes useWIDTHxHEIGHT format (e.g., 2304x1536) and must meet the following requirements:
- Both dimensions must be divisible by 16
- Maximum edge length: 3840 pixels
- Aspect ratio: up to 3:1
- Total pixels: between 655,360 and 8,294,400
Examples
Generate Image
{
"model": "gpt-image-2",
"callback_url": "https://your-domain.com/callback",
"input": {
"prompt": "A premium product photo of a silver espresso machine on a clean white studio background",
"quality": "low",
"size": "1:1",
"resolution": "1K"
}
}
Edit Image
{
"model": "gpt-image-2-edit",
"callback_url": "https://your-domain.com/callback",
"input": {
"prompt": "Replace the background with a clean white studio backdrop and add a soft natural shadow",
"image_urls": ["https://example.com/product.jpg"],
"quality": "high",
"size": "1:1"
}
}
Notes
gpt-image-2-editrequiresimage_urls.image_urlssupports uploading multiple reference images.promptsupports up to 20,000 characters.- Each request returns a single image.
qualitycontrols output image quality. Possible values:low,medium,high. Default:low.- Supported
sizevalues:auto,1:1,2:3,3:2,4:3,3:4,4:5,5:4,16:9,9:16,21:9, or customWIDTHxHEIGHT.
Authorizations
All API endpoints require Bearer Token authentication
Get your API Key:
Visit the API Key Management Page to get your API Key
Add it to the request header:
Authorization: Bearer YOUR_API_KEY
Body
application/json
