LogoRuxa.ai
Nano Banana Image Generation API Guide
2025/12/26
3 min read

Nano Banana Image Generation API Guide

Complete guide to generating images with Google Nano Banana (Gemini 2.5 Flash Image) API through Ruxa AI.

Nano Banana Overview

Nano Banana is an image generation model powered by Google's Gemini 2.5 Flash Image. It provides fast, high-quality text-to-image generation with support for multiple aspect ratios and output formats.

Available Models

Model Description Features
google/nano-banana Standard text-to-image Fast generation, multiple aspect ratios
google/nano-banana-pro Advanced version Higher resolution (1k/2k/4k), image editing

Basic Text-to-Image

Generate an image with Nano Banana:

curl --request POST \
  --url https://api.ruxa.ai/api/v1/tasks/create \
  --header 'Authorization: Bearer sk-xxxxxx' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "google/nano-banana",
    "input": {
      "prompt": "A hyper-realistic tweet from Einstein right after completing the theory of relativity.",
      "output_format": "png",
      "image_size": "1:1"
    }
  }'

Response:

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_gemini-2.5-flash-image_xxxxx"
  }
}

Using Callback URL

Recommended for production:

curl --request POST \
  --url https://api.ruxa.ai/api/v1/tasks/create \
  --header 'Authorization: Bearer sk-xxxxxx' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "google/nano-banana",
    "callBackUrl": "https://your-domain.com/api/callback",
    "input": {
      "prompt": "Your prompt here",
      "output_format": "png",
      "image_size": "16:9"
    }
  }'

Nano Banana Pro - Image Editing

Use the Pro version for image editing:

curl --request POST \
  --url https://api.ruxa.ai/api/v1/tasks/create \
  --header 'Authorization: Bearer sk-xxxxxx' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "google/nano-banana-pro",
    "input": {
      "prompt": "Turn this photo into a bobblehead: slightly enlarge the head, keep the face accurate, cartoonize the body.",
      "image_input": ["https://example.com/your-image.png"],
      "aspect_ratio": "1:1",
      "resolution": "1k",
      "output_format": "png"
    }
  }'

Parameters Reference

Nano Banana (Standard)

Parameter Type Required Description
prompt string Yes Image description prompt
output_format string No Output format: png, jpeg (default: png)
image_size string No Aspect ratio (default: 1:1)

Supported aspect ratios: 1:1, 9:16, 16:9, 3:4, 4:3, 3:2, 2:3, 5:4, 4:5, 21:9, auto

Nano Banana Pro

Parameter Type Required Description
prompt string Yes Image description/edit instruction (max 10000 chars)
image_input array Yes Array of input image URLs (max 8)
aspect_ratio string No Aspect ratio (default: 1:1)
resolution string No Resolution: 1k, 2k, 4k (default: 1k)
output_format string No Output format: png, jpg (default: png)

Pro supported aspect ratios: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, auto

Query Task Status

curl --request GET \
  --url 'https://api.ruxa.ai/api/v1/tasks/query/{taskId}' \
  --header 'Authorization: Bearer sk-xxxxxx'

Prompt Tips

  1. Be specific - Include subject, style, lighting, details
  2. Use style keywords - "hyper-realistic", "illustration style", "3D render"
  3. Specify composition - "close-up", "panoramic", "bird's eye view"
  4. Add quality modifiers - "high definition", "professional photography", "8K resolution"

Example prompt:

"An orange cat sitting on a windowsill watching the rain, soft natural light, cozy indoor scene, professional photography style, shallow depth of field"

Response Codes

Code Description
200 Success
401 Unauthorized - invalid API key
402 Insufficient credits
404 Not found
422 Validation error
429 Rate limited
500 Server error

Learn More

Author

avatar for Ruxa AI
Ruxa AI

Categories

Newsletter

Join the community

Subscribe to our newsletter for the latest news and updates