Skip to content
English

GPT Image 2

ProviderOpenAI
Model namegpt-image-2
Endpoint/v1/chat/completions
ResultMarkdown image content in choices[0].message.content
PricingSee HiAPI Pricing

GPT Image 2 fits chat-compatible image workflows, especially when prompts include detailed layout, scene, and copy requirements.

ParameterTypeNotes
modelstringUse gpt-image-2
messagesarrayStandard Chat Completions messages
extra_body.google.image_config.aspect_ratiostringCommon values include auto, 1:1, 16:9, 9:16, 4:3, 3:4
extra_body.google.image_config.image_sizestringResolution: 1K (default), 2K, 4K. Higher resolution costs more — see Pricing
streambooleanSet to false

Limitation: When image_size is "4K", the aspect ratio cannot be "1:1" (square). For 4K output, either lower image_size to "2K", or pick a non-square aspect ratio (16:9, 9:16, 4:3, or 3:4).

Terminal window
curl -X POST https://api.hiapi.ai/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"stream": false,
"messages": [{"role": "user", "content": "Create a launch poster for an AI note-taking app with clean typography, dark UI mockup, and subtle neon accent"}],
"extra_body": {
"google": {
"image_config": {"aspect_ratio": "16:9", "image_size": "1K"}
}
}
}'