API Reference

The request, configuration, and response models shared by the REST API and the Python client.

These models define the generation request body, its configuration objects, and the status response. They are identical across the REST API and the Python client.

TaskInput

The JSON body of POST /api/v0/generate (and the argument to the client's submit_task). model and task_type are required; the rest depend on the task type.

How is size determined?

For image/video sizing config, VideoConfig and ImageConfig take 3 optional params: width, height and aspect_ratio. The following strategy will be followed:

  1. If both width and height are specified, they take precedence over aspect_ratio.
  2. If aspect_ratio is missing, for image it defaults to 1:1 and for video it defaults to 16:9.
  3. If only height is specified, the width will be calculated based on aspect_ratio (and rounded up if needed).
  4. Other cases are considered invalid and rejected.

Some models accept only a fixed set of explicit width×height sizes and do not use the height + aspect_ratio derivation above; for those, pass one of the model's supported sizes. height is required for all documented image and video task types.

FieldTypeRequiredDefaultDescription
promptstrYes-Text prompt driving generation.
enhance_promptbool-FalseWhether prompt enhancement should be enabled. Enabling this would slow down generation.
multi_promptlist[str] | None-NonePer-shot prompts for multi-shot passthrough vendors; length must match src_image_urls when used as reference frames. This is only supported/needed for Kling-v3 R2V.
modelstrYes-Model id, e.g. 'Wan2.2-A14B', 'Kling-v3'.
task_typestrYes-one of T2I, I2I, T2V, I2V, R2V
moderatebool-TrueWhether this request is screened by content moderation.
video_configVideoConfig | None-NoneRequired for video task types.
image_configImageConfig | None-NoneRequired for image task types.
seedint | None-NoneSeed for reproducible generation. If not specified, a random seed will be used.
src_image_urlslist[str] | None-NoneSource / reference image URLs. Only needed for tasks that require input images like I2I, I2V, R2V. Refer to the API docs for concrete examples of how to use this and what inputs are allowed. For image to video tasks, this can optionally specify 1 (first frame) or 2 (first & last frames) input images.
subject_to_image_idsdict[str, list[int]] | None-NoneR2V only: maps a subject name to the indices of its reference images in src_image_urls, e.g. {'alice': [0, 1], 'bob': [2]}. The prompt may address a subject via '@name'. Honored by vendors with named subjects (Vidu reference2video).

VideoConfig

Required for video task types (T2V, I2V, R2V).

FieldTypeRequiredDefaultDescription
fpsint | None-NoneVideo frames per second. If omitted the default FPS would be used based on the model.
duration_secsintYes-Video duration in seconds.
heightint | None-NoneOutput height in pixels. Required for generation (a missing height is rejected at submit).
widthint | None-NoneOutput width in pixels.
aspect_ratiostr | None-NoneOutput aspect ratio. The default is 16:9 if omitted. The width of the output will be updated to match the height based on the aspect ratio, rounded up to the nearest integer.
infer_stepsint | None-NoneNumber of denoising / inference steps. Higher values trade more compute for potentially finer detail. This is a best-effort match: if the model does not support it the model default is used.
audiobool | None-NoneWhether the video should include audio. Note: some models do not support audio, or the audio is always on (e.g. Veo 3.1). In those cases this field has no effect.
guidance_scalelist[float] | None-NoneClassifier-free guidance scale(s). Controls how strongly the output adheres to the prompt: higher values follow the prompt more closely at the cost of diversity. If the model supports multiple guidance scales, these will be applied in a sequence (e.g. per stage or per denoising phase). This is a best-effort match: if the model does not support it, or does not support the number of scales provided, the model default is used.

ImageConfig

Required for image task types (T2I, I2I).

FieldTypeRequiredDefaultDescription
heightint | None-NoneOutput height in pixels. Required for generation (a missing height is rejected at submit).
widthint | None-NoneOutput width in pixels.
aspect_ratiostr | None-NoneOutput aspect ratio. The default is 1:1 if omitted. The width of the output will be updated to match the height based on the aspect ratio, rounded up to the nearest integer.
infer_stepsint | None-NoneNumber of denoising / inference steps. Higher values trade more compute for potentially finer detail. This is a best-effort match: if the model does not support it the model default is used.
guidance_scalelist[float] | None-NoneClassifier-free guidance scale(s). Controls how strongly the output adheres to the prompt: higher values follow the prompt more closely at the cost of diversity. If the model supports multiple guidance scales, these will be applied in a sequence (e.g. per stage or per denoising phase). This is a best-effort match: if the model does not support it, or does not support the number of scales provided, the model default is used.

TaskStatusResponse

Returned by GET /api/v0/tasks/{task_id} (and by the client's get_task_state and wait).

FieldTypeRequiredDefaultDescription
task_idstrYes-Server-assigned id; poll status and download the asset with it.
metadataTaskMetadataYes-Echo of the resolved task parameters.
task_outputdict[TaskOutputType, str] | None-NonePer output-type asset locators, as they become available.
moderationModerationResult | None-NoneStructured moderation verdict when the task failed or was blocked by moderation.
statusTaskStatusYes-Current task status.
error_msgstr | None-NoneFailure reason, set when status is FAILED.
generation_time_secsfloat | None-NoneTime spent on actual generation.
upload_time_secsfloat | None-NoneTime spent uploading the asset after generation.
queue_time_secsfloat | None-NoneTime spent waiting in the queue for generation to begin.
execution_providerstr | None-NoneActual provider of the terminal execution trial.
overflow_convertedbool-FalseWhether long queuing moved this task off self-hosted capacity to an on-demand provider. Readable before the task finishes.