API Documentation

The Nano Banana Video API allows you to generate videos from text prompts or images programmatically. The API uses API key authentication and provides endpoints for text-to-video and image-to-video generation.

Base URL
https://nanobananavideo.com/api/v1/

Authentication

All API requests require authentication using an API key. You can obtain your API key from your dashboard after logging in.

API Key Usage

You can provide your API key in one of the following ways:

Recommended

X-API-Key Header

X-API-Key: your_api_key_here

Authorization Header

Authorization: Bearer your_api_key_here
Less Secure

Query Parameter

?api_key=your_api_key_here

Getting Your API Key

  1. Log in to your dashboard at https://nanobananavideo.com/dashboard.php
  2. Navigate to the API section
  3. Click "Create API Key" or "Regenerate API Key"
  4. Copy and securely store your API key (it will only be shown once)

Rate Limits

  • Limit: 10 video generations per 30 minutes per user
  • Response: When rate limit is exceeded, you'll receive a 429 Too Many Requests response
  • Headers: Rate limit information is included in error responses

Text to Video

POST

Generate a video from a text prompt.

Endpoint
POST /api/v1/text-to-video.php

Parameters

Parameter Type Required Default Description
prompt Required string Yes - Text description (max 500 characters)
resolution Optional string No "720p" "480p", "720p", or "1080p"
duration Optional integer No 5 Duration in seconds (3-12)
aspect_ratio Optional string No "16:9" Various ratios supported

Request Example

{
  "prompt": "A beautiful sunset over the ocean",
  "resolution": "1080p",
  "duration": 5,
  "aspect_ratio": "16:9"
}

Response Example

{
  "success": true,
  "video_id": 123,
  "video_url": "https://example.com/video.mp4",
  "thumbnail_url": "https://example.com/thumbnail.jpg",
  "credits_used": 5,
  "rate_limit": {
    "count": 1,
    "limit": 10,
    "remaining": 9
  }
}

cURL Example

curl -X POST https://nanobananavideo.com/api/v1/text-to-video.php \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key_here" \
  -d '{
    "prompt": "A beautiful sunset over the ocean",
    "resolution": "1080p",
    "duration": 5
  }'

Image to Video

POST

Generate a video from one or more image URLs.

Endpoint
POST /api/v1/image-to-video.php

Request Example

{
  "image_urls": ["https://example.com/image.jpg"],
  "prompt": "Animate this image with gentle motion",
  "resolution": "1080p",
  "duration": 5
}

Python Example

import requests

url = "https://nanobananavideo.com/api/v1/image-to-video.php"
headers = {
    "Content-Type": "application/json",
    "X-API-Key": "your_api_key_here"
}
data = {
    "image_urls": ["https://example.com/image.jpg"],
    "prompt": "Animate this image",
    "resolution": "1080p",
    "duration": 5
}

response = requests.post(url, json=data, headers=headers)
result = response.json()
print(result)

Video Status

GET

Get the status and details of a video generation.

Endpoint
GET /api/v1/video-status.php?video_id=123

Status Values

queued

Video is queued for processing

processing

Video is being generated

completed

Generation completed

failed

Generation failed

Error Handling

All error responses follow this format:

{
  "success": false,
  "error": "Error message describing what went wrong"
}

HTTP Status Codes

200 OK Request successful
400 Bad Request Invalid parameters
401 Unauthorized Invalid API key
403 Forbidden Insufficient permissions
429 Too Many Requests Rate limit exceeded

Credits System

Video generation consumes credits from your account.

  • Base cost: 5 credits
  • Resolution: +2 credits for 1080p
  • Duration: +1 credit per second over 5 seconds

Examples: 720p/5s = 5 credits • 1080p/5s = 7 credits • 1080p/10s = 12 credits

Best Practices

Store API keys securely

Never commit API keys to version control or expose them in client-side code

Handle errors gracefully

Always check the success field in responses

Poll for status

For long-running video generation, poll the status endpoint instead of waiting synchronously

Respect rate limits

Implement exponential backoff when hitting rate limits