Skip to main content

VideoModel

Trait VideoModel 

Source
pub trait VideoModel: Send + Sync {
    // Required methods
    fn provider(&self) -> &str;
    fn model_id(&self) -> &str;
    fn max_videos_per_call(&self) -> Option<u32>;
    fn do_start<'life0, 'life1, 'async_trait>(
        &'life0 self,
        options: &'life1 VideoCallOptions,
    ) -> Pin<Box<dyn Future<Output = Result<VideoOperationStart, AiMuxError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn do_status<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        operation: &'life1 Value,
        options: &'life2 VideoCallOptions,
    ) -> Pin<Box<dyn Future<Output = Result<VideoOperationStatus, AiMuxError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided methods
    fn specification_version(&self) -> &'static str { ... }
    fn retry_config(&self) -> RetryConfig { ... }
    fn poll_config(&self) -> VideoPollConfig { ... }
}
Expand description

The unified video generation model trait (provider-facing).

Aligned with V4 VideoModelV4’s asynchronous doStart/doStatus flow. Every current provider API is task-based (create, then poll), so the synchronous doGenerate arm is not offered: the polling loop lives in generate_video, and each phase is retried independently against the same operation reference.

Required Methods§

Source

fn provider(&self) -> &str

Provider name, e.g. "fal".

Source

fn model_id(&self) -> &str

Provider-specific model ID, e.g. "kling-video".

Source

fn max_videos_per_call(&self) -> Option<u32>

Limit of how many videos can be generated in a single API call.

None means no fixed limit. Most video models only support 1.

Source

fn do_start<'life0, 'life1, 'async_trait>( &'life0 self, options: &'life1 VideoCallOptions, ) -> Pin<Box<dyn Future<Output = Result<VideoOperationStart, AiMuxError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Start an asynchronous video generation and return an opaque operation reference for Self::do_status.

Naming: the do_ prefix prevents accidental direct usage by users.

Source

fn do_status<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, operation: &'life1 Value, options: &'life2 VideoCallOptions, ) -> Pin<Box<dyn Future<Output = Result<VideoOperationStatus, AiMuxError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Check the status of a generation started with Self::do_start.

A task that failed server-side should be reported as a non-retryable Err, not Pending, so the poll loop stops immediately.

Provided Methods§

Source

fn specification_version(&self) -> &'static str

Specification version (always "v4").

Source

fn retry_config(&self) -> RetryConfig

Source

fn poll_config(&self) -> VideoPollConfig

Poll pacing for this model. Defaults to the AI SDK values; providers with configurable polling should surface their configuration here.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§