LogoNanoPhoto.AI Docs
LogoNanoPhoto.AI Docs
InicioDocumentation 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 API

Use Cases

Sora 2 TVC Ad Creation

Billing

Billing & Invoice

FAQ

FAQ
X (Twitter)

Sora 2 TVC Ad API

API for generating TVC (TV Commercial) advertisement videos using AI-powered storyboard generation and Sora 2 video synthesis.

Try it online: https://nanophoto.ai/sora-2-tvc-ad

Endpoints

MethodPathDescription
POST/api/sora-2-tvc/generateGenerate a TVC ad video
POST/api/sora-2-tvc/check-statusCheck task status

Authentication

Authorization: Bearer YOUR_API_KEY

Credits

DurationCredits
10s8
15s8

How It Works

The TVC Ad API uses a 3-step AI pipeline to generate professional TV commercial videos:

  1. Storyboard Script — AI generates a 9-scene (SC1-SC9) storyboard description based on your ad theme
  2. Storyboard Image — AI creates a 3x3 grid black-and-white storyboard illustration
  3. Video Generation — Sora 2 generates the final ad video from the storyboard image

The generate endpoint returns immediately after starting the pipeline. Use the check-status endpoint to poll for progress and results.

Generate TVC Ad

POST /api/sora-2-tvc/generate

Headers

HeaderValue
Content-Typeapplication/json
AuthorizationBearer YOUR_API_KEY

Body Parameters

ParameterTypeRequiredDescription
adThemestringYesThe ad theme or topic (e.g., "Nike running shoes")
referenceImageUrlstringNoPublic URL of a reference image for style guidance
voiceoverScriptstringNoVoiceover script text for the ad
videoDurationstringNo10 or 15 (seconds, default: 10)
aspectRatiostringNoportrait (default) or landscape

API calls only accept referenceImageUrl (public URL). Base64 image upload is not supported via API.

Examples

Basic TVC Ad

curl -X POST "https://nanophoto.ai/api/sora-2-tvc/generate" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-raw '{
    "adTheme": "Nike running shoes - feel the speed",
    "videoDuration": "15",
    "aspectRatio": "landscape"
  }'

With Reference Image and Voiceover

curl -X POST "https://nanophoto.ai/api/sora-2-tvc/generate" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-raw '{
    "adTheme": "Luxury perfume - elegance in every drop",
    "referenceImageUrl": "https://example.com/perfume-reference.jpg",
    "voiceoverScript": "Discover the essence of elegance. A fragrance that speaks to your soul.",
    "videoDuration": "15",
    "aspectRatio": "portrait"
  }'

TypeScript

sora-2-tvc-api-example.ts
async function generateTVCAd() {
  // Step 1: Submit TVC ad generation task
  const response = await fetch("https://nanophoto.ai/api/sora-2-tvc/generate", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      Authorization: "Bearer YOUR_API_KEY",
    },
    body: JSON.stringify({
      adTheme: "Nike running shoes - feel the speed",
      voiceoverScript: "Run faster. Run stronger. Nike.",
      videoDuration: "15",
      aspectRatio: "landscape",
    }),
  });

  const data = await response.json();

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

  console.log("Storyboard prompt:", data.storyboardPrompt);
  console.log("Storyboard image:", data.storyboardImageUrl);

  // Step 2: Poll for status using recordId
  const recordId = data.recordId;
  while (true) {
    await new Promise((resolve) => setTimeout(resolve, 5000)); // Wait 5s

    const statusRes = await fetch(
      "https://nanophoto.ai/api/sora-2-tvc/check-status",
      {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: "Bearer YOUR_API_KEY",
        },
        body: JSON.stringify({ recordId }),
      }
    );

    const status = await statusRes.json();

    if (status.status === "completed") {
      console.log("Video URL:", status.videoUrl);
      console.log("Generation time:", status.generationTime, "seconds");
      return;
    }

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

    console.log(`Step ${status.currentStep}/3: ${status.stepName}`);
  }
}

generateTVCAd();

Response

Processing

{
  "success": true,
  "status": "processing",
  "taskId": "video_task_id",
  "recordId": "tvc_record_id",
  "storyboardPrompt": "Generated 9-scene storyboard description...",
  "storyboardImageUrl": "https://static.nanophoto.ai/images/sora-tvc/storyboard-xxx.png"
}

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

Error

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

Check Task Status

POST /api/sora-2-tvc/check-status

Headers

HeaderValue
Content-Typeapplication/json
AuthorizationBearer YOUR_API_KEY

Body Parameters

ParameterTypeRequiredDescription
recordIdstringConditionalTVC record ID from generate response
taskIdstringConditionalVideo task ID from generate response

Provide either recordId or taskId. Using recordId is recommended.

Example

curl -X POST "https://nanophoto.ai/api/sora-2-tvc/check-status" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-raw '{"recordId": "tvc_record_id"}'

Response

Step 1: Generating Storyboard Script

{
  "success": true,
  "status": "processing",
  "recordId": "tvc_record_id",
  "currentStep": 1,
  "stepName": "Generating Storyboard Prompt"
}

Step 2: Generating Storyboard Image

{
  "success": true,
  "status": "processing",
  "recordId": "tvc_record_id",
  "currentStep": 2,
  "stepName": "Generating Storyboard",
  "storyboardPrompt": "..."
}

Step 3: Generating Video

{
  "success": true,
  "status": "processing",
  "recordId": "tvc_record_id",
  "currentStep": 3,
  "stepName": "Generating Ad Video",
  "storyboardPrompt": "...",
  "storyboardImageUrl": "https://static.nanophoto.ai/images/sora-tvc/storyboard-xxx.png",
  "videoTaskProgress": "generating"
}

Completed

{
  "success": true,
  "status": "completed",
  "recordId": "tvc_record_id",
  "currentStep": 3,
  "stepName": "Completed",
  "storyboardPrompt": "...",
  "storyboardImageUrl": "https://static.nanophoto.ai/images/sora-tvc/storyboard-xxx.png",
  "videoUrl": "https://video.nanophoto.ai/sora/...",
  "generationTime": 180
}

Failed

{
  "success": false,
  "status": "failed",
  "error": "Video generation failed",
  "errorCode": "GENERATION_FAILED",
  "recordId": "tvc_record_id"
}

Polling Strategy

  • Poll /api/sora-2-tvc/check-status every 5-10 seconds
  • Typical generation time: 2-5 minutes (3-step pipeline: script → storyboard → video)
  • 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
INVALID_INPUT400Missing ad theme
REFERENCE_IMAGE_URL_REQUIRED400API calls require referenceImageUrl (no base64)
GENERATION_FAILED500TVC ad generation failed
RECORD_NOT_FOUND404TVC record not found
UNAUTHORIZED403Record not owned by user
INTERNAL_ERROR500Internal server error

Sora 2 Video Generation API

API for generating videos using OpenAI Sora 2 models with text-to-video and image-to-video modes.

Nano Banana Pro Image Generation API

API for generating AI images with text-to-image and image-to-image modes using Nano Banana Pro.

Table of Contents

Endpoints
Authentication
Credits
How It Works
Generate TVC Ad
Headers
Body Parameters
Examples
Basic TVC Ad
With Reference Image and Voiceover
TypeScript
Response
Processing
Error
Check Task Status
Headers
Body Parameters
Example
Response
Step 1: Generating Storyboard Script
Step 2: Generating Storyboard Image
Step 3: Generating Video
Completed
Failed
Polling Strategy
Error Codes