LogoNanoPhoto.AI Docs
LogoNanoPhoto.AI Docs
ホームページDocumentation

Getting Started

Getting Started

User Guide

User Guide

API

API ReferenceSora Watermark Removal APIVideo Reverse Prompt API

Use Cases

Sora 2 TVC Ad Creation

FAQ

FAQ
X (Twitter)

Video Reverse Prompt API

API for analyzing videos to extract detailed shot breakdowns and prompts.

Try it online: https://nanophoto.ai/video-reverse-prompt

Endpoint

POST /api/sora-2/reverse-prompt

Authentication

Authorization: Bearer YOUR_API_KEY

Credits

1 credit per analysis (API calls only; web interface is free).

Request

Headers

HeaderValue
Content-Typeapplication/json
AuthorizationBearer YOUR_API_KEY

Body Parameters

ParameterTypeRequiredDescription
videoSourcestringYesVideo source type: youtube, url, or file
localestringNoOutput language (default: en). Supported: en, zh, zh-TW, ja, ko, es, fr, de, pt, ru, ar
videoUrlstringConditionalVideo URL. YouTube link (when videoSource is youtube) or direct .mp4 URL (when videoSource is url)
videoFilestringConditionalBase64-encoded video file (required when videoSource is file)
videoFileNamestringNoOriginal filename for uploaded videos

Examples

YouTube Video

curl -X POST "https://nanophoto.ai/api/sora-2/reverse-prompt" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-raw '{
    "videoSource": "youtube",
    "locale": "en",
    "videoUrl": "https://www.youtube.com/watch?v=W-15-UmGP5s"
  }'

Video URL

curl -X POST "https://nanophoto.ai/api/sora-2/reverse-prompt" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-raw '{
    "videoSource": "url",
    "locale": "zh",
    "videoUrl": "https://static.nanophoto.ai/demo/sk2-ad.mp4"
  }'

File Upload (Base64)

Read the video file and encode it to Base64, then pass it in the videoFile field.

app/api/example/route.ts
import { readFile } from "node:fs/promises";

const videoBuffer = await readFile("your-video.mp4");
const videoBase64 = videoBuffer.toString("base64");

const response = await fetch("https://nanophoto.ai/api/sora-2/reverse-prompt", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: "Bearer YOUR_API_KEY",
  },
  body: JSON.stringify({
    videoSource: "file",
    locale: "en",
    videoFile: videoBase64,
    videoFileName: "your-video.mp4",
  }),
});

// Streaming response
const reader = response.body!.getReader();
const decoder = new TextDecoder();

while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  process.stdout.write(decoder.decode(value));
}
  • Only .mp4 format is supported
  • Maximum file size: 30 MB (before Base64 encoding)
  • The videoFile value can be a plain Base64 string or a Data URL (e.g. data:video/mp4;base64,...)

Response

Success - Streaming

The API returns a streaming text response (Content-Type: text/plain; charset=utf-8). The AI analysis is streamed as it's generated, containing a detailed shot breakdown in Markdown table format.

The output includes:

  • Shot number, framing/angle, camera movement
  • Detailed visual description
  • Audio analysis (BGM, sound effects, narration)
  • Duration per shot
  • Overall summary

Error

{
  "success": false,
  "error": "AI service temporarily unavailable. Please try again later.",
  "errorCode": "AI_SERVICE_ERROR"
}

Error Codes

errorCodeHTTP StatusDescription
LOGIN_REQUIRED401Authentication required
API_KEY_RATE_LIMIT_EXCEEDED429Rate limit exceeded
INSUFFICIENT_CREDITS402Not enough credits
INVALID_INPUT400Missing required parameters
INVALID_YOUTUBE_URL400Invalid YouTube URL
INVALID_VIDEO_URL400Invalid video URL
INVALID_FORMAT400Invalid MP4 format
FILE_TOO_LARGE400File exceeds 30MB
VIDEO_DOWNLOAD_FAILED400Video download failed
VIDEO_PROCESSING_FAILED422Video processing failed
AI_SERVICE_ERROR503AI service unavailable
SERVICE_UNAVAILABLE503Service configuration issue
INTERNAL_ERROR500Internal server error

Sora Watermark Removal API

API for removing watermarks from Sora 2 generated videos.

Sora 2 TVC Ad Creation

Create professional TVC-style video ads in 3 simple steps using AI. From theme to finished video in minutes.

Table of Contents

Endpoint
Authentication
Credits
Request
Headers
Body Parameters
Examples
YouTube Video
Video URL
File Upload (Base64)
Response
Success - Streaming
Error
Error Codes