LogoDocumentação NanoPhoto.AI
LogoDocumentação NanoPhoto.AI
Página inicialDocumentation 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 Prompt Generator API

API for generating professional Sora 2 video prompts from topics, with support for multiple video techniques and languages.

Try it online: https://nanophoto.ai/sora-2-prompt-generator

Endpoint

POST /api/sora-2/generate-prompt

Authentication

Authorization: Bearer YOUR_API_KEY

Credits

2 credits per generation.

Credits are pre-deducted when the request starts and automatically refunded if generation fails.

Request

Headers

HeaderValue
Content-Typeapplication/json
AuthorizationBearer YOUR_API_KEY

Body Parameters

ParameterTypeRequiredDescription
topicstringYesVideo topic or scene description (max 500 characters)
modestringNotextToVideo or imageToVideo (default: textToVideo)
techniquestringNoVideo technique (see below). Default: montage
durationnumberNoVideo duration in seconds (default: 10)
modelstringNoAI model (default: google/gemini-3-flash-preview)
localestringNoOutput language (default: en). Supported: en, zh, zh-TW, ja, ko, es, fr, de, pt, ru, ar
imageUrlsstring[]NoPublic image URLs for imageToVideo mode (max 3)

Supported Techniques

ValueDescription
montageMontage - rapid shot combination
long-takeLong Take - single continuous shot
time-lapseTime-lapse photography
slow-motionSlow motion
tracking-shotTracking shot
aerial-viewAerial view
povPOV / First person
split-screenSplit screen
match-cutMatch cut
fade-transitionFade transition
  • imageUrls only accepts publicly accessible URLs. Base64 image upload is not supported via API.
  • topic is limited to 500 characters maximum.

Examples

Text to Video Prompt

curl -X POST "https://nanophoto.ai/api/sora-2/generate-prompt" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-raw '{
    "topic": "A serene Japanese garden with cherry blossoms falling into a koi pond",
    "technique": "slow-motion",
    "duration": 15,
    "locale": "en"
  }'

Image to Video Prompt

curl -X POST "https://nanophoto.ai/api/sora-2/generate-prompt" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-raw '{
    "topic": "Animate this landscape with gentle wind and floating clouds",
    "mode": "imageToVideo",
    "technique": "long-take",
    "duration": 10,
    "locale": "en",
    "imageUrls": ["https://example.com/landscape.jpg"]
  }'

Response

Success - Streaming

The API returns a streaming text response (Content-Type: text/plain; charset=utf-8). The generated Sora 2 prompt is streamed as it's produced.

The output includes:

  • Structured video prompt with timing markers
  • Shot-by-shot breakdown
  • Camera angles, movements, and lighting details
  • Atmosphere and mood descriptions

Error

{
  "success": false,
  "error": "Insufficient credits. Required: 2 credits for prompt generation.",
  "errorCode": "INSUFFICIENT_CREDITS",
  "requiredCredits": 2
}

Complete TypeScript Example

generate-prompt.ts
async function generatePrompt(apiKey: string) {
  const response = await fetch("https://nanophoto.ai/api/sora-2/generate-prompt", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      Authorization: `Bearer ${apiKey}`,
    },
    body: JSON.stringify({
      topic: "A futuristic cityscape at sunset with flying vehicles and neon lights",
      technique: "aerial-view",
      duration: 15,
      locale: "en",
    }),
  });

  if (!response.ok) {
    const error = await response.json();
    throw new Error(`Failed: ${error.error}`);
  }

  // Read streaming response
  const reader = response.body!.getReader();
  const decoder = new TextDecoder();
  let prompt = "";

  while (true) {
    const { done, value } = await reader.read();
    if (done) break;
    const chunk = decoder.decode(value);
    prompt += chunk;
    process.stdout.write(chunk);
  }

  console.log("\n\nFull prompt:", prompt);
  return prompt;
}

Error Codes

errorCodeHTTP StatusDescription
LOGIN_REQUIRED401Authentication required
API_KEY_RATE_LIMIT_EXCEEDED429Rate limit exceeded
INSUFFICIENT_CREDITS402Not enough credits
INVALID_INPUT400Topic is missing, empty, or too long

Video Reverse Prompt API

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

Sora 2 Video Generation API

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

Índice

Endpoint
Authentication
Credits
Request
Headers
Body Parameters
Supported Techniques
Examples
Text to Video Prompt
Image to Video Prompt
Response
Success - Streaming
Error
Complete TypeScript Example
Error Codes