Skip to content
English

Image Generation

HiAPI supports maintained image generation models through Images API and Chat Completions API formats.

ModelProviderBest ForEndpoint
Nano BananaGoogleFast conversational image generation/v1/chat/completions
Nano Banana 2GoogleBalanced quality and throughput/v1/chat/completions
Nano Banana ProGooglePremium brand visuals and higher resolution/v1/chat/completions
GPT Image 1.5OpenAIText rendering and layout-heavy assets/v1/images/generations
GPT Image 2OpenAIChat-compatible prompt-heavy image workflows/v1/chat/completions
GPT Image 2 BetaOpenAIPreview testing and comparisons/v1/images/generations
FLUX 1.1 ProBlack Forest LabsPhotorealistic commercial visuals/v1/images/generations
Qwen Image 2.0AlibabaChinese text rendering and cost-aware images/v1/images/generations

For live prices and quality multipliers, use HiAPI Pricing.

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)

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 ![image](data:image/jpeg;base64,...)
print(response.json()["choices"][0]["message"]["content"])

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