Skip to content

AI Video

Text-to-video generation with status polling and cancellation.

Overview

Base path: https://api.infrai.cc/v1/video
Auth header: Authorization: Bearer $INFRAI_API_KEY
bash
# Call any /v1/video capability over raw HTTP — no SDK to install.
# curl:
curl https://api.infrai.cc/v1/video/... \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json"

Methods

video.generate

POST /v1/video/generate

Start a text-to-video generation job.

Parameters

NameTypeRequiredDescription
promptstring
Required
Text description of the desired video.
reference_image_urlstringOptionalOptional reference image URL.
duration_secondsnumberOptionalClip duration in seconds.
aspect"16:9" | "9:16" | "1:1"OptionalAspect ratio.
resolution"720p" | "1080p" | "4k"OptionalOutput resolution (720p/1080p/4k); gated per vendor.
prefer"balanced" | "cheapest" | "smartest"OptionalOptimization axis: balanced (best value) | cheapest | smartest.
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

VideoJob { job_id, state, video_url?, thumbnail_url?, error? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/video/generate \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "a timelapse of a city skyline at dusk", "prefer": "balanced", "resolution": "1080p", "duration_seconds": 5, "aspect_ratio": "16:9"}'

video.status

GET /v1/video/status/{id}

Poll the status of a video job.

Parameters

NameTypeRequiredDescription
idstring
Required
The job identifier.

Returns

VideoJob

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/video/status/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

video.cancel

POST /v1/video/cancel/{id}

Cancel a running video job.

Parameters

NameTypeRequiredDescription
idstring
Required
The job identifier.

Returns

{ ok: boolean }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/video/cancel/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"job_id": "..."}'

video.get

GET /v1/video/get/{id}

获取视频任务的完整详情(状态、视频地址、时长、分辨率、厂商、模型等)。

Parameters

NameTypeRequiredDescription
idstring
Required
The job identifier.

Returns

VideoJob { job_id, state, video_url?, thumbnail_url?, duration_seconds, resolution, vendor, model, error? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/video/get/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

video.list

GET /v1/video/list

分页列出当前账户的视频生成任务。

Parameters

NameTypeRequiredDescription
cursorstringOptional分页游标,取自上一页返回的 next_cursor。
limitnumberOptional单页返回的最大任务数。

Returns

VideoJobPage { items: VideoJob[], next_cursor?: string }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/video/list \
  -H "Authorization: Bearer $INFRAI_API_KEY"

video.delete

DELETE /v1/video/delete/{id}

删除指定视频任务及其产物(幂等写)。

Parameters

NameTypeRequiredDescription
idstring
Required
The job identifier.
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

{ ok: boolean }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X DELETE https://api.infrai.cc/v1/video/delete/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

video.delete_all

POST /v1/video/delete_all

批量删除当前账户的全部视频任务及其产物。

Returns

{ deleted: number }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/video/delete_all \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

video.download_url

GET /v1/video/download_url/{id}

为指定视频任务签发带过期时间的临时下载链接。

Parameters

NameTypeRequiredDescription
idstring
Required
The job identifier.

Returns

{ url: string, expires_at: string }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/video/download_url/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

video.set_retention

POST /v1/video/set_retention/{id}

设置单个视频任务的保留窗口(天),上限 90 天。

Parameters

NameTypeRequiredDescription
idstring
Required
The job identifier.
daysnumber
Required
保留窗口天数,正整数,硬上限 90 天。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

{ job_id: string, retention_days: number, expires_at: string }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/video/set_retention/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"job_id": "...", "days": 0}'

video.capabilities

GET /v1/video/capabilities

查询各视频厂商支持的模型、分辨率、最大时长及扩展/超分能力。

Returns

VideoCapabilities { vendors: Array<{ vendor, models, resolutions, max_duration_seconds, supports_extend, supports_upscale }> }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/video/capabilities \
  -H "Authorization: Bearer $INFRAI_API_KEY"

All capabilities

Every routed capability in this module — the complete public REST contract. The methods above are the guided walkthrough; this index is the full reference.

CapabilityEndpointDescription
video.cancelPOST /v1/video/cancel/{id}Cancel an in-progress video generation job.
video.capabilitiesGET /v1/video/capabilitiesQuery each video provider's supported models, resolutions, max duration, and extend/upscale capabilities.
video.deleteDELETE /v1/video/delete/{id}Delete a video job and its artifacts (idempotent write).
video.delete_allPOST /v1/video/delete_allBulk-delete all video jobs and their artifacts for the current account.
video.download_urlGET /v1/video/download_url/{id}Issue a time-limited, expiring download URL for a video job's output.
video.generatePOST /v1/video/generateGenerate a video from a text or image prompt asynchronously (idempotent).
video.getGET /v1/video/get/{id}Retrieve a video job's full details (status, video URL, duration, resolution, provider, model).
video.listGET /v1/video/listList the current account's video generation jobs with pagination.
video.set_retentionPOST /v1/video/set_retention/{id}Set a video job's retention window in days, up to a 90-day maximum.
video.statusGET /v1/video/status/{id}Query a video generation job's status and output URL.

End-to-end example

A production-style walkthrough of this module: configure once, then run the flow. It exercises most of the module's APIs.

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
# 1) Auth: every call is a raw HTTPS request to the Infrai gateway carrying
#    only your project key. No SDK, no install.
#    Get your key: sign in with Google/GitHub at the console for a project key
#    + $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
#    POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."   # from the console


# 2) video.generate
curl -X POST https://api.infrai.cc/v1/video/generate \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "a timelapse of a city skyline at dusk", "prefer": "balanced", "resolution": "1080p", "duration_seconds": 5, "aspect_ratio": "16:9"}'

# 3) video.status
curl -X GET https://api.infrai.cc/v1/video/status/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

# 4) video.cancel
curl -X POST https://api.infrai.cc/v1/video/cancel/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"job_id": "..."}'

# 5) video.get
curl -X GET https://api.infrai.cc/v1/video/get/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

# 6) video.list
curl -X GET https://api.infrai.cc/v1/video/list \
  -H "Authorization: Bearer $INFRAI_API_KEY"

# 7) video.delete
curl -X DELETE https://api.infrai.cc/v1/video/delete/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

# 8) video.delete_all
curl -X POST https://api.infrai.cc/v1/video/delete_all \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

# 9) video.download_url
curl -X GET https://api.infrai.cc/v1/video/download_url/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"