HaryAI API: images (Seedream 5.5, Nano Banana 2.1, Nano Banana 2)
Image generation is synchronous: one request returns the image. Use the same API key as for chat and video. Get the key from https://haryai.com/en/dashboard
Models
| Model name | Model | Sizes | Formats |
|---|---|---|---|
dola-seedream-5-5-261028 |
Seedream 5.5 (ByteDance) | 1K, 1.5K, 2K (default), or WIDTHxHEIGHT |
OpenAI Images |
gemini-nano-banana-2.1 |
Nano Banana 2.1 (Google, the successor to 2) | 1K, 2K, 4K |
OpenAI Images, Gemini generateContent, OpenAI Chat Completions |
gemini-3.1-flash-image |
Nano Banana 2 (Google) | 1K, 2K, 4K |
OpenAI Images, Gemini generateContent, OpenAI Chat Completions |
Images are paid from the balance only; a Coding Plan does not cover them. A request that fails is not charged.
Seedream 5.5: OpenAI Images format
curl https://api.haryai.com/v1/images/generations \
-H "Authorization: Bearer $HARYAI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "dola-seedream-5-5-261028",
"prompt": "A cup of green tea on a wooden table by a window, morning light",
"size": "1.5K",
"response_format": "b64_json"
}'
Reply: {"data": [{"b64_json": "…", "size": "1872x1248"}], "usage": {"generated_images": 1, …}}
size:1Kor1.5K(same price; 1.5K is sharper),2K(the default, higher price), or explicit pixels such as2048x1152. Pixels up to 2,610,000 are billed at the lower price. Describe the aspect ratio in the prompt when you use a tier name.image: reference images, a URL or an array of URLs (ordata:image/png;base64,…). Refer to them in the prompt as "Image 1", "Image 2". Each reference image is billed.- Edits as with OpenAI also work:
POST /v1/images/edits, multipart withimage(one or more files) and the fields above. The files become reference images. Masks are not supported; describe the change in the prompt. watermark: off unless you sendtrue, which adds a small "AI-generated" label in a corner.response_format:url(the default; the link expires after about 24 hours) orb64_json.n: images per request; each is billed. Image sets (sequential_image_generation) are not supported by this model.
Nano Banana 2.1 and 2: OpenAI Images format
curl https://api.haryai.com/v1/images/generations \
-H "Authorization: Bearer $HARYAI_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "gemini-nano-banana-2.1", "prompt": "A cup of green tea on a wooden table by a window, morning light", "size": "1536x1024"}'
Reply: {"data": [{"b64_json": "…"}]}. The image always comes back as
b64_json, never as a URL.
size:WIDTHxHEIGHTpicks the nearest aspect ratio and tier (1024x1024is 1K square,1536x1024is 2K 3:2). Or sendaspect_ratio(1:1,3:2,16:9,9:16, …) andimage_size(1K,2K,4K) directly. Without any of them: 1K, square for a new image, the shape of the input image for an edit.n: 1 only.- Edits:
POST /v1/images/edits, multipart withimage(one or more files) andprompt, as with OpenAI. Masks are not supported; describe the change in the prompt.
curl https://api.haryai.com/v1/images/edits \
-H "Authorization: Bearer $HARYAI_KEY" \
-F model=gemini-nano-banana-2.1 \
-F "prompt=Make the cup bright red, keep everything else the same." \
-F "image=@photo.png"
Nano Banana 2.1 and 2: Gemini format
Base URL: https://api.haryai.com/v1beta. The key goes in x-goog-api-key
(or Authorization: Bearer).
curl https://api.haryai.com/v1beta/models/gemini-nano-banana-2.1:generateContent \
-H "x-goog-api-key: $HARYAI_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{"role": "user", "parts": [{"text": "A cup of green tea on a wooden table by a window, morning light"}]}],
"generationConfig": {"responseModalities": ["IMAGE"], "imageConfig": {"aspectRatio": "16:9", "imageSize": "2K"}}
}'
The image is the part of candidates[0].content.parts with inlineData
(mimeType, base64 data). To edit an image, add it as another part:
{"inlineData": {"mimeType": "image/png", "data": "<base64>"}}.
Nano Banana 2.1 and 2: OpenAI Chat Completions format
curl https://api.haryai.com/v1/chat/completions \
-H "Authorization: Bearer $HARYAI_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "gemini-nano-banana-2.1", "messages": [{"role": "user", "content": "Generate an image: a cup of green tea on a wooden table"}]}'
The image comes back in choices[0].message.content as a markdown image
with a data URI: .
Billing
- Seedream 5.5: a price per output image (lower up to 2.61 MP, higher above) plus a price per reference image.
- Nano Banana 2.1 and 2: per token. An output image is a fixed number of tokens per size (2.1: 1K 1,120, 2K 1,680, 4K 3,780; 2: 1K 1,120, 2K 1,680, 4K 2,520); input text and images are billed as input tokens. Nano Banana 2.1 thinks before it draws; those tokens are billed as text output (about a tenth on top of a 2K image).
- Prices: https://haryai.com/en/pricing
Errors
Key, model and balance errors use the chat shape
{"error":{"message":"…","type":"new_api_error","code":"…"}}:
| Status | Code | Meaning |
|---|---|---|
| 401 | (empty) | Missing or invalid key |
| 400 / 503 | model_not_found |
Model not available to your account / not available now |
| 403 | insufficient_user_quota |
Balance too low |
Upstream refusals (a bad field, a prompt or image the model's content moderation blocks) come back with the upstream message and are not charged.







