Nano Banana Pro Serverless API

High-fidelity images with accurate multilingual text rendering.

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    system_prompt="Keep the composition polished, cheerful, and suitable for a product campaign.",
12    aspect_ratio="1:1",
13    output_resolution="4K",
14    output_format="jpg",
15    response_modalities="TEXT_AND_IMAGE",
16)
17print(result["status"])                      # COMPLETED
18print(result.get("output"))                  # model output (e.g. media URL)
19print(result["metrics"]["inference_time"])   # server compute seconds
20
21# --- Or submit + poll manually (track request_id, control the cadence) ---
22from segmind import SegmindClient, InferenceFailed, InferenceTimeout
23
24client = SegmindClient()                      # reads SEGMIND_API_KEY
25payload = {
26    "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.",
27    "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"],
28    "system_prompt": "Keep the composition polished, cheerful, and suitable for a product campaign.",
29    "aspect_ratio": "1:1",
30    "output_resolution": "4K",
31    "output_format": "jpg",
32    "response_modalities": "TEXT_AND_IMAGE",
33}
34job = client.submit_async("nano-banana-pro", **payload)
35print(job.request_id)                         # available immediately
36try:
37    result = job.wait(timeout=600, interval=1.0)
38except InferenceTimeout as e:
39    print("still running:", e.request_id)
40except InferenceFailed as e:
41    print("failed:", e.detail)

API Endpoint

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

Parameters

promptrequired
string

Describe the image to generate or the changes to make to the reference images.

Default: "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."
aspect_ratiooptional
string

Choose the proportions of the generated image. "Auto" lets the model pick.

Default: "1:1"
Allowed values (15 total):
Auto (model decides)"auto"
Square (1:1)"1:1"
Portrait (2:3)"2:3"
Landscape (3:2)"3:2"
Landscape (4:3)"4:3"
Portrait (3:4)"3:4"
Portrait (4:5)"4:5"
Landscape (5:4)"5:4"
Widescreen (16:9)"16:9"
Vertical (9:16)"9:16"
+5 more
image_urlsoptional
string[]

Optional reference images used to guide generation. Nano Banana Pro accepts up to 14 images.

Default: []
output_formatoptional
string

File format of the generated image.

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

Output detail level. Also determines the price tier (1K/2K = $0.15, 4K = $0.25).

Default: "4K"
Allowed values :
"1K""2K"
4K (highest detail)"4K"
response_modalitiesoptional
string

Return only the generated image or include a text response alongside it.

Default: "TEXT_AND_IMAGE"
Allowed values :
Text and image"TEXT_AND_IMAGE"
Image only"IMAGE"
safety_toleranceoptional
integer

Content-filter strictness, 1 (strictest) to 6 (most permissive). Leave blank for the default.

Default: 4Range: 1 - 6
seedoptional
integer

Optional seed for reproducible results. Leave blank for a random seed on every request.

Default: 123456789Range: 0 - 999999999999999
system_promptoptional
string

Optional high-level persona or style instructions applied to the generation.

Default: ""
web_searchoptional
boolean

Ground generation in real-time web data. Recommended for news-related prompts. Also affects price.

Default: false

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