Skip to main content

Documentation Index

Fetch the complete documentation index at: https://apixo.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Sora 2 is an OpenAI video model for text-to-video and single-image-to-video workflows. Use this page when you are ready to call the API after trying the model in the APIXO playground.
CapabilityValue
Model IDsora-2
Modestext-to-video, image-to-video
Prompt length1-10000 characters
Reference imagesExactly 1 URL for image-to-video
Aspect ratioslandscape, portrait
Durations4, 8, 12 seconds
Output formatMP4 video URLs

Endpoint and authentication

Base URL:
https://api.apixo.ai/api/v1
MethodEndpointPurpose
POST/generateTask/sora-2Submit a generation task
GET/statusTask/sora-2?taskId={taskId}Poll task status and retrieve results
All requests require your APIXO API key:
Authorization: Bearer YOUR_API_KEY
Submit requests also require:
Content-Type: application/json

Copy-paste async quickstart

This minimal request submits a text-to-video task and returns a taskId.
curl -X POST "https://api.apixo.ai/api/v1/generateTask/sora-2" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "text-to-video",
      "prompt": "a cinematic flyover of a futuristic city at sunrise, golden hour lighting, slow camera movement",
      "duration": 12,
      "aspect_ratio": "landscape"
    }
  }'
Successful response:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}
Save the taskId; you need it to poll for the final result.

Poll for result

curl -X GET "https://api.apixo.ai/api/v1/statusTask/sora-2?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
Processing response:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "processing",
    "createTime": 1767965610929
  }
}
Success response:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://r2.apixo.ai/video.mp4\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965932317,
    "costTime": 321388
  }
}
Failed response:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "SensitiveContentDetected",
    "failMsg": "Your content was flagged by OpenAI as violating content policies.",
    "createTime": 1767965610929,
    "completeTime": 1767965630132
  }
}
Parse resultJson after state becomes success:
const payload = JSON.parse(data.resultJson);
const videoUrls = payload.resultUrls;

Request body

Text-to-video

{
  "request_type": "async",
  "input": {
    "mode": "text-to-video",
    "prompt": "a slow aerial shot over a futuristic coastal city at sunset",
    "duration": 12,
    "aspect_ratio": "landscape",
    "remove_watermark": true
  }
}

Image-to-video

{
  "request_type": "async",
  "input": {
    "mode": "image-to-video",
    "prompt": "animate this portrait with a smooth camera push-in and soft cinematic lighting",
    "image_urls": [
      "https://example.com/source.jpg"
    ],
    "duration": 8,
    "aspect_ratio": "portrait",
    "remove_watermark": true
  }
}

Parameters

request_type
string
default:"async"
required
Result delivery mode. Use async for polling with statusTask, or callback for webhook delivery.
callback_url
string
Required when request_type is callback. Must be a public HTTPS URL that can receive the final task payload. See Webhooks.
input
object
required
Sora 2 input parameters.

Response format

Submit task response

POST /generateTask/sora-2 returns a task ID when the task is accepted:
code
integer
API status code. 200 means the task was accepted.
message
string
Human-readable status message.
data.taskId
string
Unique task identifier used with the status endpoint.

Status response fields

taskId
string
Unique task identifier.
state
string
Current task state: pending, processing, success, or failed.
resultJson
string
JSON string containing generated video URLs. Present when state is success.
failCode
string
Machine-readable failure code. Present when state is failed.
failMsg
string
Human-readable failure message. Present when state is failed.
createTime
integer
Task creation timestamp in Unix milliseconds.
completeTime
integer
Task completion timestamp in Unix milliseconds. Present after completion.
costTime
integer
Processing duration in milliseconds. Present after successful completion.

Webhook callback mode

Use callback mode when your backend should receive the final result automatically instead of polling.
curl -X POST "https://api.apixo.ai/api/v1/generateTask/sora-2" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "callback",
    "callback_url": "https://your-server.com/webhooks/apixo",
    "input": {
      "mode": "image-to-video",
      "prompt": "extend this scene into a gentle handheld camera move with realistic ambient motion",
      "image_urls": [
        "https://example.com/source.jpg"
      ],
      "duration": 8,
      "aspect_ratio": "portrait"
    }
  }'
See Webhooks for delivery requirements and retry behavior.

Billing

Sora 2 is billed by generated video duration. The current public APIXO price on the pricing page is $0.09 / second.
DurationAPIXO price
4 seconds$0.36 / video
8 seconds$0.72 / video
12 seconds$1.08 / video
For current route and market comparison pricing, see Pricing.

Latency and polling

Actual latency may vary by prompt complexity, selected route, input image availability, and current queue load.
DurationTypical generation timeRecommended first pollPoll interval
4 seconds2-4 minutes120s after task creation10s
8 seconds3-5 minutes180s after task creation10s
12 seconds4-6 minutes180s after task creation10s
For production video workloads, use callback mode to avoid frequent polling while long-running tasks are queued or rendering.
Rate limits and concurrency can vary by account, API key, and route. If you receive 429, slow down requests and retry with backoff. For account-level details, see System APIs.

Errors and troubleshooting

HTTP errors

CodeMeaningWhat to do
400Invalid request body, mode, parameter, prompt, or image URL shapeFix the request before retrying
401Missing or invalid API keyCheck the Authorization header
402Insufficient balance or quotaAdd balance before retrying
403Key or route cannot access the modelCheck permissions and route strategy
429Rate limit or concurrency limit reachedRetry with exponential backoff
500Server error or unmapped upstream failureRetry with backoff
502Upstream service errorRetry with backoff
504Upstream timeoutRetry or use callback mode for long-running jobs

Task failure codes

Failure codes can vary by selected route. Common values include:
Fail codeMeaningWhat to do
PromptInvalidPrompt was rejected or malformedRewrite the prompt and retry
SensitiveContentPrompt or media failed safety checksChange the prompt or input image
SensitiveContentDetectedUpstream flagged generated or input contentChange the prompt or input image
InputImageSensitiveContentDetectedReference image failed safety checksUse a different public image URL
ImageFormatIncorrectReference image format could not be processedUse a direct JPG, PNG, or WebP image URL
InvalidImageSizeReference image dimensions or size are invalidResize or compress the image
RateLimitedUpstream route was rate limitedRetry with exponential backoff
TimeoutGeneration did not finish in timeRetry, reduce prompt complexity, or use callback mode
Unknown errorUpstream returned an unmapped failureRetry with backoff or contact support with the taskId
See Error Codes for the full error reference.