Перейти к основному содержанию

Endpoints

MethodEndpointDescription
POST/api/v1/generateTask/sora-2-proСоздание задачи генерации
GET/api/v1/statusTask/sora-2-proЗапрос статуса задачи

Authentication

Все запросы требуют API Key в заголовке:
Authorization: Bearer YOUR_API_KEY

Request Body

{
  "request_type": "async",
  "callback_url": "https://...",
  "provider": "official",
  "input": {
    "mode": "text-to-video",
    "prompt": "...",
    "duration": 8,
    "size": "720*1280"
  }
}

Parameters

request_type
string
по умолчанию:"async"
async (polling) или callback (webhook)
callback_url
string
Callback URL, обязателен при request_type=callback (условно)
provider
string
по умолчанию:"official"
Routing strategy. Only official is supported; always set provider=official explicitly.
input
object
обязательно
Параметры входа модели
Mode Options:
  • text-to-video — Generate video from text prompt
  • image-to-video — Generate video from reference image

Example

Text-to-Video
curl -X POST "https://api.apixo.ai/api/v1/generateTask/sora-2-pro" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "provider": "official",
    "input": {
      "mode": "text-to-video",
      "prompt": "a cinematic tracking shot of a futuristic city with flying cars",
      "duration": 8,
      "size": "1280*720"
    }
  }'
Image-to-Video
curl -X POST "https://api.apixo.ai/api/v1/generateTask/sora-2-pro" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "callback",
    "callback_url": "https://your-server.com/callback",
    "provider": "official",
    "input": {
      "mode": "image-to-video",
      "prompt": "make this image come alive with subtle motion",
      "duration": 12,
      "resolution": "1080p",
      "image_urls": [
        "https://example.com/reference_image.jpg"
      ]
    }
  }'

Response

POST /api/v1/generateTask/sora-2-pro

При успехе возвращает taskId для последующих запросов статуса. Success:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}
Error:
{
  "code": 400,
  "message": "Insufficient credits",
  "data": null
}
{
  "code": 400,
  "message": "Content violates provider policy, please adjust the prompt",
  "data": null
}

GET /api/v1/statusTask/sora-2-pro

Запрос статуса выполнения задачи и результатов по taskId.
curl -X GET "https://api.apixo.ai/api/v1/statusTask/sora-2-pro?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
Success:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://r2.apixo.ai/video.mp4\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965730929,
    "costTime": 120000
  }
}
Failed:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "CONTENT_VIOLATION",
    "failMsg": "Content does not meet safety guidelines"
  }
}

Status Response Fields

taskId
string
Уникальный идентификатор задачи.
state
string
Текущее состояние задачи: pending, processing, success или failed.
resultJson
string
JSON-строка с массивом resultUrls. Присутствует только при success. Парсите через JSON.parse().
failCode
string
Код ошибки. Присутствует только при state=failed. См. Error Codes.
failMsg
string
Читаемое сообщение об ошибке. Присутствует только при state=failed.
createTime
integer
Timestamp создания задачи (Unix миллисекунды).
completeTime
integer
Timestamp завершения задачи (Unix миллисекунды).
costTime
integer
Длительность обработки в миллисекундах.

Error Codes

CodeDescription
400Неверные параметры или ошибка запроса
401Недействительный или отсутствующий API Key
429Превышен лимит запросов
Fail CodeDescription
CONTENT_VIOLATIONКонтент нарушает правила безопасности
INVALID_IMAGE_URLНе удаётся получить доступ к URL изображения

Rate Limits

LimitValue
Requests60 / minute
Concurrent tasks10
При превышении возвращается ошибка 429. Подождите и повторите.

Tips

  • Generation time: Average ~3 minutes per video. Submit task, wait 120 seconds, then poll every 5 seconds.
  • Routing recommendation: Always include provider=official explicitly in request body.
  • Callback mode: Due to long generation times, strongly recommend using callback mode.
  • Video expiration: Result URLs are valid for 15 days. Download promptly.
  • Content moderation: Prompts must comply with content safety guidelines. Violations return CONTENT_VIOLATION.
  • Image formats: image_urls supports JPG, PNG, WebP, max 10MB per image.
  • Duration options: Use 4, 8, or 12 seconds depending on preview vs final output needs.
  • Official route duration policy: Under provider=official, duration values should be explicitly set to 4, 8, or 12.
  • Size vs Resolution:
    • size is used in text-to-video mode: 720*1280 (portrait), 1280*720 (landscape), 1024*1792, 1792*1024
    • resolution is used in image-to-video mode: 720p or 1080p

Video generation takes longer than images — use callback mode for production workloads. Result URLs expire after 15 days; download important outputs promptly.