Nano Banana Pro Serverless API

High-fidelity images with accurate multilingual text rendering.

~59.09s
POST /v2/nano-banana-pro · submit + poll
 1# pip install "segmind>=1.1.0"
 2# export SEGMIND_API_KEY="YOUR_API_KEY"
 3import segmind
 4
 5# Async (v2): submit to the queue and block until COMPLETED.
 6# run() returns the final result dict (600s deadline, 1.0s poll by default).
 7result = segmind.run(
 8    "nano-banana-pro",
 9    prompt="Create a multi-panel GTA-style comic page featuring one woman and one man as office coworkers working on a new product launch. Use bold outlines, dramatic GTA loading-screen shading, expressive faces, modern tech office backgrounds.\n\nPanel 1 — Narration:\nThe woman enters the office early, holding a laptop. She looks stressed but determined.\nText: ‘Launch day. Weeks of work… all coming down to this.’\n\nPanel 2 — Dialogue:\nMan appears behind her with a calm, confident smile.\nMan: ‘You’re here early. Ready for the big ship?’\nWoman: ‘Trying to be.’\n\nPanel 3 — Action:\nBoth sit at a desk with screens showing graphs, bugs, and a countdown timer.\nText: ‘One critical bug left… time running out.’\n\nPanel 4 — Dialogue:\nClose-up of the man pointing at the screen.\nMan: ‘Wait—I see it. We can fix this.’\nWoman: ‘Let’s do it.’\n\nPanel 5 — Action:\nBoth typing fast, dramatic GTA-style lighting, code streaming across screens.\nText: ‘Two minds. One mission.’\n\nPanel 6 — Victory:\nThe laptop shows PRODUCT SHIPPED — SUCCESS. Both cheer and laugh in relief.\nWoman: ‘We did it!’\nMan: ‘Told you we’d make it.’\n\nPanel 7 — Narration:\nFinal shot: team walking out of the office at night, city lights behind them.\nText: ‘In tech, wins aren’t solo. They’re shared.’\n\nArt style: GTA loading-screen style, bold color blocks, high contrast shadows, confident comic composition, cinematic frames.",
10    image_urls=["https://segmind-inference-inputs.s3.amazonaws.com/ad93498e-3370-432b-8dd7-bc3f4aa1b39a-black-man-image.jpeg", "https://segmind-inference-inputs.s3.amazonaws.com/8bdc63b0-79ed-4369-a4af-e7284f5bde33-image (86).png"],
11    aspect_ratio="9:16",
12    output_format="jpg",
13    output_resolution="4K",
14    response_modalities="TEXT_AND_IMAGE",
15)
16print(result["status"])                      # COMPLETED
17print(result.get("output"))                  # model output (e.g. media URL)
18print(result["metrics"]["inference_time"])   # server compute seconds
19
20# --- Or submit + poll manually (track request_id, control the cadence) ---
21from segmind import SegmindClient, InferenceFailed, InferenceTimeout
22
23client = SegmindClient()                      # reads SEGMIND_API_KEY
24payload = {
25    "prompt": "Create a multi-panel GTA-style comic page featuring one woman and one man as office coworkers working on a new product launch. Use bold outlines, dramatic GTA loading-screen shading, expressive faces, modern tech office backgrounds.\n\nPanel 1 — Narration:\nThe woman enters the office early, holding a laptop. She looks stressed but determined.\nText: ‘Launch day. Weeks of work… all coming down to this.’\n\nPanel 2 — Dialogue:\nMan appears behind her with a calm, confident smile.\nMan: ‘You’re here early. Ready for the big ship?’\nWoman: ‘Trying to be.’\n\nPanel 3 — Action:\nBoth sit at a desk with screens showing graphs, bugs, and a countdown timer.\nText: ‘One critical bug left… time running out.’\n\nPanel 4 — Dialogue:\nClose-up of the man pointing at the screen.\nMan: ‘Wait—I see it. We can fix this.’\nWoman: ‘Let’s do it.’\n\nPanel 5 — Action:\nBoth typing fast, dramatic GTA-style lighting, code streaming across screens.\nText: ‘Two minds. One mission.’\n\nPanel 6 — Victory:\nThe laptop shows PRODUCT SHIPPED — SUCCESS. Both cheer and laugh in relief.\nWoman: ‘We did it!’\nMan: ‘Told you we’d make it.’\n\nPanel 7 — Narration:\nFinal shot: team walking out of the office at night, city lights behind them.\nText: ‘In tech, wins aren’t solo. They’re shared.’\n\nArt style: GTA loading-screen style, bold color blocks, high contrast shadows, confident comic composition, cinematic frames.",
26    "image_urls": ["https://segmind-inference-inputs.s3.amazonaws.com/ad93498e-3370-432b-8dd7-bc3f4aa1b39a-black-man-image.jpeg", "https://segmind-inference-inputs.s3.amazonaws.com/8bdc63b0-79ed-4369-a4af-e7284f5bde33-image (86).png"],
27    "aspect_ratio": "9:16",
28    "output_format": "jpg",
29    "output_resolution": "4K",
30    "response_modalities": "TEXT_AND_IMAGE",
31}
32job = client.submit_async("nano-banana-pro", **payload)
33print(job.request_id)                         # available immediately
34try:
35    result = job.wait(timeout=600, interval=1.0)
36except InferenceTimeout as e:
37    print("still running:", e.request_id)
38except InferenceFailed as e:
39    print("failed:", e.detail)

API Endpoint

POSThttps://api.segmind.com/v1/nano-banana-pro

Parameters

promptrequired
string

Outline the scene with imaginative language.

aspect_ratiooptional
string

Choose image dimensions. Use '16:9' for widescreen or '1:1' for symmetrical art.

Default: "16:9"
Allowed values :
"1:1""2:3""3:2""4:3""3:4""4:5""5:4""16:9""9:16""21:9"
image_urlsoptional
string[]

Add a reference image or leave blank for original ideas.

output_formatoptional
string

Determines output format

Default: "jpg"
Allowed values :
"jpg""png"
output_resolutionoptional
string

Set the image detail level. Choose '4K' for high detail or '1K' for quicker results.

Default: "4K"
Allowed values :
"1K""2K""4K"
response_modalitiesoptional
string

Control output type. Use IMAGE for image-only output, TEXT_AND_IMAGE for both text and image.

Default: "TEXT_AND_IMAGE"
Allowed values :
"TEXT_AND_IMAGE""IMAGE"

Response Type

Returns: Image

Asynchronous requests (v2)

Use Async for video, long-running (>~60s), or high-concurrency workloads; Sync is simplest for fast image & LLM calls. Async submits a request and you poll it to completion.

  1. 1
    POST /v2/nano-banana-pro

    Submitreturns request_id, status_url, response_url

  2. 2
    GET /v2/requests/{id}/status

    Polluntil COMPLETED or FAILED

  3. 3
    GET /v2/requests/{id}

    Resultfinal response body

Status states

QUEUEDAccepted, waiting for a worker
PROCESSINGRunning on a worker
COMPLETEDDone — result body is ready
FAILEDErrored (incl. content/RAI blocks)
  • A FAILED request is served as HTTP 422 — the body still carries the error detail.
  • An unknown or expired request_id returns HTTP 404.
  • Results are retained for 1 hour, then expire.
  • Content / RAI blocks surface as FAILED, not a separate state.
  • Track completion by polling the status endpoint.

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out