Image Generation
HiAPI supports multiple image generation models through two API formats.
Available Models
Section titled “Available Models”| Model | Provider | Best For | Credits/Image |
|---|---|---|---|
| Nano Banana | Fast, versatile, 1K-4K | 6 | |
| Midjourney | Midjourney | Artistic, creative | 10 |
| DALL-E 3 | OpenAI | Prompt understanding | 8 |
| GPT Image 1.5 | OpenAI | Text rendering, editing | 10 |
| FLUX 1.1 Pro | Black Forest Labs | Photorealism | 10 |
API Formats
Section titled “API Formats”OpenAI Images API (/v1/images/generations)
Section titled “OpenAI Images API (/v1/images/generations)”Used by: Midjourney, DALL-E 3, GPT Image 1.5, FLUX 1.1 Pro
from openai import OpenAI
client = OpenAI( api_key="YOUR_API_KEY", base_url="https://api.hiapi.ai/v1")
response = client.images.generate( model="dall-e-3", 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": "dall-e-3", "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 (returns image as base64 in message content)
import requests
response = requests.post( "https://api.hiapi.ai/v1/chat/completions", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" }, json={ "model": "gemini-3-pro-image-preview", "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