AI Video API

Build on top of the AI Video API

Ship text-to-video experiences backed by OpenAI Sora 2, Sora Pro, and Sora 2 Stable. Authenticate with API keys, poll task status, and deliver final videos in minutes.

Why teams rely on the AI Video API

Deliver resilient video generation workflows with predictable polling, 20 concurrent requests, and automatic storage uploads.

Model variants

Pick the model string that matches your quality and cost needs: sora-2, sora-2-pro, or sora-2-stable (10s/15s via duration).

Predictable polling

Create a task, then poll the check-result endpoint to keep status and progress in sync without SSE.

20 concurrent requests

Process up to 20 video generation tasks simultaneously. Contact us for higher limits.

Authentication & Base URL

All endpoints live under https://freesoragenerator.com/api. Supply the API key created in the console via the Authorization header.

  • Send the header Authorization: Bearer YOUR_API_KEY with every request.
  • Use Content-Type: application/json when posting payloads.
  • Each generation request deducts 100/150 credits for Sora 2 or Sora 2 Stable 10s/15s, 375/675 credits for Sora 2 Pro 10s/15s, or 375/675/875 credits for storyboard 10s/15s/25s; failed jobs are refunded automatically.

Core endpoints

Start by creating a generation task, then poll or listen for the result.

Create Sora 2 video

Kick off a Sora 2, Sora Pro, or Sora 2 Stable generation job with text-to-video or image-to-video prompts.

Method: POSTPath: /api/v1/video/sora-video

Payload parameters

  • model: Required. Use "sora-2", "sora-2-pro", or "sora-2-stable" to target the model variant you need.
  • prompt: Required. Natural language description of the scene you want Sora to create.
  • imageData: Optional (recommended). Base64 data URL with prefix "data:image/*;base64," for image-to-video mode.
  • url: Optional. Legacy reference image URL; still supported but lower priority than imageData.
  • aspectRatio: Optional. Supported values: "9:16" (default) or "16:9".
  • duration: Optional. Only for "sora-2-stable"; choose 10 or 15 seconds (default 10).
  • isPublic: Optional. Whether to display the video publicly; default is true.
  • remixTargetId: Optional (VIP only). Target video pid for continuation/remix features.
  • characters: Optional (VIP only). Character control array; each item includes url and timestamps.

Notes

  • Responses return immediately with a taskId; poll check-result until status is succeeded or failed.

Sample request

curl -X POST https://freesoragenerator.com/api/v1/video/sora-video \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sora-2-stable",
    "prompt": "A cinematic shot of a futuristic city at sunset, captured in 4K.",
    "imageData": "data:image/png;base64,iVBORw0KGgoAAA...",
    "aspectRatio": "9:16",
    "duration": 15,
    "isPublic": true
  }'

Sample response

{
  "code": 0,
  "message": "ok",
  "data": {
    "id": "task_1234567890"
  }
}

Check generation result

Poll the latest status for a generation task to track progress and retrieve results.

Method: POSTPath: /api/video-generations/check-result

Payload parameters

  • taskId: Required. The identifier returned when you created the generation task.

Notes

  • The endpoint verifies the task belongs to your account before returning data.
  • Failed jobs return credits automatically and expose refund metadata in the response.

Sample request

curl -X POST https://freesoragenerator.com/api/video-generations/check-result \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "taskId": "task_1234567890"
  }'

Sample response

{
  "code": 0,
  "message": "Success",
  "data": {
    "status": "running",
    "progress": 35,
    "result_url": "https://your-domain.com/storage/videos/xxx.mp4",
    "result_urls": [
      "https://your-domain.com/storage/videos/xxx.mp4"
    ],
    "failure_reason": "",
    "error_message": null,
    "credits_refunded": false,
    "refund_trans_no": null,
    "result_pid": "s_xxx",
    "result_pids": [
      "s_xxx"
    ],
    "metadata": {
      "remixTargetId": "s_prev",
      "characters": [
        {
          "url": "https://.../hero.mp4",
          "timestamps": "0,3"
        }
      ]
    }
  }
}

Get user credits and VIP status

Query current user's available credits and VIP membership status.

Method: POSTPath: /api/get-user-credits

Notes

  • Requires valid login session or API token to access user information.
  • Returns left_credits, is_recharged, is_pro, and is_vip status fields.

Sample request

curl -X POST https://freesoragenerator.com/api/get-user-credits \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

Sample response

{
  "code": 0,
  "message": "ok",
  "data": {
    "left_credits": 120,
    "is_recharged": true,
    "is_pro": true,
    "is_vip": false
  }
}

1. Create the task

Send the AI Video API request with your prompt, then store the returned taskId.

2. Track progress

Call the check-result endpoint until the status becomes succeeded or failed.

3. Deliver the video

Use the storage-backed URLs in result_url/result_urls to serve or download the generated video.

Frequently asked questions

How do I authenticate my requests?

Create an API key in the console, then include it as Authorization: Bearer YOUR_API_KEY. Keys can be rotated at any time.

How should I poll for results?

After calling create, store the taskId. Call /api/video-generations/check-result every 3-5 seconds until status is succeeded or failed, then use result_url/result_urls.

How are credits handled for failures?

We automatically refund credits when a task fails and return refund_trans_no plus credits_refunded=true in the check-result payload for audit trails.

Helpful resources

Launch with AI Video API today

Create your API key and start generating cinematic AI videos in minutes.