LogoNanoPhoto.AI Docs
LogoNanoPhoto.AI Docs
Website HomepageDocumentation Homepage

Getting Started

Getting Started

User Guide

User Guide

API

API OverviewSora Watermark Removal APIVideo Reverse Prompt APISora 2 Prompt Generator APISora 2 Video Generation APISora 2 TVC Ad APINano Banana Pro Image Generation APINano Banana 2 Image Generation APIVeo 3.1 Video Generation API

Use Cases

Sora 2 TVC Ad Creation

Billing

Billing & Invoice

FAQ

FAQ
X (Twitter)

Veo 3.1 Video Generation API

API for generating videos using Google Veo 3.1 with text-to-video, reference image, and first/last frame modes. Supports multi-shot long videos up to 168 seconds.

Try it online: https://nanophoto.ai/veo-3

Endpoints

MethodPathDescription
POST/api/veo-3/generateGenerate a video
POST/api/veo-3/check-statusCheck task status

Authentication

Authorization: Bearer YOUR_API_KEY

Credits

ResolutionShotsCredits
720pper shot10
1080p1 shot only14
4K1 shot only30

Each shot generates an 8-second video clip. Multi-shot videos are concatenated automatically.

Maximum 21 shots per request (168 seconds total). 1080p and 4K are only available for single-shot generation.

Generate Video

POST /api/veo-3/generate

Headers

HeaderValue
Content-Typeapplication/json
AuthorizationBearer YOUR_API_KEY

Body Parameters

ParameterTypeRequiredDescription
shotsobject[]YesArray of shot objects (max 21)
shots[].idstringYesUnique identifier for the shot
shots[].promptstringYesVideo generation prompt
shots[].generationTypestringYesTEXT_2_VIDEO, FIRST_AND_LAST_FRAMES_2_VIDEO, or REFERENCE_2_VIDEO
shots[].aspectRatiostringYes16:9 or 9:16
shots[].imageUrlsstring[]ConditionalPublic image URLs (see generation type requirements)
resolutionstringNo720p (default), 1080p, or 4k (single shot only)

Generation Types

TypeDescriptionImages Required
TEXT_2_VIDEOText to videoNone (no images allowed)
FIRST_AND_LAST_FRAMES_2_VIDEOFirst/last frame to video1-2 images
REFERENCE_2_VIDEOReference image to video1-3 images

API calls only accept imageUrls (public URLs). Base64 image upload is not supported via API.

Examples

Text to Video (Single Shot)

curl -X POST "https://nanophoto.ai/api/veo-3/generate" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-raw '{
    "shots": [
      {
        "id": "shot-1",
        "prompt": "A golden retriever running on a beach at sunset, cinematic lighting",
        "generationType": "TEXT_2_VIDEO",
        "aspectRatio": "16:9"
      }
    ],
    "resolution": "720p"
  }'

Reference Image to Video

curl -X POST "https://nanophoto.ai/api/veo-3/generate" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-raw '{
    "shots": [
      {
        "id": "shot-1",
        "prompt": "The character comes alive, walking through a magical forest",
        "generationType": "REFERENCE_2_VIDEO",
        "aspectRatio": "16:9",
        "imageUrls": ["https://static.nanophoto.ai/demo/nano-banana-pro.webp"]
      }
    ],
    "resolution": "720p"
  }'

Multi-Shot Video

curl -X POST "https://nanophoto.ai/api/veo-3/generate" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-raw '{
    "shots": [
      {
        "id": "shot-1",
        "prompt": "Wide shot of a city skyline at dawn, golden hour lighting",
        "generationType": "TEXT_2_VIDEO",
        "aspectRatio": "16:9"
      },
      {
        "id": "shot-2",
        "prompt": "Close-up of a coffee cup on a windowsill, steam rising",
        "generationType": "TEXT_2_VIDEO",
        "aspectRatio": "16:9"
      },
      {
        "id": "shot-3",
        "prompt": "A person walking through a park, autumn leaves falling",
        "generationType": "TEXT_2_VIDEO",
        "aspectRatio": "16:9"
      }
    ],
    "resolution": "720p"
  }'

TypeScript

veo-3-api-example.ts
async function generateVideo() {
  // Step 1: Submit generation task
  const response = await fetch("https://nanophoto.ai/api/veo-3/generate", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      Authorization: "Bearer YOUR_API_KEY",
    },
    body: JSON.stringify({
      shots: [
        {
          id: "shot-1",
          prompt: "A golden retriever running on a beach at sunset",
          generationType: "TEXT_2_VIDEO",
          aspectRatio: "16:9",
        },
      ],
      resolution: "720p",
    }),
  });

  const data = await response.json();

  if (data.status === "failed") {
    console.error("Generation failed:", data.error);
    return;
  }

  // Step 2: Poll for status
  const taskIds = data.shots.map((shot: any) => ({
    shotId: shot.shotId,
    taskId: shot.taskId,
  }));

  while (true) {
    await new Promise((resolve) => setTimeout(resolve, 5000)); // Wait 5s

    const statusRes = await fetch(
      "https://nanophoto.ai/api/veo-3/check-status",
      {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: "Bearer YOUR_API_KEY",
        },
        body: JSON.stringify({ taskIds, resolution: "720p" }),
      }
    );

    const status = await statusRes.json();

    if (status.status === "completed") {
      for (const shot of status.shots) {
        console.log(`Shot ${shot.shotId} Video URL:`, shot.videoUrl);
      }
      return;
    }

    if (status.status === "failed") {
      console.error("Generation failed:", status.shots);
      return;
    }

    console.log("Still processing...");
  }
}

generateVideo();

Response

Processing

{
  "status": "processing",
  "shots": [
    {
      "shotId": "shot-1",
      "taskId": "task_abc123",
      "status": "processing"
    }
  ],
  "creditsUsed": 10
}

When you receive status: "processing", poll the check-status endpoint every 5-10 seconds.

Error

{
  "error": "Insufficient credits",
  "errorCode": "INSUFFICIENT_CREDITS",
  "requiredCredits": 10
}

Check Task Status

POST /api/veo-3/check-status

Headers

HeaderValue
Content-Typeapplication/json
AuthorizationBearer YOUR_API_KEY

Body Parameters

ParameterTypeRequiredDescription
taskIdsobject[]YesArray of task ID objects from generate response
taskIds[].shotIdstringYesShot ID
taskIds[].taskIdstringYesTask ID from generate response
resolutionstringNo720p (default), 1080p, or 4k

Example

curl -X POST "https://nanophoto.ai/api/veo-3/check-status" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-raw '{
    "taskIds": [
      {"shotId": "shot-1", "taskId": "task_abc123"}
    ],
    "resolution": "720p"
  }'

Response

Still Processing

{
  "status": "processing",
  "shots": [
    {
      "shotId": "shot-1",
      "taskId": "task_abc123",
      "status": "processing"
    }
  ]
}

Completed

{
  "status": "completed",
  "shots": [
    {
      "shotId": "shot-1",
      "taskId": "task_abc123",
      "status": "completed",
      "videoUrl": "https://video.nanophoto.ai/veo/...",
      "generationTime": 90
    }
  ]
}

Failed

{
  "status": "failed",
  "shots": [
    {
      "shotId": "shot-1",
      "taskId": "task_abc123",
      "status": "failed",
      "error": "Video generation failed"
    }
  ]
}

Polling Strategy

  • Poll /api/veo-3/check-status every 5-10 seconds
  • Typical generation time: 2-5 minutes per shot
  • Multi-shot videos take longer as each shot is generated sequentially
  • Credits are automatically refunded if generation fails

Error Codes

errorCodeHTTP StatusDescription
LOGIN_REQUIRED401Authentication required
API_KEY_RATE_LIMIT_EXCEEDED429Rate limit exceeded (100 req/hour)
INSUFFICIENT_CREDITS402Not enough credits
SHOTS_REQUIRED400Missing shots array
PROMPT_REQUIRED400Missing prompt in a shot
INVALID_IMAGE_COUNT400Wrong number of images for generation type
IMAGE_URLS_REQUIRED400API calls require imageUrls (no base64)
GENERATION_FAILED500Video generation failed
TASK_IDS_REQUIRED400Missing task IDs
TASK_NOT_FOUND404Task not found or not owned by user
INTERNAL_ERROR500Internal server error

Table of Contents

Endpoints
Authentication
Credits
Generate Video
Headers
Body Parameters
Generation Types
Examples
Text to Video (Single Shot)
Reference Image to Video
Multi-Shot Video
TypeScript
Response
Processing
Error
Check Task Status
Headers
Body Parameters
Example
Response
Still Processing
Completed
Failed
Polling Strategy
Error Codes