How to Build an Image Workflow with the Nano Banana Images API

When you add AI image features to a product, the hard part is rarely the first prompt. The real work is building a dependable workflow: accept a prompt, decide whether the user is creating or editing, keep track of task identifiers, show image results, and handle partial failures without losing the whole request.
What you can do
The Nano Banana Images API gives builders one endpoint for two jobs: generating new images and editing existing images. The base URL is https://api.acedata.cloud, and the endpoint is POST /nano-banana/images. The request body is JSON.
The key switch is action. Use generate when the image should come from a text prompt. Use edit when the request should work from one or more existing images passed through image_urls. This makes the API easy to wire into product flows where users may start from either a blank prompt box or an uploaded/reference image.
prompt: required for generation and editing.image_urls: required for editing; each item should be a public HTTP or HTTPS image URL, and Base64 image data is also supported.count: optional, supports 1 to 4 images, and defaults to 1.model: optional; the default isnano-banana.
How it works
A successful call returns success, task_id, trace_id, and a data array. Each item in data includes the prompt used for the request and an image_url. In a real application, store task_id with the user job and keep trace_id in logs for support and debugging.
The documented model options include nano-banana, nano-banana-2-lite, nano-banana-2, nano-banana-pro, and the corresponding :official variants. The docs also note that nano-banana-2-lite supports only 1K resolution. Optional layout fields include aspect_ratio, such as 1:1 or 16:9, and resolution, such as 1K, 2K, or 4K.
Generate an image from text
For a text-to-image feature, the minimum useful body contains action and prompt. You can add model and count when you want more control.
{
"action": "generate",
"model": "nano-banana-pro",
"prompt": "A photorealistic close-up portrait of an elderly Japanese ceramicist inspecting a freshly glazed tea bowl in a rustic sun-drenched workshop, golden hour light, 85mm portrait lens, soft bokeh, vertical portrait orientation.",
"count": 1
}
This pattern fits product illustration tools, thumbnail generators, internal creative assistants, and visual prototyping dashboards. The important product detail is to store the returned identifiers before showing the image. That gives users a way to retry, report, or revisit an image later.
Comments
Post a Comment