Platform notice: all DeepSeek models are now live. New users receive trial credits on sign-up.
Api reference

Video Generation

Async video task API: submit a task, poll progress, cancel — billed per call or per second with a hold.

Submit a task

POST /api/v1/videos
  • Auth: header Authorization: Bearer sk-tp-... (create an API Key in the console)
  • Content-Type: application/json

Request body

ParameterTypeRequiredDescription
modelstringYesPlatform video model name, see Models
promptstringYesGeneration prompt, must not be empty
durationnumberDependsRequired for per-second models (duration or seconds), 1-600 seconds, rounded up, defaults to 5
quantitynumberDependsNumber of videos for per-call models, positive integer, defaults to 1
resolutionstringNoResolution preference: 480p / 720p / 1080p / 4k; mapped to the vendor's field when needed (e.g. Kling mode), explicit mode wins
seednumberNoRandom seed; only some upstream models support it, ignored otherwise
watermarkbooleanNoWatermark toggle, upstream default when omitted; mapped to Kling watermark_info.flag
mediaarrayNoFirst / middle / last frame plus reference image / video / audio, see Media
vendorOptionsobjectNoVendor-native passthrough: key-values submitted as-is to the upstream protocol (e.g. camera_control); cannot override core fields like model / prompt / duration / callback_url / external_task_id
Other params-NonegativePrompt, multiShot, mode, etc. are passed through per model

Media (first / middle / last frame + references)

The media array describes frame control and reference assets in one place; the platform maps it to the upstream fields of the model's protocol.

FieldTypeRequiredDescription
media[].rolestringYesfirst_frame / middle_frame / last_frame / reference_image / reference_video / reference_audio; type is also accepted
media[].urlstringYesAsset URL; image_url.url / video_url.url / audio_url.url are also accepted
{
  "model": "doubao-seedance-2-5-260628",
  "prompt": "the person in image 1 talks in the scene of image 2",
  "duration": 5,
  "media": [
    { "role": "first_frame", "url": "https://example.com/first.png" },
    { "role": "reference_image", "url": "https://example.com/ref.jpg" },
    { "role": "reference_audio", "url": "https://example.com/voice.mp3" }
  ]
}

Roles supported per protocol:

ProtocolSupported rolesNotes
seedance (Volcengine Ark / haoee seedance family)All 6First/last frames and references are mutually exclusive; asset count limits are enforced upstream
Wan / HappyHorse (DashScope)All 6Same as above; array order is the "image 1 / video 1 / audio 1" order used in the prompt
MiniMax (hailuo family)first_frame / last_frameReferences not supported yet
Kling (native / Omni)NoneThe unified media array is unavailable; use vendorOptions to pass upstream-native fields

Notes:

  • Middle frame: no upstream has a native middle-frame field today, so the platform maps middle frames to keyframe reference images (reference_image) in order; refer to them as "image 1 … image N" in the prompt. Kling and MiniMax protocols do not support middle frames.
  • A role the model does not support returns 400 at submit time; no task is created and nothing is held.
  • The legacy single-field forms (image_url / first_frame_image / last_frame_image) keep working.

Optional header

HeaderDescription
Idempotency-KeyIdempotency key. Re-submitting with the same key returns the original task — no duplicate task or hold is created

Response

Returns a platform task object. Only the platform task ID is exposed; upstream task IDs are never revealed:

{
  "id": "task id",
  "status": "pending",
  "progress": 0,
  "model": "model name",
  "result": null,
  "error": null,
  "createdAt": "2026-01-01T00:00:00.000Z",
  "finishedAt": null
}
curl https://api.openruler.ai/api/v1/videos \
  -H "Authorization: Bearer sk-tp-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "video-model-name",
    "prompt": "a cat running on the grass",
    "duration": 5
  }'

Query a task

GET /api/v1/videos/{id}

Returns the task object, same structure as above. When the task succeeds, result.url is the video download URL. It is provided by the upstream provider and is usually valid for 24 hours; download and store it promptly. Expired URLs cannot be regenerated.

curl https://api.openruler.ai/api/v1/videos/{id} \
  -H "Authorization: Bearer sk-tp-your-key"

Cancel a task

POST /api/v1/videos/{id}/cancel

Only in-progress tasks (pending / submitted / running) can be canceled; calling cancel on a finished task returns it as-is without error.

Task statuses

StatusDescription
pendingCreated, waiting to be submitted upstream
submittedSubmitted upstream, waiting for generation
runningGenerating; progress is the percentage
succeededDone; result.url is the video URL
failedFailed; error.code / error.message give the reason
timeoutTask timed out
canceledCanceled

Billing

  • On successful submission the platform holds an amount of unit price × quantity (per call) or duration in seconds (per second). Held funds count against available balance but produce no billing ledger entry yet.
  • On success the hold is settled into a real charge and written to the billing ledger; on failure, timeout, or cancellation the hold is released at no cost.
  • Per-second models: duration is rounded up to billed seconds, 1-600 seconds.
  • Per-token models (seedance): outputPrice is CNY per million tokens. On submit, an estimate from resolution × duration is held (with 10% headroom); after success, settlement uses the upstream's actual token usage, and any difference is automatically refunded to your balance.

Pre-checks

The platform validates in order; any failure returns the corresponding error:

  1. Key valid and not revoked (including all parents), account active → otherwise 401
  2. Model exists and is live (LIVE), priced per call/second with a unit price, and has a usable upstream route → otherwise 400
  3. prompt not empty, duration (per-second models) within 1-600 seconds → otherwise 400
  4. media well-formed and every role supported by the model's protocol → otherwise 400
  5. Available balance (balance minus holds) covers this hold → otherwise 402
  6. Key chain quota not exhausted → otherwise 402

Notes

  • Tasks are bound to the API Key that created them: query and cancel must use the same Key.
  • The platform polls upstream progress automatically; no need to resubmit repeatedly. A 5-10 second polling interval is recommended.
  • If an upstream channel is degraded due to credit exhaustion, 503 is returned; the platform does not automatically switch vendors.

Errors

For error response format and troubleshooting see FAQ · Error codes. Upstream model errors are reported in normalized form via the task's error field.

On this page

OpenRuler