Nano Banana 2
/v1/tasks All models are called through the Unified Async API POST /v1/tasks endpoint; only the input fields differ (see input parameters below).
Model summary
| Model name | Nano-Banana-2 |
|---|---|
| Type | Image generation / editing |
| Endpoint | POST /v1/tasks |
| Pricing | See HiAPI Pricing |
Nano Banana 2 is the balanced Nano Banana tier, with optional references, wider ratios, and 1K / 2K / 4K output.
Production guidance
- For production, pass callback.url at the top level of the request body so HiAPI can notify your service when the task reaches a terminal state.
- GET /v1/tasks/:id is better for local debugging, low-volume jobs, or fallback reconciliation if a callback is missed.
- Use callback.when=final. Both success and fail are terminal states, so your service should deduplicate by taskId.
Best suited for
Everyday image generation balanced across speed, quality, and price.
promptresolutionReference images are optional; use image_input when useful.
image_inputSupports wider and narrower ratios for special layouts and placements.
aspect_ratio1K, 2K, and 4K are documented as current tiers.
resolutionRequest parameters
model string required Fixed value Nano-Banana-2.
input object required Business parameters. Supports text-to-image and optional reference images.
prompt string required Image generation or editing prompt.
image_input string[] optional Optional reference image URL array. Text-to-image works without references.
aspect_ratio enum optional Generated image aspect ratio.
resolution enum optional Output resolution.
output_format enum optional Output image format.
callback object optional Optional callback configuration. In production, pass callback.url so HiAPI can notify your service when the task reaches a terminal state.
url string required HTTPS URL that receives terminal task notifications.
when enum optional Callback trigger timing. Use final for terminal-state notifications.
Example requests
Generate without a reference image.
{
"model": "Nano-Banana-2",
"input": {
"prompt": "A glowing tropical rainforest at night",
"image_input": [],
"aspect_ratio": "1:1",
"resolution": "1K",
"output_format": "png"
}
}Use an optional reference image for style or subject guidance.
{
"model": "Nano-Banana-2",
"input": {
"prompt": "Restyle this reference into a cinematic product poster",
"image_input": [
"https://example.com/reference.png"
],
"aspect_ratio": "16:9",
"resolution": "1K",
"output_format": "png"
}
}Getting the result
- The response returns a taskId immediately without waiting for generation to finish.
- In production, prefer waiting for callback.url to receive the terminal notification. For local debugging, poll GET /v1/tasks/:id.
- When status=success, download the generated image from output[].url.
- When status=fail, fix the request based on the returned error instead of retrying the same invalid payload.