GPT-4o Image Generation API
Use Cases
Two Image Generation Models That We Provide
Model Name | gpt-4o-image | gpt-image-1 |
---|---|---|
API Type | This is a reverse engineered version of ChatGPT image generation feature. It uses LLM API | This is a relayed version of openai gpt-image-1 , it uses Images API and just alter the domain name and auth key |
Stream Mode | Can only be used in stream mode | Can only be used in stream mode |
Pricing | • $0.02 per successful generation • $0 for 4xx or 5xx errors • $0.00066 if response contains no image | Low Quality: • 1024×1024: $0.011 • 1024×1536: $0.016 • 1536×1024: $0.016 Medium Quality: • 1024×1024: $0.042 • 1024×1536: $0.063 • 1536×1024: $0.063 High Quality: • 1024×1024: $0.167 • 1024×1536: $0.25 • 1536×1024: $0.25 |
Implementation | Stream handling required (Example) and read below for code examples | Stream handling required (Example) with altered domain name and Authorization header |
Notes | No image response may indicate content policy violation or downgrade to DALLE-3 | Refer to OpenAI official pricing for complete details |
Important Notes
gpt-4o-image
: Image generation failures that return 4xx or 5xx errors are not chargedgpt-image-1
: Implementation follows the same pattern as the standard OpenAI Images API with modified domain and auth headersRequest Examples For gpt-4o-image
Model
gpt-4o-image
model, if you are looking for examples around gpt-image-1
model, go to openai offical guid Images APISimple Text to Image
curl --location 'https://api.piapi.ai/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {your-api-key}' \
--data '{
"model": "gpt-4o-image",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "draw a cyberpunk city"
}
]
}
],
"stream": true
}'
Simple Image to Image
curl --location 'https://api.piapi.ai/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {your-api-key}' \
--data '{
"model": "gpt-4o-image",
"messages": [
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {
"url": "https://images.ctfassets.net/kftzwdyauwt9/21orfxKx8HXXGKH8cTOq60/1eb34535ddce9c9e91fab0fad77bc158/minnias_cat_input.png?w=640&q=90&fm=webp"
}
},
{
"type": "text",
"text": "Give this cat a detective hat and a monocle"
}
]
}
],
"stream": true
}'
Multiple Images Input
curl --location 'https://api.piapi.ai/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {your-api-key}' \
--data '{
"model": "gpt-4o-image",
"messages": [
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {
"url": "https://img.moegirl.org.cn/common/thumb/5/53/Rei_Ayanami.jpg/280px-Rei_Ayanami.jpg"
}
},
{
"type": "image_url",
"image_url": {
"url": "https://moegirl.uk/images/e/ef/OP_C057_asuka.jpg"
}
},
{
"type": "text",
"text": "merge two image"
}
]
}
],
"stream": true
}'
Multiple Rounds Conversation
gpt-4o-image-preview
, gpt-4o-image
does not have multi rounds feature. It's a WIP feature for gpt-4o-image
.Modified at 2025-04-28 11:35:34