Image API
Task-style image generation (gpt-image-2 / nano-banana series)
Overview
The Image API submits image-generation requests task-style: all models share the same submit endpoint POST /api/generate/submit, differing only in the model field and the model-specific input.metadata passthrough. Submit returns a task_id immediately — poll GET /api/generate/status/{task_id} until status=finished.
Authentication
Same Bearer token as the AI API: Authorization: Bearer sk-xxxxxx.
Shared Request Skeleton
{
"model": "gpt-image-2 | nano-banana-2 | nano-banana-pro",
"input": {
"prompt": "image description",
"size": "1:1 | 16:9 | 9:16 | auto | 1024x1024",
"image": "reference image URL (optional)",
"images": ["reference image URLs (optional)"],
"metadata": { /* model-specific params */ }
}
}Only prompt / size / image / images / duration / seconds are allowed at the top of input; any other field (quality, resolution, n, mask_url, etc.) must go under input.metadata or the request returns 400.
Models
gpt-image-2
OpenAI gpt-image-2. Supports quality (low/medium/high) and mask-based edits. Up to 16 reference images.
nano-banana-2
Alias for Gemini 3.1 Flash Image Preview. Supports Google retrieval augmentation. Up to 14 reference images.
nano-banana-pro
Alias for Gemini 3 Pro Image Preview. Supports 4K and mask-based edits. Up to 14 reference images.
How is this guide?
Last updated on