跳转到内容

Image Generation

此内容尚不支持你的语言。

HiAPI supports multiple image generation models through two API formats.

ModelProviderBest ForCredits/Image
Nano BananaGoogleFast, versatile, 1K-4K6
MidjourneyMidjourneyArtistic, creative10
DALL-E 3OpenAIPrompt understanding8
GPT Image 1.5OpenAIText rendering, editing10
FLUX 1.1 ProBlack Forest LabsPhotorealism10

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)

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 ![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