Разделы документации

Документация / API

Видео

Асинхронная генерация видео: создать задачу, узнать статус, забрать файл.

Модели видео →

Три шага

  1. POST /v1/videos — создать задачу. Резерв — по длительности и размеру кадра, а если они не заданы, по наибольшим, которые допускает модель.
  2. GET /v1/videos/{id} — опрашивать, пока статус не станет completed или failed. Если в ответе error: billing_review, списание по задаче ушло на ручную проверку: статус может оставаться in_progress до суток, опрашивать можно реже.
  3. GET /v1/videos/{id}/content — забрать файл. Он хранится у провайдера ограниченное время; после этого — 410.

Ответы видео не содержат usage: стоимость списывается после генерации, её видно в кабинете.

POST/v1/videos

Start a video generation

Asynchronous: returns a job to poll at polling_url. The reserve is taken by the duration and frame size (the model's maximum when not set). callback_url, upscale_factor and provider are refused with 400.

Ключ: заголовок Authorization: Bearer <ключ>. Как получить ключ →

Тело запроса

application/json

  • aspect_ratiostring
  • durationinteger

    Seconds; the model's maximum when not set.

    Не меньше 1.

  • frame_imagesarray of object
  • input_referencesarray of object
  • modelstringобязательное
  • promptstring
  • resolutionstring
  • sizestring

    WIDTHxHEIGHT; the model's largest frame when not set.

  • Остальные поля формата OpenRouter передаются модели без изменений.

Пример запроса

{
  "duration": 8,
  "model": "google/veo-3.1-fast",
  "prompt": "A paper boat on a river",
  "size": "1280x720"
}

Ответ 202

Job accepted.

  • idstringобязательное
  • polling_urlstringобязательное
  • statusstringобязательное

    The provider's status of the new job; pending when it reported none.

Пример ответа

{
  "id": "video_trace_abc",
  "polling_url": "https://api.aireplica.ru/v1/videos/video_trace_abc",
  "status": "pending"
}

Ошибки

  • 400The request is invalid or its cost cannot be bounded in advance. Nothing is charged.
  • 401Missing or invalid API key.
  • 402The balance does not cover the reserve of this request.
  • 403The input was flagged by moderation; metadata.reasons lists why.
  • 404The model provider rejected the request (its status is kept: 400, 404, 413 or 422); metadata.provider_message, when present, is the provider's explanation.
  • 413The model provider rejected the request (its status is kept: 400, 404, 413 or 422); metadata.provider_message, when present, is the provider's explanation.
  • 422The model provider rejected the request (its status is kept: 400, 404, 413 or 422); metadata.provider_message, when present, is the provider's explanation.
  • 429Too many requests, or the model provider is busy. Retry-After, when present, says when to retry.
  • 502The model provider failed or returned an error.
  • 503Billing or the model provider is temporarily unavailable.

Формат тела ошибки и что делать — Лимиты и ошибки.

GET/v1/videos/{id}

Get a video job

Ключ: заголовок Authorization: Bearer <ключ>. Как получить ключ →

Параметры пути

  • idstringобязательныйJob id from POST /videos.

Ответ 200

Job status; content_url appears when the video is ready.

  • content_urlstring
  • errorstring

    generation_failed — the provider produced no video, the reserve is returned; provider_unavailable — polling the provider fails, the job is retried; billing_review — an operator decides the charge.

    Значения: generation_failed, provider_unavailable, billing_review

  • idstringобязательное
  • polling_urlstringобязательное
  • statusstringобязательное

    Значения: in_progress, completed, failed

Пример ответа

{
  "content_url": "https://api.aireplica.ru/v1/videos/video_trace_abc/content",
  "id": "video_trace_abc",
  "polling_url": "https://api.aireplica.ru/v1/videos/video_trace_abc",
  "status": "completed"
}

Ошибки

  • 401Missing or invalid API key.
  • 404No such object for this account.
  • 502The model provider failed or returned an error.

Формат тела ошибки и что делать — Лимиты и ошибки.

GET/v1/videos/{id}/content

Download a generated video

Ключ: заголовок Authorization: Bearer <ключ>. Как получить ключ →

Параметры пути

  • idstringобязательныйJob id from POST /videos.

Параметры строки запроса

  • indexintegerWhich video of the job to download when the model produced several; 0 is the first.Не меньше 0. По умолчанию: 0.

Ответ 200

Video bytes.

Ошибки

  • 400The request is invalid or its cost cannot be bounded in advance. Nothing is charged.
  • 401Missing or invalid API key.
  • 404No such object for this account.
  • 409The video is still being generated.
  • 410The video was generated but the provider no longer stores it.
  • 502The model provider failed or returned an error.

Формат тела ошибки и что делать — Лимиты и ошибки.