Developers · REST API v1

Nano Banana Pro API and More — Every Model Behind One Key

Use the Nano Banana Pro API, GPT Image 2, Nano Banana 2, and video models like VEO, Seedance, and Kling through one REST API key. Generate images from a text prompt or reference image, poll task status, and check your credit balance or preview a job’s cost before submitting it.

RESTful APIAsync generation15+ modelsBearer auth

Nano Banana Pro API Quick Facts

Model ID
nano-banana-pro
Endpoint
POST /api/v1/images/generate
Resolution
1K / 2K / 4K
Cost estimate
POST /api/v1/account/calculate-cost
Authentication
Authorization: Bearer <your API key>

Authentication

All API requests require an API key passed in the Authorization header:

Authorization: Bearer nb_sk_your_api_key_here

Create and manage your API keys in the API Keys dashboard.

Quick Start

Image Generation

The image and video generation examples run consecutively from the Account Credits example’s total_credits balance. Calculate Cost only previews a fee and does not spend credits.

POST/api/v1/images/generate

Generate an image from a text prompt or reference image.

Request Body

{
  "prompt": "A sunset over mountains",
  "mode": "text",           // "text" | "image"
  "model": "bananax-1.0",   // optional; defaults to ImgEditor 2.0
  "image_url": "https://...",  // required if mode=image
  "aspect_ratio": "16:9",   // "1:1" | "3:4" | "4:3" | "9:16" | "16:9"
  "resolution": "1K",       // "1K" | "2K" | "4K" (model dependent)
  "num_images": 1,           // 1-4
  "quality": "standard",    // "standard" | "hd"
  "output_format": "png"    // "png" | "jpeg"
}

Response

{
  "success": true,
  "data": {
    "task_id": "clx...",
    "status": "pending",
    "credits_used": 6,
    "credits_remaining": 994
  }
}

Image Status

GET/api/v1/images/status?task_id=xxx

Check the status of an image generation task. Poll this endpoint until status is 'completed' or 'failed'.

Response

{
  "success": true,
  "data": {
    "task_id": "clx...",
    "status": "completed",
    "progress": 100,
    "image_url": "https://...",
    "completed_at": "2024-01-01T00:00:00Z"
  }
}

Video Generation

POST/api/v1/videos/generate

Generate video from text, keyframes, or multimodal image, video, and audio references.

Request Body

{
  "prompt": "Keep the character and follow the reference camera rhythm",
  "model_id": "seedance-2.5",
  "seedance_mode": "omni_reference",
  "omni_reference_task_type": "auto",
  "reference_images": ["https://.../character.png"],
  "reference_videos": ["https://.../camera.mov"],
  "reference_audios": ["https://.../ambience.wav"],
  "aspect_ratio": "16:9",
  "duration": 8,
  "resolution": "720p",
  "generate_audio": true
}

Response

{
  "success": true,
  "data": {
    "task_id": "clx...",
    "status": "processing",
    "credits_used": 525,
    "credits_remaining": 469
  }
}

Video Status

GET/api/v1/videos/status?task_id=xxx

Check the status of a video generation task.

Response

{
  "success": true,
  "data": {
    "task_id": "clx...",
    "status": "succeeded",
    "progress": 100,
    "video_url": "https://...",
    "completed_at": "2024-01-01T00:00:00Z"
  }
}

Account Credits

GET/api/v1/account/credits

Get your current credit balance and subscription status.

Response

{
  "success": true,
  "data": {
    "credits": 469,
    "total_credits": 1000,
    "subscription": {
      "plan": "pro",
      "end_date": "2024-12-31T00:00:00Z"
    },
    "is_vip": true
  }
}

Calculate Cost

POST/api/v1/account/calculate-cost

Preview the credit cost for a generation without executing it. For GPT Image 2.5, include quality (low, medium, high, xhigh, max; default medium), resolution, prompt and image_urls (or reference_image_count) to match the final quote. Long prompts above the included text budget cost extra.

Request Body

{
  "type": "image",
  "mode": "text",
  "model": "nano-banana-pro",
  "num_images": 2,
  "resolution": "2K"
}

Response

{
  "success": true,
  "data": {
    "type": "image",
    "credits_needed": 12
  }
}

Available Models

GET/api/v1/models

List all available image and video generation models.

Response

{
  "success": true,
  "data": {
    "image_models": [
      { "id": "bananax-1.0", "name": "ImgEditor 2.0", "is_default": true, "max_reference_images": 4 },
      { "id": "gpt-image-2.6", "name": "GPT Image 2.6", "max_reference_images": 10 },
      { "id": "gpt-image-2.5-flare", "name": "GPT Image 2.5 Flare", "max_reference_images": 16 },
      { "id": "gpt-image-2.5-sunburst", "name": "GPT Image 2.5 Sunburst", "max_reference_images": 16 },
      { "id": "gpt-image-2", "name": "GPT Image 2", "max_reference_images": 4 },
      { "id": "nano-banana", "name": "Nano Banana", "max_reference_images": 10 },
      { "id": "nano-banana-pro", "name": "Nano Banana Pro" },
      ...
    ],
    "video_models": [
      { "id": "veo-3.1-fast", "name": "VEO 3.1 Fast", ... },
      ...
    ]
  }
}

Image Models

modelNameresolutionaspect_ratioBase CreditsSubscription
gpt-image-2.6GPT Image 2.61K1:1, 16:9, 9:16, 4:3, 3:4, 21:9PNG/JPEG/WebP: 2; SVG: 5 (text only)No
gpt-image-2.5-flareGPT Image 2.5 Flare1K, 2K, 4K15 ratios, including 3:1 and 1:3From 2; default medium 1K: 3. +5/reference imageNo
gpt-image-2.5-sunburstGPT Image 2.5 Sunburst1K, 2K, 4K15 ratios, including 3:1 and 1:3From 2; default medium 1K: 3. +5/reference imageNo
gpt-image-2GPT Image 2-1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 5:4, 4:5, 2:1, 1:2, 21:9, 9:216No
bananax-1.0ImgEditor 2.0-1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 5:4, 4:5, 2:1, 1:2, 21:9, 9:216No
nano-bananaNano Banana-1:1, 3:4, 4:3, 9:16, 16:9text: 1, image: 2No
nano-banana-proNano Banana Pro1K, 2K, 4K1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:96 (+14 for 4K)No
nano-banana-2Nano Banana 21K, 2K, 4K1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9text: 4, image: 8 (+4 for 2K, +14 for 4K)Required
seedream4SeeDream 4-1:1, 3:4, 4:3, 9:16, 16:94Required
seedream5Seedream 5.02K, 4K1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:36No
seedream5-proSeedream 5.0 Pro1K, 1.5K, 2K1:1, 1:2, 2:1, 1:3, 3:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 9:21, 21:97 (+7 for 2K)No

quality: "standard" | "hd" (hd +2 credits, except GPT Image 2.5: standard = medium, hd = high; cost depends on quality and resolution; GPT Image 2.6 supports standard only)

num_images: 1 - 4 (total = per-image credits × num_images)

output_format: "png" | "jpeg" | "webp" | "svg" (SVG: GPT Image 2.6 text mode only, no reference images, num_images = 1; fixed low quality and default SVG author model)

mode: "text" (text-to-image) | "image" (image-to-image, requires image_url)

Video Models

model_idNameresolutionaspect_ratioduration (s)AudioImage Input
veo-3.1-fastVEO 3.1 Fast720p, 1080p16:9, 9:168Always onYes
veo-3.1VEO 3.1720p, 1080p16:9, 9:164, 6, 8YesYes
seedance-1.5-fastSeedance 1.5 Fast720p, 1080p16:9, 9:16, 1:14, 8, 12YesYes
seedance-1.5Seedance 1.5 Pro720p, 1080p16:9, 9:16, 1:14, 8, 12YesYes
seedance-2.5Seedance 2.5480p, 720p, 1080padaptive, 16:9, 9:16, 4:3, 3:4, 1:1, 21:94–30YesYes
seedance-2.0-fastSeedance 2.0 Fast480p, 720p, 1080p16:9, 9:16, 4:3, 3:4, 1:1, 21:94, 5, 10, 15YesYes
seedance-2.0Seedance 2.0480p, 720p, 1080p16:9, 9:16, 4:3, 3:4, 1:1, 21:94, 5, 10, 15YesYes
minimax-h3MiniMax H3768p, 2kadaptive, 16:9, 9:16, 4:3, 3:4, 1:1, 21:94–15YesYes
minimax-h3-maxMiniMax H3 Max480p, 768p16:9, 9:16, 4:3, 3:4, 1:1, 21:95–15NoYes
kling-o3-stdKling O3720p16:9, 9:16, 1:15, 10YesYes
kling-o3-proKling O3 Pro720p16:9, 9:16, 1:15, 10YesYes
grok-videoGrok Video480p, 720p16:9, 9:16, 1:16, 10NoYes

Video Credits

Credits vary by model, resolution, duration and audio. Use /api/v1/account/calculate-cost to get the exact cost.

VEO 3.1 Fast (default) — 8 seconds, audio always on

ResolutionCredits per generation
720p30
1080p35

Error Codes

HTTP StatusCodeDescription
401
UNAUTHORIZEDMissing or invalid API key
402
INSUFFICIENT_CREDITSNot enough credits for this operation
403
FORBIDDENAPI key disabled, expired, or lacks required scope
429
RATE_LIMIT_EXCEEDEDToo many requests per minute
400
INVALID_PROMPTPrompt is empty or invalid
400
INVALID_MODELUnknown model ID
404
TASK_NOT_FOUNDGeneration task does not exist
451
CONTENT_FILTEREDContent was rejected by safety filters
500
INTERNAL_ERRORServer error, please retry

Rate Limits

Default rate limit: 60 requests per minute per API key.

When exceeded, the API returns HTTP 429 with the RATE_LIMIT_EXCEEDED error code.

Response Format

All responses follow a consistent envelope format:

Success

{
  "success": true,
  "data": { ... }
}

Error

{
  "success": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable message"
  }
}

Ready to start building?

Prefer a no-code workflow? Edit photos with AI