Generate a video with a frontier AI model. Provide first_frame (optionally end_frame) for image-to-video, refs for multimodal text-to-video, or neither for pure text-to-video. Credits are charged on submission and refunded automatically if generation fails; poll GET /api/v1/ai_video for progress.
Beta: available to any account with an active paid subscription. Per-key concurrency is limited during beta; submissions beyond the limit are rejected rather than queued.
Headers
X-API-KeystringrequiredYour VisionStory API key (sk-vs-...), kept server-side. Create or manage keys in API keys (Pro plan and up).
Request body
application/jsonrequiredaspect_ratiostring | nullnullableAspect ratio such as 16:9 / 9:16 / 1:1, or adaptive to let the model follow the input material. Allowed values vary by model; defaults to the model default. wan-3.0 always follows the references when refs is set, so passing both is a 400.
client_request_idstring | nullnullableOptional idempotency key. Resubmitting with the same value within 24h returns the original task instead of creating (and charging) a new one. Safe for retries.
duration_secinteger | nullnullableClip length in seconds. Allowed values vary by model (see GET /api/v1/ai_video/models); defaults to the model default. Longer clips cost more credits.
end_frameMediaRef | nullnullableA media reference — provide exactly one of: asset_id (from the asset library, reusable across
requests), url (one-off public URL), or inline_data (one-off base64, not stored).
asset_idstring | nullnullableAsset ID from POST /api/v1/asset; use for materials reused across requests.
inline_dataInlineDataModel | nullnullableInline base64 media data for one-off use; not added to your asset library. Images: image/jpeg, image/jpg, image/png, image/webp, image/bmp, image/tiff, image/gif; audio: audio/wav, audio/x-wav, audio/wave, audio/mpeg, audio/mp3; video: video/mp4, video/quicktime, video/mov.
datastringrequiredThe file's raw bytes encoded as a base64 string (no data: URI prefix).
mime_typestringrequiredMIME type of the inline data; the gateway uses it to tell image / audio / video apart. The accepted set depends on the endpoint — see the field carrying this object. Talking video accepts audio ['audio/avi', 'audio/mpeg', 'audio/mp3', 'audio/mp4', 'audio/m4a', 'audio/wav'] and images ['image/jpeg', 'image/jpg', 'image/png', 'image/webp', 'image/heic'].
urlstring | nullnullablePublicly accessible media URL for one-off use; not added to your asset library.
first_frameMediaRef | nullnullableA media reference — provide exactly one of: asset_id (from the asset library, reusable across
requests), url (one-off public URL), or inline_data (one-off base64, not stored).
asset_idstring | nullnullableAsset ID from POST /api/v1/asset; use for materials reused across requests.
inline_dataInlineDataModel | nullnullableInline base64 media data for one-off use; not added to your asset library. Images: image/jpeg, image/jpg, image/png, image/webp, image/bmp, image/tiff, image/gif; audio: audio/wav, audio/x-wav, audio/wave, audio/mpeg, audio/mp3; video: video/mp4, video/quicktime, video/mov.
datastringrequiredThe file's raw bytes encoded as a base64 string (no data: URI prefix).
mime_typestringrequiredMIME type of the inline data; the gateway uses it to tell image / audio / video apart. The accepted set depends on the endpoint — see the field carrying this object. Talking video accepts audio ['audio/avi', 'audio/mpeg', 'audio/mp3', 'audio/mp4', 'audio/m4a', 'audio/wav'] and images ['image/jpeg', 'image/jpg', 'image/png', 'image/webp', 'image/heic'].
urlstring | nullnullablePublicly accessible media URL for one-off use; not added to your asset library.
generate_audioboolean | nullnullableWhether to generate a native audio track; defaults to true on every model and never changes the price. kling-3.0-omni cannot combine it with a video reference (400).
model_idstringrequiredModel to generate with. Use an id from GET /api/v1/ai_video/models, e.g. seedance-2.0.
promptstringrequiredText description of the video to generate. For image-to-video it describes the motion applied to first_frame.
refsMediaRef[] | nullnullableMultimodal reference materials (image/video/audio) that guide text-to-video. Only models whose refs.max is greater than 0 in GET /api/v1/ai_video/models accept it; refs.max_per_kind and refs.total_duration_sec_max there give the per-type limits. References never change the price. Mutually exclusive with first_frame.
asset_idstring | nullnullableAsset ID from POST /api/v1/asset; use for materials reused across requests.
inline_dataInlineDataModel | nullnullableInline base64 media data for one-off use; not added to your asset library. Images: image/jpeg, image/jpg, image/png, image/webp, image/bmp, image/tiff, image/gif; audio: audio/wav, audio/x-wav, audio/wave, audio/mpeg, audio/mp3; video: video/mp4, video/quicktime, video/mov.
datastringrequiredThe file's raw bytes encoded as a base64 string (no data: URI prefix).
mime_typestringrequiredMIME type of the inline data; the gateway uses it to tell image / audio / video apart. The accepted set depends on the endpoint — see the field carrying this object. Talking video accepts audio ['audio/avi', 'audio/mpeg', 'audio/mp3', 'audio/mp4', 'audio/m4a', 'audio/wav'] and images ['image/jpeg', 'image/jpg', 'image/png', 'image/webp', 'image/heic'].
urlstring | nullnullablePublicly accessible media URL for one-off use; not added to your asset library.
resolutionstring | nullnullableOutput resolution such as 480p / 720p / 1080p / 4k. Allowed values vary by model (4K is kling-3.0 only; 480p is available on every Seedance and Wan model but not on Kling); defaults to the model default — kling-3.0-omni is the only model that defaults to 1080p, every other model defaults to 720p. Higher resolutions cost more credits.
Responses
200Successful Response
application/json
dataCreateAiVideoResponse | nullrequirednullableThe endpoint-specific payload. See this endpoint's response schema for its fields; null only when the operation returns no payload.
cost_creditintegerCredits charged for this task on submission; auto-refunded if generation fails.
statusstringInitial task status; always queued right after creation.
video_idstringrequiredIdentifier of the created task. Poll GET /api/v1/ai_video with it to track progress.
messagestringHuman-readable status message; "success" on a successful call.
server_timestring · date-timerequiredServer-side timestamp when the response was produced, in ISO 8601 format (UTC).
defaultError response. All failures share one envelope: an error object with a numeric code, a human-readable message, an optional details string, and an optional hint giving an actionable next step (useful for AI agents).
application/json
errorErrorDetailrequiredcodeintegerrequiredMachine-readable error code. Mirrors the HTTP status for transport-level failures (e.g. 401, 404, 422, 500) and may carry a business-specific code otherwise.
detailsstring | nullnullableOptional structured detail about the failure, e.g. a JSON string of per-field validation errors on a 422. Absent when there is nothing extra to report.
hintstring | nullnullableActionable next step for resolving the error, written for both humans and AI agents (e.g. how to fix the request, or where to obtain an API key). May be absent.
messagestringrequiredHuman-readable explanation of what went wrong. Safe to log or surface to end users; not localized.