Image Generation
HiAPI supports maintained image generation models through Images API and Chat Completions API formats.
Available Models
Section titled “Available Models”| Model | Provider | Best For | Endpoint |
|---|---|---|---|
| Nano Banana | Fast conversational image generation | /v1/chat/completions | |
| Nano Banana 2 | Balanced quality and throughput | /v1/chat/completions | |
| Nano Banana Pro | Premium brand visuals and higher resolution | /v1/chat/completions | |
| GPT Image 1.5 | OpenAI | Text rendering and layout-heavy assets | /v1/images/generations |
| GPT Image 2 | OpenAI | Chat-compatible prompt-heavy image workflows | /v1/chat/completions |
| GPT Image 2 Beta | OpenAI | Preview testing and comparisons | /v1/images/generations |
| FLUX 1.1 Pro | Black Forest Labs | Photorealistic commercial visuals | /v1/images/generations |
| Qwen Image 2.0 | Alibaba | Chinese text rendering and cost-aware images | /v1/images/generations |
For live prices and quality multipliers, use HiAPI Pricing.
API Formats
Section titled “API Formats”OpenAI Images API (/v1/images/generations)
Section titled “OpenAI Images API (/v1/images/generations)”Used by: GPT Image 1.5, GPT Image 2 Beta, FLUX 1.1 Pro, Qwen Image 2.0
from openai import OpenAI
client = OpenAI( api_key="YOUR_API_KEY", base_url="https://api.hiapi.ai/v1")
response = client.images.generate( model="qwen-image-2.0", prompt="a futuristic city at sunset", size="1024x1024")
print(response.data[0].url)curl -X POST https://api.hiapi.ai/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "qwen-image-2.0", "prompt": "a futuristic city at sunset", "size": "1024x1024" }'Chat Completions API (/v1/chat/completions)
Section titled “Chat Completions API (/v1/chat/completions)”Used by: Nano Banana, Nano Banana 2, Nano Banana Pro, and GPT Image 2.
import requests
response = requests.post( "https://api.hiapi.ai/v1/chat/completions", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" }, json={ "model": "Nano-Banana", "stream": False, "messages": [{"role": "user", "content": "a cute cat wearing sunglasses"}], "extra_body": { "google": { "image_config": {"aspect_ratio": "1:1", "image_size": "1K"} } } })
# Response contains print(response.json()["choices"][0]["message"]["content"])Supported Sizes
Section titled “Supported Sizes”Most models support these sizes:
1024x1024(square, default)1792x1024(landscape)1024x1792(portrait)
Nano Banana also supports 1024x768 and 768x1024.
- Use English prompts for best results across all models
- Be specific — “a golden retriever playing fetch on a beach at sunset” works better than “a dog”
- Specify style — add keywords like “watercolor”, “photorealistic”, “cyberpunk” at the end
- Try multiple models — each model has different strengths