pub trait ImageModel: Send + Sync {
// Required methods
fn provider(&self) -> &str;
fn model_id(&self) -> &str;
fn max_images_per_call(&self) -> Option<u32>;
fn do_generate<'life0, 'life1, 'async_trait>(
&'life0 self,
options: &'life1 ImageCallOptions,
) -> Pin<Box<dyn Future<Output = Result<ImageResult, AiMuxError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn specification_version(&self) -> &'static str { ... }
fn retry_config(&self) -> RetryConfig { ... }
}Expand description
The unified image generation model trait (provider-facing).
Aligned with V4 ImageModelV4.
Required Methods§
Sourcefn max_images_per_call(&self) -> Option<u32>
fn max_images_per_call(&self) -> Option<u32>
Limit of how many images can be generated in a single API call.
None means there is no fixed limit. The TS spec allows this to be a
function of modelId; in Rust the provider resolves it to a plain
Option<u32>.
Sourcefn do_generate<'life0, 'life1, 'async_trait>(
&'life0 self,
options: &'life1 ImageCallOptions,
) -> Pin<Box<dyn Future<Output = Result<ImageResult, AiMuxError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn do_generate<'life0, 'life1, 'async_trait>(
&'life0 self,
options: &'life1 ImageCallOptions,
) -> Pin<Box<dyn Future<Output = Result<ImageResult, AiMuxError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Generate an array of images.
Naming: the do_ prefix prevents accidental direct usage by users.
Provided Methods§
Sourcefn specification_version(&self) -> &'static str
fn specification_version(&self) -> &'static str
Specification version (always "v4").
fn retry_config(&self) -> RetryConfig
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".