Sora2 Api

Sora2 Api

Video generation endpoints for text-to-video and image-to-video. Authenticate with `Authorization: Bearer YOUR_API_KEY`. Credits are charged and refunded automatically. See /docs for details.

Before you call

  • Endpoints are in-site Next APIs and require `Authorization: Bearer YOUR_API_KEY`.
  • Credits per model: sora-2 20, sora-2-pro 30; failed jobs refund automatically.
  • Send imageData (base64) or url for image-to-video; images are uploaded to storage before calling Sora2 Api.

Generate video

POST /api/v1/video/sora-video for text-to-video or image-to-video. Send JSON with prompt and model.

Method: POSTPath: /api/v1/image/nano-banana

Payload fields

  • prompt (required): description of the video to generate.
  • model (required): sora-2 | sora-2-pro.
  • nanoBananaApi.generation.fields.mode
  • aspectRatio (optional): accepts 16:9 or 9:16.
  • nanoBananaApi.generation.fields.imageSize
  • nanoBananaApi.generation.fields.imageFile
  • nanoBananaApi.generation.fields.imageUrl
  • imageData (optional): base64 data URL for image-to-video.
Failure cases400: missing required fields / no reference image for image-to-video / invalid model.;401: not logged in.;402: insufficient credits.;500: service configuration or downstream error.

Sample request

curl -X POST https://sora2-api.com/api/v1/image/nano-banana \
  -H "Authorization: Bearer api-key" \
  -F "prompt=A banana cat in a spacesuit on the moon" \
  -F "model=nano-banana-pro" \
  -F "mode=image-to-image" \
  -F "aspectRatio=auto" \
  -F "imageSize=1K" \
  -F "imageFile=@/path/to/ref.png"

Sample response

{
  "data": {
    "id": "task-id-xxx",
    "results": [],
    "progress": 0,
    "status": "running",
    "failure_reason": null,
    "error": null,
    "credits_cost": 20
  }
}

Check result

POST /api/video-generations/check-result to fetch progress and URLs; failed tasks auto-refund.

Method: POSTPath: /api/v1/image/nano-banana/result
Payload: taskId (string). Response fields mirror the generation endpoint; when status=failed, credits are already refunded.
Failure cases400: missing task ID.;401: not logged in.;500: downstream query failure or service error.

Sample request

curl -X POST https://sora2-api.com/api/v1/image/nano-banana/result \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer api-key" \
  -d '{
    "taskId": "task-id-xxx"
  }'

Sample response

{
  "data": {
    "id": "task-id-xxx",
    "results": [
      {
        "url": "https://example.com/generated.png",
        "content": "A banana cat in a spacesuit on the moon"
      }
    ],
    "progress": 100,
    "status": "succeeded",
    "failure_reason": null,
    "error": null
  }
}

Start calling

Call the in-site API with your key. For more details, read /docs.