Back to Tutorials

Nano Banana API - Developer Guide

Learn how to integrate Nano Banana into your applications using the API. Includes pricing, rate limits, and code examples.

September 5, 2025
Nano Banana Team
8 min read
Technical
Intermediate

Nano Banana API Integration

Integrate Nano Banana into your applications using the official API. This guide covers everything developers need to know.

Getting Started

To use the Nano Banana API:

  1. Get your API key from Google AI Studio
  2. Set up authentication in your application
  3. Make your first API call
  4. Handle responses and errors

API Endpoints

Available Endpoints

  • POST /v1/images/editGeneral image editing
  • POST /v1/images/text-replaceText replacement
  • POST /v1/images/style-transferStyle transfer
  • POST /v1/images/remove-objectObject removal

Pricing & Limits

Free Tier

$0/month
  • • 100 requests per month
  • • Standard resolution
  • • Community support

Basic Plan

$10/month
  • • 1,000 requests per month
  • • High resolution output
  • • Email support

Pro Plan

$50/month
  • • 10,000 requests per month
  • • 4K resolution output
  • • Priority support

Rate Limits: 10 requests per minute across all plans. File size limit: 10MB per image.

Code Examples

Python Example

import requests

def edit_image(image_path, prompt):
    url = "https://api.nanobanana.ai/v1/images/edit"
    headers = {"Authorization": "Bearer YOUR_API_KEY"}
    
    with open(image_path, 'rb') as f:
        files = {'image': f}
        data = {'prompt': prompt}
        response = requests.post(url, headers=headers, files=files, data=data)
    
    return response.json()

# Usage
result = edit_image('input.jpg', 'Replace "Hello" with "Welcome"')
print(result)

JavaScript Example

const editImage = async (imageFile, prompt) => {
  const formData = new FormData();
  formData.append('image', imageFile);
  formData.append('prompt', prompt);
  
  const response = await fetch('https://api.nanobanana.ai/v1/images/edit', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: formData
  });
  
  return await response.json();
};

// Usage
const result = await editImage(imageFile, 'Replace "Hello" with "Welcome"');
console.log(result);

Error Handling

Common Error Codes

  • 400 Bad Request: Invalid prompt or image format
  • 401 Unauthorized: Invalid or missing API key
  • 429 Too Many Requests: Rate limit exceeded
  • 500 Internal Server Error: Server-side processing error

Best Practices

Development Tips

  • • Always validate input images before sending to API
  • • Implement proper error handling and retry logic
  • • Cache results when possible to reduce API calls
  • • Use webhooks for long-running operations
  • • Monitor your usage to avoid hitting rate limits

Nano Banana Team

Nano Banana API specialists providing technical integration guidance.