diff --git a/crates/api_clients/artcraft/artcraft_router/src/api/mod.rs b/crates/api_clients/artcraft/artcraft_router/src/api/mod.rs index a383049879..fa7e90dfa5 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/api/mod.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/api/mod.rs @@ -1,12 +1,12 @@ pub mod audio_list_ref; pub mod character_list_ref; -pub mod common_aspect_ratio; -pub mod common_image_model; -pub mod common_quality; -pub mod common_resolution; -pub mod common_splat_model; -pub mod common_video_model; pub mod image_list_ref; pub mod image_ref; -pub mod provider; +pub mod router_aspect_ratio; +pub mod router_image_model; +pub mod router_provider; +pub mod router_quality; +pub mod router_resolution; +pub mod router_splat_model; +pub mod router_video_model; pub mod video_list_ref; diff --git a/crates/api_clients/artcraft/artcraft_router/src/api/common_aspect_ratio.rs b/crates/api_clients/artcraft/artcraft_router/src/api/router_aspect_ratio.rs similarity index 97% rename from crates/api_clients/artcraft/artcraft_router/src/api/common_aspect_ratio.rs rename to crates/api_clients/artcraft/artcraft_router/src/api/router_aspect_ratio.rs index a930a146a5..1e146a751a 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/api/common_aspect_ratio.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/api/router_aspect_ratio.rs @@ -8,7 +8,7 @@ use strum::EnumIter; #[derive(Copy, Clone, Debug, Serialize, Deserialize)] #[cfg_attr(test, derive(EnumIter))] #[serde(rename_all = "snake_case")] -pub enum CommonAspectRatio { +pub enum RouterAspectRatio { // Auto (eg. for image editing to use the source; used by Nano Banana Pro edit image, but not text-to-image) Auto, diff --git a/crates/api_clients/artcraft/artcraft_router/src/api/common_image_model.rs b/crates/api_clients/artcraft/artcraft_router/src/api/router_image_model.rs similarity index 97% rename from crates/api_clients/artcraft/artcraft_router/src/api/common_image_model.rs rename to crates/api_clients/artcraft/artcraft_router/src/api/router_image_model.rs index a161fd6f44..87a5fff319 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/api/common_image_model.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/api/router_image_model.rs @@ -4,7 +4,7 @@ use serde_derive::{Deserialize, Serialize}; /// Not all models are available through all providers. #[derive(Copy, Clone, Debug, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] -pub enum CommonImageModel { +pub enum RouterImageModel { #[serde(rename = "flux_1_dev")] Flux1Dev, #[serde(rename = "flux_1_schnell")] diff --git a/crates/api_clients/artcraft/artcraft_router/src/api/provider.rs b/crates/api_clients/artcraft/artcraft_router/src/api/router_provider.rs similarity index 90% rename from crates/api_clients/artcraft/artcraft_router/src/api/provider.rs rename to crates/api_clients/artcraft/artcraft_router/src/api/router_provider.rs index 15bdb0cc16..83b04c8e72 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/api/provider.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/api/router_provider.rs @@ -3,7 +3,7 @@ use serde_derive::{Deserialize, Serialize}; /// The provider to route a generation request to. #[derive(Copy, Clone, Debug, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] -pub enum Provider { +pub enum RouterProvider { Artcraft, Fal, GmiCloud, diff --git a/crates/api_clients/artcraft/artcraft_router/src/api/common_quality.rs b/crates/api_clients/artcraft/artcraft_router/src/api/router_quality.rs similarity index 92% rename from crates/api_clients/artcraft/artcraft_router/src/api/common_quality.rs rename to crates/api_clients/artcraft/artcraft_router/src/api/router_quality.rs index 399a64d7be..b195a84bf3 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/api/common_quality.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/api/router_quality.rs @@ -4,7 +4,7 @@ use serde_derive::{Deserialize, Serialize}; /// Not every model will use this; models that don't simply ignore it. #[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_all = "snake_case")] -pub enum CommonQuality { +pub enum RouterQuality { High, Medium, Low, diff --git a/crates/api_clients/artcraft/artcraft_router/src/api/common_resolution.rs b/crates/api_clients/artcraft/artcraft_router/src/api/router_resolution.rs similarity index 96% rename from crates/api_clients/artcraft/artcraft_router/src/api/common_resolution.rs rename to crates/api_clients/artcraft/artcraft_router/src/api/router_resolution.rs index 77e09ce11c..22ae64cdce 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/api/common_resolution.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/api/router_resolution.rs @@ -5,7 +5,7 @@ use serde_derive::{Deserialize, Serialize}; /// In the case a model doesn't support the resolution, gracefully pick the nearest option. #[derive(Copy, Clone, Debug, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] -pub enum CommonResolution { +pub enum RouterResolution { /// Models: Nano Banana Pro OneK, /// Models: Nano Banana Pro diff --git a/crates/api_clients/artcraft/artcraft_router/src/api/common_splat_model.rs b/crates/api_clients/artcraft/artcraft_router/src/api/router_splat_model.rs similarity index 92% rename from crates/api_clients/artcraft/artcraft_router/src/api/common_splat_model.rs rename to crates/api_clients/artcraft/artcraft_router/src/api/router_splat_model.rs index ee3c21642b..025352c986 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/api/common_splat_model.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/api/router_splat_model.rs @@ -4,7 +4,7 @@ use serde_derive::{Deserialize, Serialize}; /// Not all models are available through all providers. #[derive(Copy, Clone, Debug, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] -pub enum CommonSplatModel { +pub enum RouterSplatModel { #[serde(rename = "marble_0p1_mini")] Marble0p1Mini, diff --git a/crates/api_clients/artcraft/artcraft_router/src/api/common_video_model.rs b/crates/api_clients/artcraft/artcraft_router/src/api/router_video_model.rs similarity index 98% rename from crates/api_clients/artcraft/artcraft_router/src/api/common_video_model.rs rename to crates/api_clients/artcraft/artcraft_router/src/api/router_video_model.rs index 2239579da2..6b3b174e8b 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/api/common_video_model.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/api/router_video_model.rs @@ -4,7 +4,7 @@ use serde_derive::{Deserialize, Serialize}; /// Not all models are available through all providers. #[derive(Copy, Clone, Debug, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] -pub enum CommonVideoModel { +pub enum RouterVideoModel { #[serde(rename = "grok_video")] GrokVideo, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image/generate_image_request_builder.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image/generate_image_request_builder.rs index efdb78ff09..fb907dc1aa 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image/generate_image_request_builder.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image/generate_image_request_builder.rs @@ -1,9 +1,9 @@ -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_image_model::CommonImageModel; -use crate::api::common_quality::CommonQuality; -use crate::api::common_resolution::CommonResolution; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_image_model::RouterImageModel; +use crate::api::router_quality::RouterQuality; +use crate::api::router_resolution::RouterResolution; use crate::api::image_list_ref::ImageListRef; -use crate::api::provider::Provider; +use crate::api::router_provider::RouterProvider; use crate::client::generation_mode_mismatch_strategy::GenerationModeMismatchStrategy; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -42,10 +42,10 @@ use crate::generate::generate_image_v2::providers::fal::seedream_5_lite::build:: #[derive(Clone, Debug)] pub struct GenerateImageRequestBuilder { /// Which model to use. - pub model: CommonImageModel, + pub model: RouterImageModel, /// Which provider to use. - pub provider: Provider, + pub provider: RouterProvider, /// The prompt for the image generation. pub prompt: Option, @@ -56,13 +56,13 @@ pub struct GenerateImageRequestBuilder { pub image_inputs: Option, /// The resolution to use. - pub resolution: Option, + pub resolution: Option, /// The aspect ratio to use. - pub aspect_ratio: Option, + pub aspect_ratio: Option, /// The quality level for generation. Not all models use this. - pub quality: Option, + pub quality: Option, /// How many images to generate. pub image_batch_count: Option, @@ -100,37 +100,37 @@ impl GenerateImageRequestBuilder { /// `GenerateVideoRequestBuilder::build2`. pub fn build2(self) -> Result { match (self.provider, self.model) { - (Provider::Artcraft, CommonImageModel::Flux1Dev) => build_artcraft_flux_1_dev(self), - (Provider::Artcraft, CommonImageModel::Flux1Schnell) => build_artcraft_flux_1_schnell(self), - (Provider::Artcraft, CommonImageModel::FluxPro11) => build_artcraft_flux_pro_1p1(self), - (Provider::Artcraft, CommonImageModel::FluxPro11Ultra) => build_artcraft_flux_pro_1p1_ultra(self), - (Provider::Artcraft, CommonImageModel::GptImage1) => build_artcraft_gpt_image_1(self), - (Provider::Artcraft, CommonImageModel::GptImage1p5) => build_artcraft_gpt_image_1p5(self), - (Provider::Artcraft, CommonImageModel::GptImage2) => build_artcraft_gpt_image_2(self), - (Provider::Artcraft, CommonImageModel::NanoBanana) => build_artcraft_nano_banana(self), - (Provider::Artcraft, CommonImageModel::NanoBanana2) => build_artcraft_nano_banana_2(self), - (Provider::Artcraft, CommonImageModel::NanoBananaPro) => build_artcraft_nano_banana_pro(self), - (Provider::Artcraft, CommonImageModel::Seedream4) => build_artcraft_seedream_4(self), - (Provider::Artcraft, CommonImageModel::Seedream4p5) => build_artcraft_seedream_4p5(self), - (Provider::Artcraft, CommonImageModel::Seedream5Lite) => build_artcraft_seedream_5_lite(self), - (Provider::Artcraft, CommonImageModel::QwenEdit2511Angles) => build_artcraft_qwen_edit_2511_angles(self), - (Provider::Artcraft, CommonImageModel::Flux2LoraAngles) => build_artcraft_flux_2_lora_angles(self), + (RouterProvider::Artcraft, RouterImageModel::Flux1Dev) => build_artcraft_flux_1_dev(self), + (RouterProvider::Artcraft, RouterImageModel::Flux1Schnell) => build_artcraft_flux_1_schnell(self), + (RouterProvider::Artcraft, RouterImageModel::FluxPro11) => build_artcraft_flux_pro_1p1(self), + (RouterProvider::Artcraft, RouterImageModel::FluxPro11Ultra) => build_artcraft_flux_pro_1p1_ultra(self), + (RouterProvider::Artcraft, RouterImageModel::GptImage1) => build_artcraft_gpt_image_1(self), + (RouterProvider::Artcraft, RouterImageModel::GptImage1p5) => build_artcraft_gpt_image_1p5(self), + (RouterProvider::Artcraft, RouterImageModel::GptImage2) => build_artcraft_gpt_image_2(self), + (RouterProvider::Artcraft, RouterImageModel::NanoBanana) => build_artcraft_nano_banana(self), + (RouterProvider::Artcraft, RouterImageModel::NanoBanana2) => build_artcraft_nano_banana_2(self), + (RouterProvider::Artcraft, RouterImageModel::NanoBananaPro) => build_artcraft_nano_banana_pro(self), + (RouterProvider::Artcraft, RouterImageModel::Seedream4) => build_artcraft_seedream_4(self), + (RouterProvider::Artcraft, RouterImageModel::Seedream4p5) => build_artcraft_seedream_4p5(self), + (RouterProvider::Artcraft, RouterImageModel::Seedream5Lite) => build_artcraft_seedream_5_lite(self), + (RouterProvider::Artcraft, RouterImageModel::QwenEdit2511Angles) => build_artcraft_qwen_edit_2511_angles(self), + (RouterProvider::Artcraft, RouterImageModel::Flux2LoraAngles) => build_artcraft_flux_2_lora_angles(self), - (Provider::Fal, CommonImageModel::Flux1Dev) => build_fal_flux_1_dev(self), - (Provider::Fal, CommonImageModel::Flux1Schnell) => build_fal_flux_1_schnell(self), - (Provider::Fal, CommonImageModel::FluxPro11) => build_fal_flux_pro_1p1(self), - (Provider::Fal, CommonImageModel::FluxPro11Ultra) => build_fal_flux_pro_1p1_ultra(self), - (Provider::Fal, CommonImageModel::GptImage1) => build_fal_gpt_image_1(self), - (Provider::Fal, CommonImageModel::GptImage1p5) => build_fal_gpt_image_1p5(self), - (Provider::Fal, CommonImageModel::GptImage2) => build_fal_gpt_image_2(self), - (Provider::Fal, CommonImageModel::NanoBanana) => build_fal_nano_banana(self), - (Provider::Fal, CommonImageModel::NanoBanana2) => build_fal_nano_banana_2(self), - (Provider::Fal, CommonImageModel::NanoBananaPro) => build_fal_nano_banana_pro(self), - (Provider::Fal, CommonImageModel::Seedream4) => build_fal_seedream_4(self), - (Provider::Fal, CommonImageModel::Seedream4p5) => build_fal_seedream_4p5(self), - (Provider::Fal, CommonImageModel::Seedream5Lite) => build_fal_seedream_5_lite(self), - (Provider::Fal, CommonImageModel::QwenEdit2511Angles) => build_fal_qwen_edit_2511_angles(self), - (Provider::Fal, CommonImageModel::Flux2LoraAngles) => build_fal_flux_2_lora_angles(self), + (RouterProvider::Fal, RouterImageModel::Flux1Dev) => build_fal_flux_1_dev(self), + (RouterProvider::Fal, RouterImageModel::Flux1Schnell) => build_fal_flux_1_schnell(self), + (RouterProvider::Fal, RouterImageModel::FluxPro11) => build_fal_flux_pro_1p1(self), + (RouterProvider::Fal, RouterImageModel::FluxPro11Ultra) => build_fal_flux_pro_1p1_ultra(self), + (RouterProvider::Fal, RouterImageModel::GptImage1) => build_fal_gpt_image_1(self), + (RouterProvider::Fal, RouterImageModel::GptImage1p5) => build_fal_gpt_image_1p5(self), + (RouterProvider::Fal, RouterImageModel::GptImage2) => build_fal_gpt_image_2(self), + (RouterProvider::Fal, RouterImageModel::NanoBanana) => build_fal_nano_banana(self), + (RouterProvider::Fal, RouterImageModel::NanoBanana2) => build_fal_nano_banana_2(self), + (RouterProvider::Fal, RouterImageModel::NanoBananaPro) => build_fal_nano_banana_pro(self), + (RouterProvider::Fal, RouterImageModel::Seedream4) => build_fal_seedream_4(self), + (RouterProvider::Fal, RouterImageModel::Seedream4p5) => build_fal_seedream_4p5(self), + (RouterProvider::Fal, RouterImageModel::Seedream5Lite) => build_fal_seedream_5_lite(self), + (RouterProvider::Fal, RouterImageModel::QwenEdit2511Angles) => build_fal_qwen_edit_2511_angles(self), + (RouterProvider::Fal, RouterImageModel::Flux2LoraAngles) => build_fal_flux_2_lora_angles(self), _ => self.unsupported_provider_and_model(), } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/image_generation_draft.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/image_generation_draft.rs index 19264e95d1..f5b6ae0823 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/image_generation_draft.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/image_generation_draft.rs @@ -1,4 +1,4 @@ -use crate::api::provider::Provider; +use crate::api::router_provider::RouterProvider; use crate::errors::artcraft_router_error::ArtcraftRouterError; use crate::generate::generate_image::image_generation_cost_estimate::ImageGenerationCostEstimate; use crate::generate::generate_image_v2::image_generation_draft_context::ImageGenerationDraftContext; @@ -14,7 +14,7 @@ pub enum ImageGenerationDraftRequest { } impl ImageGenerationDraftRequest { - pub fn get_provider(&self) -> Provider { + pub fn get_provider(&self) -> RouterProvider { match *self {} } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/image_generation_draft_or_request.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/image_generation_draft_or_request.rs index 7fd188811c..eb5c8f3841 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/image_generation_draft_or_request.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/image_generation_draft_or_request.rs @@ -1,4 +1,4 @@ -use crate::api::provider::Provider; +use crate::api::router_provider::RouterProvider; use crate::errors::artcraft_router_error::ArtcraftRouterError; use crate::generate::generate_image::image_generation_cost_estimate::ImageGenerationCostEstimate; use crate::generate::generate_image_v2::image_generation_draft::ImageGenerationDraftRequest; @@ -11,7 +11,7 @@ pub enum ImageGenerationDraftOrRequest { } impl ImageGenerationDraftOrRequest { - pub fn get_provider(&self) -> Provider { + pub fn get_provider(&self) -> RouterProvider { match self { Self::Draft(draft) => draft.get_provider(), Self::Request(request) => request.get_provider(), diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/image_generation_request.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/image_generation_request.rs index 1ca2c0f226..2cfcbe98d6 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/image_generation_request.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/image_generation_request.rs @@ -1,4 +1,4 @@ -use crate::api::provider::Provider; +use crate::api::router_provider::RouterProvider; use crate::client::router_client::RouterClient; use crate::errors::artcraft_router_error::ArtcraftRouterError; use crate::generate::generate_image::generate_image_response::GenerateImageResponse; @@ -102,39 +102,39 @@ pub enum ImageGenerationRequest { } impl ImageGenerationRequest { - pub fn get_provider(&self) -> Provider { + pub fn get_provider(&self) -> RouterProvider { match self { - Self::ArtcraftFlux1Dev(_) => Provider::Artcraft, - Self::ArtcraftFlux1Schnell(_) => Provider::Artcraft, - Self::ArtcraftFluxPro1p1(_) => Provider::Artcraft, - Self::ArtcraftFluxPro1p1Ultra(_) => Provider::Artcraft, - Self::ArtcraftGptImage1(_) => Provider::Artcraft, - Self::ArtcraftGptImage1p5(_) => Provider::Artcraft, - Self::ArtcraftGptImage2(_) => Provider::Artcraft, - Self::ArtcraftNanoBanana(_) => Provider::Artcraft, - Self::ArtcraftNanoBanana2(_) => Provider::Artcraft, - Self::ArtcraftNanoBananaPro(_) => Provider::Artcraft, - Self::ArtcraftSeedream4(_) => Provider::Artcraft, - Self::ArtcraftSeedream4p5(_) => Provider::Artcraft, - Self::ArtcraftSeedream5Lite(_) => Provider::Artcraft, - Self::ArtcraftQwenEdit2511Angles(_) => Provider::Artcraft, - Self::ArtcraftFlux2LoraAngles(_) => Provider::Artcraft, + Self::ArtcraftFlux1Dev(_) => RouterProvider::Artcraft, + Self::ArtcraftFlux1Schnell(_) => RouterProvider::Artcraft, + Self::ArtcraftFluxPro1p1(_) => RouterProvider::Artcraft, + Self::ArtcraftFluxPro1p1Ultra(_) => RouterProvider::Artcraft, + Self::ArtcraftGptImage1(_) => RouterProvider::Artcraft, + Self::ArtcraftGptImage1p5(_) => RouterProvider::Artcraft, + Self::ArtcraftGptImage2(_) => RouterProvider::Artcraft, + Self::ArtcraftNanoBanana(_) => RouterProvider::Artcraft, + Self::ArtcraftNanoBanana2(_) => RouterProvider::Artcraft, + Self::ArtcraftNanoBananaPro(_) => RouterProvider::Artcraft, + Self::ArtcraftSeedream4(_) => RouterProvider::Artcraft, + Self::ArtcraftSeedream4p5(_) => RouterProvider::Artcraft, + Self::ArtcraftSeedream5Lite(_) => RouterProvider::Artcraft, + Self::ArtcraftQwenEdit2511Angles(_) => RouterProvider::Artcraft, + Self::ArtcraftFlux2LoraAngles(_) => RouterProvider::Artcraft, - Self::FalFlux1Dev(_) => Provider::Fal, - Self::FalFlux1Schnell(_) => Provider::Fal, - Self::FalFluxPro1p1(_) => Provider::Fal, - Self::FalFluxPro1p1Ultra(_) => Provider::Fal, - Self::FalGptImage1(_) => Provider::Fal, - Self::FalGptImage1p5(_) => Provider::Fal, - Self::FalGptImage2(_) => Provider::Fal, - Self::FalNanoBanana(_) => Provider::Fal, - Self::FalNanoBanana2(_) => Provider::Fal, - Self::FalNanoBananaPro(_) => Provider::Fal, - Self::FalSeedream4(_) => Provider::Fal, - Self::FalSeedream4p5(_) => Provider::Fal, - Self::FalSeedream5Lite(_) => Provider::Fal, - Self::FalQwenEdit2511Angles(_) => Provider::Fal, - Self::FalFlux2LoraAngles(_) => Provider::Fal, + Self::FalFlux1Dev(_) => RouterProvider::Fal, + Self::FalFlux1Schnell(_) => RouterProvider::Fal, + Self::FalFluxPro1p1(_) => RouterProvider::Fal, + Self::FalFluxPro1p1Ultra(_) => RouterProvider::Fal, + Self::FalGptImage1(_) => RouterProvider::Fal, + Self::FalGptImage1p5(_) => RouterProvider::Fal, + Self::FalGptImage2(_) => RouterProvider::Fal, + Self::FalNanoBanana(_) => RouterProvider::Fal, + Self::FalNanoBanana2(_) => RouterProvider::Fal, + Self::FalNanoBananaPro(_) => RouterProvider::Fal, + Self::FalSeedream4(_) => RouterProvider::Fal, + Self::FalSeedream4p5(_) => RouterProvider::Fal, + Self::FalSeedream5Lite(_) => RouterProvider::Fal, + Self::FalQwenEdit2511Angles(_) => RouterProvider::Fal, + Self::FalFlux2LoraAngles(_) => RouterProvider::Fal, } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/build_common.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/build_common.rs index 0a50b72b8d..dd4ecd81d4 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/build_common.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/build_common.rs @@ -5,9 +5,9 @@ use enums::common::generation::common_quality::CommonQuality as CommonQualityEnu use enums::common::generation::common_resolution::CommonResolution as CommonResolutionEnum; use tokens::tokens::media_files::MediaFileToken; -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_quality::CommonQuality; -use crate::api::common_resolution::CommonResolution; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_quality::RouterQuality; +use crate::api::router_resolution::RouterResolution; use crate::api::image_list_ref::ImageListRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -91,46 +91,46 @@ pub fn resolve_image_list_ref( } } -fn to_aspect_ratio_enum(ar: CommonAspectRatio) -> CommonAspectRatioEnum { +fn to_aspect_ratio_enum(ar: RouterAspectRatio) -> CommonAspectRatioEnum { match ar { - CommonAspectRatio::Auto => CommonAspectRatioEnum::Auto, - CommonAspectRatio::Auto2k => CommonAspectRatioEnum::Auto2k, - CommonAspectRatio::Auto3k => CommonAspectRatioEnum::Auto3k, - CommonAspectRatio::Auto4k => CommonAspectRatioEnum::Auto4k, - CommonAspectRatio::Square => CommonAspectRatioEnum::Square, - CommonAspectRatio::SquareHd => CommonAspectRatioEnum::SquareHd, - CommonAspectRatio::WideFourByThree => CommonAspectRatioEnum::WideFourByThree, - CommonAspectRatio::WideFiveByFour => CommonAspectRatioEnum::WideFiveByFour, - CommonAspectRatio::WideThreeByTwo => CommonAspectRatioEnum::WideThreeByTwo, - CommonAspectRatio::WideSixteenByNine => CommonAspectRatioEnum::WideSixteenByNine, - CommonAspectRatio::WideTwentyOneByNine => CommonAspectRatioEnum::WideTwentyOneByNine, - CommonAspectRatio::Wide => CommonAspectRatioEnum::Wide, - CommonAspectRatio::TallThreeByFour => CommonAspectRatioEnum::TallThreeByFour, - CommonAspectRatio::TallFourByFive => CommonAspectRatioEnum::TallFourByFive, - CommonAspectRatio::TallTwoByThree => CommonAspectRatioEnum::TallTwoByThree, - CommonAspectRatio::TallNineBySixteen => CommonAspectRatioEnum::TallNineBySixteen, - CommonAspectRatio::TallNineByTwentyOne => CommonAspectRatioEnum::TallNineByTwentyOne, - CommonAspectRatio::Tall => CommonAspectRatioEnum::Tall, + RouterAspectRatio::Auto => CommonAspectRatioEnum::Auto, + RouterAspectRatio::Auto2k => CommonAspectRatioEnum::Auto2k, + RouterAspectRatio::Auto3k => CommonAspectRatioEnum::Auto3k, + RouterAspectRatio::Auto4k => CommonAspectRatioEnum::Auto4k, + RouterAspectRatio::Square => CommonAspectRatioEnum::Square, + RouterAspectRatio::SquareHd => CommonAspectRatioEnum::SquareHd, + RouterAspectRatio::WideFourByThree => CommonAspectRatioEnum::WideFourByThree, + RouterAspectRatio::WideFiveByFour => CommonAspectRatioEnum::WideFiveByFour, + RouterAspectRatio::WideThreeByTwo => CommonAspectRatioEnum::WideThreeByTwo, + RouterAspectRatio::WideSixteenByNine => CommonAspectRatioEnum::WideSixteenByNine, + RouterAspectRatio::WideTwentyOneByNine => CommonAspectRatioEnum::WideTwentyOneByNine, + RouterAspectRatio::Wide => CommonAspectRatioEnum::Wide, + RouterAspectRatio::TallThreeByFour => CommonAspectRatioEnum::TallThreeByFour, + RouterAspectRatio::TallFourByFive => CommonAspectRatioEnum::TallFourByFive, + RouterAspectRatio::TallTwoByThree => CommonAspectRatioEnum::TallTwoByThree, + RouterAspectRatio::TallNineBySixteen => CommonAspectRatioEnum::TallNineBySixteen, + RouterAspectRatio::TallNineByTwentyOne => CommonAspectRatioEnum::TallNineByTwentyOne, + RouterAspectRatio::Tall => CommonAspectRatioEnum::Tall, } } -fn to_resolution_enum(r: CommonResolution) -> CommonResolutionEnum { +fn to_resolution_enum(r: RouterResolution) -> CommonResolutionEnum { match r { - CommonResolution::HalfK => CommonResolutionEnum::HalfK, - CommonResolution::OneK => CommonResolutionEnum::OneK, - CommonResolution::TwoK => CommonResolutionEnum::TwoK, - CommonResolution::ThreeK => CommonResolutionEnum::ThreeK, - CommonResolution::FourK => CommonResolutionEnum::FourK, - CommonResolution::FourEightyP => CommonResolutionEnum::FourEightyP, - CommonResolution::SevenTwentyP => CommonResolutionEnum::SevenTwentyP, - CommonResolution::TenEightyP => CommonResolutionEnum::TenEightyP, + RouterResolution::HalfK => CommonResolutionEnum::HalfK, + RouterResolution::OneK => CommonResolutionEnum::OneK, + RouterResolution::TwoK => CommonResolutionEnum::TwoK, + RouterResolution::ThreeK => CommonResolutionEnum::ThreeK, + RouterResolution::FourK => CommonResolutionEnum::FourK, + RouterResolution::FourEightyP => CommonResolutionEnum::FourEightyP, + RouterResolution::SevenTwentyP => CommonResolutionEnum::SevenTwentyP, + RouterResolution::TenEightyP => CommonResolutionEnum::TenEightyP, } } -fn to_quality_enum(q: CommonQuality) -> CommonQualityEnum { +fn to_quality_enum(q: RouterQuality) -> CommonQualityEnum { match q { - CommonQuality::Low => CommonQualityEnum::Low, - CommonQuality::Medium => CommonQualityEnum::Medium, - CommonQuality::High => CommonQualityEnum::High, + RouterQuality::Low => CommonQualityEnum::Low, + RouterQuality::Medium => CommonQualityEnum::Medium, + RouterQuality::High => CommonQualityEnum::High, } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/flux_1_dev/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/flux_1_dev/cost.rs index e92cd0cb0d..f0d1e36325 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/flux_1_dev/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/flux_1_dev/cost.rs @@ -33,15 +33,15 @@ impl ArtcraftFlux1DevCostState { #[cfg(test)] mod tests { use super::*; - use crate::api::common_image_model::CommonImageModel; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_provider::RouterProvider; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::generate::generate_image::generate_image_request_builder::GenerateImageRequestBuilder; fn cost_cents(image_batch_count: u16) -> u64 { let builder = GenerateImageRequestBuilder { - model: CommonImageModel::Flux1Dev, - provider: Provider::Artcraft, + model: RouterImageModel::Flux1Dev, + provider: RouterProvider::Artcraft, prompt: None, image_inputs: None, resolution: None, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/flux_1_schnell/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/flux_1_schnell/cost.rs index dfe0c221b9..57edac7cc7 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/flux_1_schnell/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/flux_1_schnell/cost.rs @@ -27,15 +27,15 @@ impl ArtcraftFlux1SchnellCostState { #[cfg(test)] mod tests { - use crate::api::common_image_model::CommonImageModel; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_provider::RouterProvider; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::generate::generate_image::generate_image_request_builder::GenerateImageRequestBuilder; fn build_estimate() -> crate::generate::generate_image::image_generation_cost_estimate::ImageGenerationCostEstimate { let builder = GenerateImageRequestBuilder { - model: CommonImageModel::Flux1Schnell, - provider: Provider::Artcraft, + model: RouterImageModel::Flux1Schnell, + provider: RouterProvider::Artcraft, prompt: None, image_inputs: None, resolution: None, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/flux_2_lora_angles/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/flux_2_lora_angles/cost.rs index 15dc60454d..3cd7760fe1 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/flux_2_lora_angles/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/flux_2_lora_angles/cost.rs @@ -32,17 +32,17 @@ impl ArtcraftFlux2LoraAnglesCostState { #[cfg(test)] mod tests { - use crate::api::common_image_model::CommonImageModel; + use crate::api::router_image_model::RouterImageModel; use crate::api::image_list_ref::ImageListRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::generate::generate_image::generate_image_request_builder::GenerateImageRequestBuilder; use tokens::tokens::media_files::MediaFileToken; fn cost_cents(image_batch_count: u16) -> u64 { let builder = GenerateImageRequestBuilder { - model: CommonImageModel::Flux2LoraAngles, - provider: Provider::Artcraft, + model: RouterImageModel::Flux2LoraAngles, + provider: RouterProvider::Artcraft, prompt: None, image_inputs: Some(ImageListRef::MediaFileTokens(vec![MediaFileToken::new_from_str("mf_test")])), resolution: None, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/flux_pro_1p1/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/flux_pro_1p1/cost.rs index fd11ed1536..3e658035e5 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/flux_pro_1p1/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/flux_pro_1p1/cost.rs @@ -32,15 +32,15 @@ impl ArtcraftFluxPro1p1CostState { #[cfg(test)] mod tests { - use crate::api::common_image_model::CommonImageModel; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_provider::RouterProvider; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::generate::generate_image::generate_image_request_builder::GenerateImageRequestBuilder; fn cost_cents(image_batch_count: u16) -> u64 { let builder = GenerateImageRequestBuilder { - model: CommonImageModel::FluxPro11, - provider: Provider::Artcraft, + model: RouterImageModel::FluxPro11, + provider: RouterProvider::Artcraft, prompt: None, image_inputs: None, resolution: None, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/flux_pro_1p1_ultra/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/flux_pro_1p1_ultra/cost.rs index 93d0adcf10..bcab09d648 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/flux_pro_1p1_ultra/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/flux_pro_1p1_ultra/cost.rs @@ -31,15 +31,15 @@ impl ArtcraftFluxPro1p1UltraCostState { #[cfg(test)] mod tests { - use crate::api::common_image_model::CommonImageModel; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_provider::RouterProvider; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::generate::generate_image::generate_image_request_builder::GenerateImageRequestBuilder; fn cost_cents(image_batch_count: u16) -> u64 { let builder = GenerateImageRequestBuilder { - model: CommonImageModel::FluxPro11Ultra, - provider: Provider::Artcraft, + model: RouterImageModel::FluxPro11Ultra, + provider: RouterProvider::Artcraft, prompt: None, image_inputs: None, resolution: None, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/gpt_image_1/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/gpt_image_1/cost.rs index 927122a3c6..8c852e2011 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/gpt_image_1/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/gpt_image_1/cost.rs @@ -79,19 +79,19 @@ fn is_square_or_none(aspect_ratio: Option) -> bool { #[cfg(test)] mod tests { - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_image_model::CommonImageModel; - use crate::api::common_quality::CommonQuality; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_quality::RouterQuality; use crate::api::image_list_ref::ImageListRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::generate::generate_image::generate_image_request_builder::GenerateImageRequestBuilder; use tokens::tokens::media_files::MediaFileToken; fn base() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::GptImage1, - provider: Provider::Artcraft, + model: RouterImageModel::GptImage1, + provider: RouterProvider::Artcraft, prompt: None, image_inputs: None, resolution: None, @@ -107,7 +107,7 @@ mod tests { } } - fn cost_text(quality: Option, aspect_ratio: Option, batch: u16) -> u64 { + fn cost_text(quality: Option, aspect_ratio: Option, batch: u16) -> u64 { let builder = GenerateImageRequestBuilder { quality, aspect_ratio, @@ -117,7 +117,7 @@ mod tests { builder.build2().unwrap().estimate_cost().unwrap().cost_in_usd_cents.unwrap() } - fn cost_edit(quality: Option, aspect_ratio: Option, batch: u16, num_inputs: usize) -> u64 { + fn cost_edit(quality: Option, aspect_ratio: Option, batch: u16, num_inputs: usize) -> u64 { let tokens: Vec = (0..num_inputs) .map(|i| MediaFileToken::new_from_str(&format!("mf_test{:028}", i))) .collect(); @@ -142,53 +142,53 @@ mod tests { // ── Low → 2¢ all sizes ──────────────────────────────────────────────────── #[test] - fn low_square_one() { assert_eq!(cost_text(Some(CommonQuality::Low), Some(CommonAspectRatio::Square), 1), 2); } + fn low_square_one() { assert_eq!(cost_text(Some(RouterQuality::Low), Some(RouterAspectRatio::Square), 1), 2); } #[test] - fn low_wide_one() { assert_eq!(cost_text(Some(CommonQuality::Low), Some(CommonAspectRatio::WideSixteenByNine), 1), 2); } + fn low_wide_one() { assert_eq!(cost_text(Some(RouterQuality::Low), Some(RouterAspectRatio::WideSixteenByNine), 1), 2); } #[test] - fn low_tall_one() { assert_eq!(cost_text(Some(CommonQuality::Low), Some(CommonAspectRatio::TallNineBySixteen), 1), 2); } + fn low_tall_one() { assert_eq!(cost_text(Some(RouterQuality::Low), Some(RouterAspectRatio::TallNineBySixteen), 1), 2); } #[test] - fn low_four_images() { assert_eq!(cost_text(Some(CommonQuality::Low), None, 4), 8); } + fn low_four_images() { assert_eq!(cost_text(Some(RouterQuality::Low), None, 4), 8); } // ── Medium ──────────────────────────────────────────────────────────────── #[test] - fn medium_square_one() { assert_eq!(cost_text(Some(CommonQuality::Medium), Some(CommonAspectRatio::Square), 1), 5); } + fn medium_square_one() { assert_eq!(cost_text(Some(RouterQuality::Medium), Some(RouterAspectRatio::Square), 1), 5); } #[test] - fn medium_wide_one() { assert_eq!(cost_text(Some(CommonQuality::Medium), Some(CommonAspectRatio::WideSixteenByNine), 1), 7); } + fn medium_wide_one() { assert_eq!(cost_text(Some(RouterQuality::Medium), Some(RouterAspectRatio::WideSixteenByNine), 1), 7); } #[test] - fn medium_tall_one() { assert_eq!(cost_text(Some(CommonQuality::Medium), Some(CommonAspectRatio::TallNineBySixteen), 1), 7); } + fn medium_tall_one() { assert_eq!(cost_text(Some(RouterQuality::Medium), Some(RouterAspectRatio::TallNineBySixteen), 1), 7); } // ── High ────────────────────────────────────────────────────────────────── #[test] - fn high_square_one() { assert_eq!(cost_text(Some(CommonQuality::High), Some(CommonAspectRatio::Square), 1), 17); } + fn high_square_one() { assert_eq!(cost_text(Some(RouterQuality::High), Some(RouterAspectRatio::Square), 1), 17); } #[test] - fn high_wide_one() { assert_eq!(cost_text(Some(CommonQuality::High), Some(CommonAspectRatio::WideSixteenByNine), 1), 25); } + fn high_wide_one() { assert_eq!(cost_text(Some(RouterQuality::High), Some(RouterAspectRatio::WideSixteenByNine), 1), 25); } #[test] - fn high_wide_four() { assert_eq!(cost_text(Some(CommonQuality::High), Some(CommonAspectRatio::WideSixteenByNine), 4), 100); } + fn high_wide_four() { assert_eq!(cost_text(Some(RouterQuality::High), Some(RouterAspectRatio::WideSixteenByNine), 4), 100); } // ── Edit mode adds 2¢ per input image ───────────────────────────────────── #[test] fn edit_one_input_adds_2c() { - assert_eq!(cost_edit(Some(CommonQuality::High), Some(CommonAspectRatio::Square), 1, 1), 19); + assert_eq!(cost_edit(Some(RouterQuality::High), Some(RouterAspectRatio::Square), 1, 1), 19); } #[test] fn edit_three_inputs_adds_6c() { - assert_eq!(cost_edit(Some(CommonQuality::High), Some(CommonAspectRatio::Square), 1, 3), 23); + assert_eq!(cost_edit(Some(RouterQuality::High), Some(RouterAspectRatio::Square), 1, 3), 23); } #[test] fn edit_five_inputs_adds_10c() { - assert_eq!(cost_edit(Some(CommonQuality::Medium), Some(CommonAspectRatio::WideSixteenByNine), 2, 5), 24); + assert_eq!(cost_edit(Some(RouterQuality::Medium), Some(RouterAspectRatio::WideSixteenByNine), 2, 5), 24); } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/gpt_image_1p5/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/gpt_image_1p5/cost.rs index 315e48b97b..af2da6b3eb 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/gpt_image_1p5/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/gpt_image_1p5/cost.rs @@ -94,17 +94,17 @@ fn size_bucket(aspect_ratio: Option) -> SizeBucket { #[cfg(test)] mod tests { - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_image_model::CommonImageModel; - use crate::api::common_quality::CommonQuality; - use crate::api::provider::Provider; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_quality::RouterQuality; + use crate::api::router_provider::RouterProvider; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::generate::generate_image::generate_image_request_builder::GenerateImageRequestBuilder; - fn cost_cents(quality: Option, aspect_ratio: Option, batch: u16) -> u64 { + fn cost_cents(quality: Option, aspect_ratio: Option, batch: u16) -> u64 { let builder = GenerateImageRequestBuilder { - model: CommonImageModel::GptImage1p5, - provider: Provider::Artcraft, + model: RouterImageModel::GptImage1p5, + provider: RouterProvider::Artcraft, prompt: None, image_inputs: None, resolution: None, @@ -124,50 +124,50 @@ mod tests { // ── Default (None → High) ───────────────────────────────────────────────── #[test] - fn default_square_one() { assert_eq!(cost_cents(None, Some(CommonAspectRatio::Square), 1), 14); } + fn default_square_one() { assert_eq!(cost_cents(None, Some(RouterAspectRatio::Square), 1), 14); } #[test] fn default_unset_one() { assert_eq!(cost_cents(None, None, 1), 14); } #[test] - fn default_wide_one() { assert_eq!(cost_cents(None, Some(CommonAspectRatio::WideSixteenByNine), 1), 20); } + fn default_wide_one() { assert_eq!(cost_cents(None, Some(RouterAspectRatio::WideSixteenByNine), 1), 20); } #[test] - fn default_tall_one() { assert_eq!(cost_cents(None, Some(CommonAspectRatio::TallNineBySixteen), 1), 20); } + fn default_tall_one() { assert_eq!(cost_cents(None, Some(RouterAspectRatio::TallNineBySixteen), 1), 20); } #[test] - fn default_square_four() { assert_eq!(cost_cents(None, Some(CommonAspectRatio::Square), 4), 56); } + fn default_square_four() { assert_eq!(cost_cents(None, Some(RouterAspectRatio::Square), 4), 56); } // ── Low ─────────────────────────────────────────────────────────────────── #[test] - fn low_square_one() { assert_eq!(cost_cents(Some(CommonQuality::Low), Some(CommonAspectRatio::Square), 1), 1); } + fn low_square_one() { assert_eq!(cost_cents(Some(RouterQuality::Low), Some(RouterAspectRatio::Square), 1), 1); } #[test] - fn low_wide_one() { assert_eq!(cost_cents(Some(CommonQuality::Low), Some(CommonAspectRatio::WideSixteenByNine), 1), 2); } + fn low_wide_one() { assert_eq!(cost_cents(Some(RouterQuality::Low), Some(RouterAspectRatio::WideSixteenByNine), 1), 2); } #[test] - fn low_tall_one() { assert_eq!(cost_cents(Some(CommonQuality::Low), Some(CommonAspectRatio::TallNineBySixteen), 1), 2); } + fn low_tall_one() { assert_eq!(cost_cents(Some(RouterQuality::Low), Some(RouterAspectRatio::TallNineBySixteen), 1), 2); } // ── Medium ──────────────────────────────────────────────────────────────── #[test] - fn medium_square_one() { assert_eq!(cost_cents(Some(CommonQuality::Medium), Some(CommonAspectRatio::Square), 1), 4); } + fn medium_square_one() { assert_eq!(cost_cents(Some(RouterQuality::Medium), Some(RouterAspectRatio::Square), 1), 4); } #[test] - fn medium_wide_one() { assert_eq!(cost_cents(Some(CommonQuality::Medium), Some(CommonAspectRatio::WideSixteenByNine), 1), 5); } + fn medium_wide_one() { assert_eq!(cost_cents(Some(RouterQuality::Medium), Some(RouterAspectRatio::WideSixteenByNine), 1), 5); } #[test] - fn medium_tall_one() { assert_eq!(cost_cents(Some(CommonQuality::Medium), Some(CommonAspectRatio::TallNineBySixteen), 1), 6); } + fn medium_tall_one() { assert_eq!(cost_cents(Some(RouterQuality::Medium), Some(RouterAspectRatio::TallNineBySixteen), 1), 6); } #[test] - fn medium_tall_four() { assert_eq!(cost_cents(Some(CommonQuality::Medium), Some(CommonAspectRatio::TallNineBySixteen), 4), 24); } + fn medium_tall_four() { assert_eq!(cost_cents(Some(RouterQuality::Medium), Some(RouterAspectRatio::TallNineBySixteen), 4), 24); } // ── High ────────────────────────────────────────────────────────────────── #[test] - fn high_square_one() { assert_eq!(cost_cents(Some(CommonQuality::High), Some(CommonAspectRatio::Square), 1), 14); } + fn high_square_one() { assert_eq!(cost_cents(Some(RouterQuality::High), Some(RouterAspectRatio::Square), 1), 14); } #[test] - fn high_wide_four() { assert_eq!(cost_cents(Some(CommonQuality::High), Some(CommonAspectRatio::WideSixteenByNine), 4), 80); } + fn high_wide_four() { assert_eq!(cost_cents(Some(RouterQuality::High), Some(RouterAspectRatio::WideSixteenByNine), 4), 80); } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/gpt_image_2/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/gpt_image_2/cost.rs index d7c3f1d240..82d9525d62 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/gpt_image_2/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/gpt_image_2/cost.rs @@ -109,17 +109,17 @@ fn size_bucket(aspect_ratio: Option) -> SizeBucket { #[cfg(test)] mod tests { - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_image_model::CommonImageModel; - use crate::api::common_quality::CommonQuality; - use crate::api::provider::Provider; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_quality::RouterQuality; + use crate::api::router_provider::RouterProvider; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::generate::generate_image::generate_image_request_builder::GenerateImageRequestBuilder; - fn cost_cents(quality: Option, aspect_ratio: Option, batch: u16) -> u64 { + fn cost_cents(quality: Option, aspect_ratio: Option, batch: u16) -> u64 { let builder = GenerateImageRequestBuilder { - model: CommonImageModel::GptImage2, - provider: Provider::Artcraft, + model: RouterImageModel::GptImage2, + provider: RouterProvider::Artcraft, prompt: None, image_inputs: None, resolution: None, @@ -139,63 +139,63 @@ mod tests { // ── Low (1¢ all sizes) ──────────────────────────────────────────────────── #[test] - fn low_square() { assert_eq!(cost_cents(Some(CommonQuality::Low), Some(CommonAspectRatio::Square), 1), 1); } + fn low_square() { assert_eq!(cost_cents(Some(RouterQuality::Low), Some(RouterAspectRatio::Square), 1), 1); } #[test] - fn low_square_hd() { assert_eq!(cost_cents(Some(CommonQuality::Low), Some(CommonAspectRatio::SquareHd), 1), 1); } + fn low_square_hd() { assert_eq!(cost_cents(Some(RouterQuality::Low), Some(RouterAspectRatio::SquareHd), 1), 1); } #[test] - fn low_landscape_4x3() { assert_eq!(cost_cents(Some(CommonQuality::Low), Some(CommonAspectRatio::WideFourByThree), 1), 1); } + fn low_landscape_4x3() { assert_eq!(cost_cents(Some(RouterQuality::Low), Some(RouterAspectRatio::WideFourByThree), 1), 1); } #[test] - fn low_four() { assert_eq!(cost_cents(Some(CommonQuality::Low), None, 4), 4); } + fn low_four() { assert_eq!(cost_cents(Some(RouterQuality::Low), None, 4), 4); } // ── Medium ──────────────────────────────────────────────────────────────── #[test] - fn medium_square_is_6c() { assert_eq!(cost_cents(Some(CommonQuality::Medium), Some(CommonAspectRatio::Square), 1), 6); } + fn medium_square_is_6c() { assert_eq!(cost_cents(Some(RouterQuality::Medium), Some(RouterAspectRatio::Square), 1), 6); } #[test] - fn medium_square_hd_is_6c() { assert_eq!(cost_cents(Some(CommonQuality::Medium), Some(CommonAspectRatio::SquareHd), 1), 6); } + fn medium_square_hd_is_6c() { assert_eq!(cost_cents(Some(RouterQuality::Medium), Some(RouterAspectRatio::SquareHd), 1), 6); } #[test] - fn medium_auto_is_6c() { assert_eq!(cost_cents(Some(CommonQuality::Medium), None, 1), 6); } + fn medium_auto_is_6c() { assert_eq!(cost_cents(Some(RouterQuality::Medium), None, 1), 6); } #[test] - fn medium_landscape_4x3_is_4c() { assert_eq!(cost_cents(Some(CommonQuality::Medium), Some(CommonAspectRatio::WideFourByThree), 1), 4); } + fn medium_landscape_4x3_is_4c() { assert_eq!(cost_cents(Some(RouterQuality::Medium), Some(RouterAspectRatio::WideFourByThree), 1), 4); } #[test] - fn medium_portrait_4x3_is_4c() { assert_eq!(cost_cents(Some(CommonQuality::Medium), Some(CommonAspectRatio::TallThreeByFour), 1), 4); } + fn medium_portrait_4x3_is_4c() { assert_eq!(cost_cents(Some(RouterQuality::Medium), Some(RouterAspectRatio::TallThreeByFour), 1), 4); } #[test] - fn medium_landscape_16x9_is_4c() { assert_eq!(cost_cents(Some(CommonQuality::Medium), Some(CommonAspectRatio::WideSixteenByNine), 1), 4); } + fn medium_landscape_16x9_is_4c() { assert_eq!(cost_cents(Some(RouterQuality::Medium), Some(RouterAspectRatio::WideSixteenByNine), 1), 4); } #[test] - fn medium_portrait_16x9_is_4c() { assert_eq!(cost_cents(Some(CommonQuality::Medium), Some(CommonAspectRatio::TallNineBySixteen), 1), 4); } + fn medium_portrait_16x9_is_4c() { assert_eq!(cost_cents(Some(RouterQuality::Medium), Some(RouterAspectRatio::TallNineBySixteen), 1), 4); } #[test] - fn medium_square_four_is_24c() { assert_eq!(cost_cents(Some(CommonQuality::Medium), Some(CommonAspectRatio::Square), 4), 24); } + fn medium_square_four_is_24c() { assert_eq!(cost_cents(Some(RouterQuality::Medium), Some(RouterAspectRatio::Square), 4), 24); } // ── High ────────────────────────────────────────────────────────────────── #[test] - fn high_square_is_22c() { assert_eq!(cost_cents(Some(CommonQuality::High), Some(CommonAspectRatio::Square), 1), 22); } + fn high_square_is_22c() { assert_eq!(cost_cents(Some(RouterQuality::High), Some(RouterAspectRatio::Square), 1), 22); } #[test] - fn high_square_hd_is_23c() { assert_eq!(cost_cents(Some(CommonQuality::High), Some(CommonAspectRatio::SquareHd), 1), 23); } + fn high_square_hd_is_23c() { assert_eq!(cost_cents(Some(RouterQuality::High), Some(RouterAspectRatio::SquareHd), 1), 23); } #[test] - fn high_auto_is_23c() { assert_eq!(cost_cents(Some(CommonQuality::High), None, 1), 23); } + fn high_auto_is_23c() { assert_eq!(cost_cents(Some(RouterQuality::High), None, 1), 23); } #[test] - fn high_landscape_4x3_is_15c() { assert_eq!(cost_cents(Some(CommonQuality::High), Some(CommonAspectRatio::WideFourByThree), 1), 15); } + fn high_landscape_4x3_is_15c() { assert_eq!(cost_cents(Some(RouterQuality::High), Some(RouterAspectRatio::WideFourByThree), 1), 15); } #[test] - fn high_landscape_16x9_is_16c() { assert_eq!(cost_cents(Some(CommonQuality::High), Some(CommonAspectRatio::WideSixteenByNine), 1), 16); } + fn high_landscape_16x9_is_16c() { assert_eq!(cost_cents(Some(RouterQuality::High), Some(RouterAspectRatio::WideSixteenByNine), 1), 16); } #[test] - fn high_square_four_is_88c() { assert_eq!(cost_cents(Some(CommonQuality::High), Some(CommonAspectRatio::Square), 4), 88); } + fn high_square_four_is_88c() { assert_eq!(cost_cents(Some(RouterQuality::High), Some(RouterAspectRatio::Square), 4), 88); } #[test] - fn high_square_hd_four_is_92c() { assert_eq!(cost_cents(Some(CommonQuality::High), Some(CommonAspectRatio::SquareHd), 4), 92); } + fn high_square_hd_four_is_92c() { assert_eq!(cost_cents(Some(RouterQuality::High), Some(RouterAspectRatio::SquareHd), 4), 92); } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/nano_banana/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/nano_banana/cost.rs index bd640cd659..13d76259d2 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/nano_banana/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/nano_banana/cost.rs @@ -31,15 +31,15 @@ impl ArtcraftNanoBananaCostState { #[cfg(test)] mod tests { - use crate::api::common_image_model::CommonImageModel; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_provider::RouterProvider; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::generate::generate_image::generate_image_request_builder::GenerateImageRequestBuilder; fn cost_cents(image_batch_count: u16) -> u64 { let builder = GenerateImageRequestBuilder { - model: CommonImageModel::NanoBanana, - provider: Provider::Artcraft, + model: RouterImageModel::NanoBanana, + provider: RouterProvider::Artcraft, prompt: None, image_inputs: None, resolution: None, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/nano_banana_2/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/nano_banana_2/cost.rs index d77bbdb7a3..fe14cb0f1d 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/nano_banana_2/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/nano_banana_2/cost.rs @@ -53,16 +53,16 @@ fn cost_per_image_in_cents(resolution: Option) -> u64 { #[cfg(test)] mod tests { - use crate::api::common_image_model::CommonImageModel; - use crate::api::common_resolution::CommonResolution; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_provider::RouterProvider; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::generate::generate_image::generate_image_request_builder::GenerateImageRequestBuilder; - fn cost_cents(resolution: Option, image_batch_count: u16) -> u64 { + fn cost_cents(resolution: Option, image_batch_count: u16) -> u64 { let builder = GenerateImageRequestBuilder { - model: CommonImageModel::NanoBanana2, - provider: Provider::Artcraft, + model: RouterImageModel::NanoBanana2, + provider: RouterProvider::Artcraft, prompt: None, image_inputs: None, resolution, @@ -88,36 +88,36 @@ mod tests { fn default_resolution_four_images_is_32c() { assert_eq!(cost_cents(None, 4), 32); } #[test] - fn one_k_one_image_is_8c() { assert_eq!(cost_cents(Some(CommonResolution::OneK), 1), 8); } + fn one_k_one_image_is_8c() { assert_eq!(cost_cents(Some(RouterResolution::OneK), 1), 8); } // ── 0.5K (6¢) ────────────────────────────────────────────────────────────── #[test] - fn half_k_one_image_is_6c() { assert_eq!(cost_cents(Some(CommonResolution::HalfK), 1), 6); } + fn half_k_one_image_is_6c() { assert_eq!(cost_cents(Some(RouterResolution::HalfK), 1), 6); } #[test] - fn half_k_four_images_is_24c() { assert_eq!(cost_cents(Some(CommonResolution::HalfK), 4), 24); } + fn half_k_four_images_is_24c() { assert_eq!(cost_cents(Some(RouterResolution::HalfK), 4), 24); } // ── 2K (12¢) ─────────────────────────────────────────────────────────────── #[test] - fn two_k_one_image_is_12c() { assert_eq!(cost_cents(Some(CommonResolution::TwoK), 1), 12); } + fn two_k_one_image_is_12c() { assert_eq!(cost_cents(Some(RouterResolution::TwoK), 1), 12); } #[test] - fn two_k_four_images_is_48c() { assert_eq!(cost_cents(Some(CommonResolution::TwoK), 4), 48); } + fn two_k_four_images_is_48c() { assert_eq!(cost_cents(Some(RouterResolution::TwoK), 4), 48); } // ── 3K falls back to 2K pricing ──────────────────────────────────────────── #[test] fn three_k_one_image_falls_back_to_two_k_pricing() { - assert_eq!(cost_cents(Some(CommonResolution::ThreeK), 1), 12); + assert_eq!(cost_cents(Some(RouterResolution::ThreeK), 1), 12); } // ── 4K (16¢) ─────────────────────────────────────────────────────────────── #[test] - fn four_k_one_image_is_16c() { assert_eq!(cost_cents(Some(CommonResolution::FourK), 1), 16); } + fn four_k_one_image_is_16c() { assert_eq!(cost_cents(Some(RouterResolution::FourK), 1), 16); } #[test] - fn four_k_four_images_is_64c() { assert_eq!(cost_cents(Some(CommonResolution::FourK), 4), 64); } + fn four_k_four_images_is_64c() { assert_eq!(cost_cents(Some(RouterResolution::FourK), 4), 64); } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/nano_banana_pro/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/nano_banana_pro/cost.rs index 20770addbb..59b96ca9ab 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/nano_banana_pro/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/nano_banana_pro/cost.rs @@ -42,16 +42,16 @@ impl ArtcraftNanoBananaProCostState { #[cfg(test)] mod tests { - use crate::api::common_image_model::CommonImageModel; - use crate::api::common_resolution::CommonResolution; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_provider::RouterProvider; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::generate::generate_image::generate_image_request_builder::GenerateImageRequestBuilder; - fn cost_cents(resolution: Option, image_batch_count: u16) -> u64 { + fn cost_cents(resolution: Option, image_batch_count: u16) -> u64 { let builder = GenerateImageRequestBuilder { - model: CommonImageModel::NanoBananaPro, - provider: Provider::Artcraft, + model: RouterImageModel::NanoBananaPro, + provider: RouterProvider::Artcraft, prompt: None, image_inputs: None, resolution, @@ -74,36 +74,36 @@ mod tests { fn default_resolution_one_image_is_15c() { assert_eq!(cost_cents(None, 1), 15); } #[test] - fn one_k_one_image_is_15c() { assert_eq!(cost_cents(Some(CommonResolution::OneK), 1), 15); } + fn one_k_one_image_is_15c() { assert_eq!(cost_cents(Some(RouterResolution::OneK), 1), 15); } #[test] - fn two_k_one_image_is_15c() { assert_eq!(cost_cents(Some(CommonResolution::TwoK), 1), 15); } + fn two_k_one_image_is_15c() { assert_eq!(cost_cents(Some(RouterResolution::TwoK), 1), 15); } #[test] - fn one_k_two_images_is_30c() { assert_eq!(cost_cents(Some(CommonResolution::OneK), 2), 30); } + fn one_k_two_images_is_30c() { assert_eq!(cost_cents(Some(RouterResolution::OneK), 2), 30); } #[test] - fn one_k_four_images_is_60c() { assert_eq!(cost_cents(Some(CommonResolution::OneK), 4), 60); } + fn one_k_four_images_is_60c() { assert_eq!(cost_cents(Some(RouterResolution::OneK), 4), 60); } // ── 4K → 30¢/image ──────────────────────────────────────────────────────── #[test] - fn four_k_one_image_is_30c() { assert_eq!(cost_cents(Some(CommonResolution::FourK), 1), 30); } + fn four_k_one_image_is_30c() { assert_eq!(cost_cents(Some(RouterResolution::FourK), 1), 30); } #[test] - fn four_k_two_images_is_60c() { assert_eq!(cost_cents(Some(CommonResolution::FourK), 2), 60); } + fn four_k_two_images_is_60c() { assert_eq!(cost_cents(Some(RouterResolution::FourK), 2), 60); } #[test] - fn four_k_four_images_is_120c() { assert_eq!(cost_cents(Some(CommonResolution::FourK), 4), 120); } + fn four_k_four_images_is_120c() { assert_eq!(cost_cents(Some(RouterResolution::FourK), 4), 120); } // ── 3K and legacy resolutions fall back to 15¢ ───────────────────────────── #[test] - fn three_k_falls_back_to_15c() { assert_eq!(cost_cents(Some(CommonResolution::ThreeK), 1), 15); } + fn three_k_falls_back_to_15c() { assert_eq!(cost_cents(Some(RouterResolution::ThreeK), 1), 15); } #[test] - fn half_k_falls_back_to_15c() { assert_eq!(cost_cents(Some(CommonResolution::HalfK), 1), 15); } + fn half_k_falls_back_to_15c() { assert_eq!(cost_cents(Some(RouterResolution::HalfK), 1), 15); } #[test] - fn ten_eighty_p_falls_back_to_15c() { assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 1), 15); } + fn ten_eighty_p_falls_back_to_15c() { assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 1), 15); } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/qwen_edit_2511_angles/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/qwen_edit_2511_angles/cost.rs index 6100c4163c..15fcb5a4de 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/qwen_edit_2511_angles/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/qwen_edit_2511_angles/cost.rs @@ -31,17 +31,17 @@ impl ArtcraftQwenEdit2511AnglesCostState { #[cfg(test)] mod tests { - use crate::api::common_image_model::CommonImageModel; + use crate::api::router_image_model::RouterImageModel; use crate::api::image_list_ref::ImageListRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::generate::generate_image::generate_image_request_builder::GenerateImageRequestBuilder; use tokens::tokens::media_files::MediaFileToken; fn cost_cents(image_batch_count: u16) -> u64 { let builder = GenerateImageRequestBuilder { - model: CommonImageModel::QwenEdit2511Angles, - provider: Provider::Artcraft, + model: RouterImageModel::QwenEdit2511Angles, + provider: RouterProvider::Artcraft, prompt: None, image_inputs: Some(ImageListRef::MediaFileTokens(vec![MediaFileToken::new_from_str("mf_test")])), resolution: None, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/seedream_4/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/seedream_4/cost.rs index 0bb3dec047..2bf027a283 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/seedream_4/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/seedream_4/cost.rs @@ -31,15 +31,15 @@ impl ArtcraftSeedream4CostState { #[cfg(test)] mod tests { - use crate::api::common_image_model::CommonImageModel; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_provider::RouterProvider; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::generate::generate_image::generate_image_request_builder::GenerateImageRequestBuilder; fn cost_cents(image_batch_count: u16) -> u64 { let builder = GenerateImageRequestBuilder { - model: CommonImageModel::Seedream4, - provider: Provider::Artcraft, + model: RouterImageModel::Seedream4, + provider: RouterProvider::Artcraft, prompt: None, image_inputs: None, resolution: None, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/seedream_4p5/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/seedream_4p5/cost.rs index 2004d3b390..27adb43ad6 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/seedream_4p5/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/seedream_4p5/cost.rs @@ -31,15 +31,15 @@ impl ArtcraftSeedream4p5CostState { #[cfg(test)] mod tests { - use crate::api::common_image_model::CommonImageModel; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_provider::RouterProvider; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::generate::generate_image::generate_image_request_builder::GenerateImageRequestBuilder; fn cost_cents(image_batch_count: u16) -> u64 { let builder = GenerateImageRequestBuilder { - model: CommonImageModel::Seedream4p5, - provider: Provider::Artcraft, + model: RouterImageModel::Seedream4p5, + provider: RouterProvider::Artcraft, prompt: None, image_inputs: None, resolution: None, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/seedream_5_lite/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/seedream_5_lite/cost.rs index 2202323c4c..9a05d52e60 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/seedream_5_lite/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/artcraft/seedream_5_lite/cost.rs @@ -31,15 +31,15 @@ impl ArtcraftSeedream5LiteCostState { #[cfg(test)] mod tests { - use crate::api::common_image_model::CommonImageModel; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_provider::RouterProvider; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::generate::generate_image::generate_image_request_builder::GenerateImageRequestBuilder; fn cost_cents(image_batch_count: u16) -> u64 { let builder = GenerateImageRequestBuilder { - model: CommonImageModel::Seedream5Lite, - provider: Provider::Artcraft, + model: RouterImageModel::Seedream5Lite, + provider: RouterProvider::Artcraft, prompt: None, image_inputs: None, resolution: None, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/flux_1_dev/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/flux_1_dev/build.rs index 0527101a88..cd796715a0 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/flux_1_dev/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/flux_1_dev/build.rs @@ -5,7 +5,7 @@ use fal_client::requests::api::image::text::flux_1_dev_text_to_image::api::{ Flux1DevTextToImageAspectRatio, Flux1DevTextToImageNumImages, Flux1DevTextToImageRequest, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; +use crate::api::router_aspect_ratio::RouterAspectRatio; use crate::api::image_list_ref::ImageListRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -101,20 +101,20 @@ fn to_edit_num_images(n: PlannedNumImages) -> Flux1DevEditImageNumImages { // ── Aspect ratio ── fn plan_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, ) -> Flux1DevTextToImageAspectRatio { use Flux1DevTextToImageAspectRatio as T; match aspect_ratio { - None | Some(CommonAspectRatio::Auto) | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto3k) | Some(CommonAspectRatio::Auto4k) => T::SquareHd, - Some(CommonAspectRatio::Square) => T::Square, - Some(CommonAspectRatio::SquareHd) => T::SquareHd, - Some(CommonAspectRatio::WideFourByThree) | Some(CommonAspectRatio::WideFiveByFour) - | Some(CommonAspectRatio::WideThreeByTwo) | Some(CommonAspectRatio::Wide) => T::LandscapeFourByThree, - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::WideTwentyOneByNine) => T::LandscapeSixteenByNine, - Some(CommonAspectRatio::TallThreeByFour) | Some(CommonAspectRatio::TallFourByFive) - | Some(CommonAspectRatio::TallTwoByThree) | Some(CommonAspectRatio::Tall) => T::PortraitThreeByFour, - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::TallNineByTwentyOne) => T::PortraitNineBySixteen, + None | Some(RouterAspectRatio::Auto) | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto3k) | Some(RouterAspectRatio::Auto4k) => T::SquareHd, + Some(RouterAspectRatio::Square) => T::Square, + Some(RouterAspectRatio::SquareHd) => T::SquareHd, + Some(RouterAspectRatio::WideFourByThree) | Some(RouterAspectRatio::WideFiveByFour) + | Some(RouterAspectRatio::WideThreeByTwo) | Some(RouterAspectRatio::Wide) => T::LandscapeFourByThree, + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::WideTwentyOneByNine) => T::LandscapeSixteenByNine, + Some(RouterAspectRatio::TallThreeByFour) | Some(RouterAspectRatio::TallFourByFive) + | Some(RouterAspectRatio::TallTwoByThree) | Some(RouterAspectRatio::Tall) => T::PortraitThreeByFour, + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::TallNineByTwentyOne) => T::PortraitNineBySixteen, } } @@ -144,13 +144,13 @@ fn resolve_single_image_url( #[cfg(test)] mod tests { use super::*; - use crate::api::common_image_model::CommonImageModel; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_provider::RouterProvider; fn base_builder() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::Flux1Dev, - provider: Provider::Fal, + model: RouterImageModel::Flux1Dev, + provider: RouterProvider::Fal, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -330,7 +330,7 @@ mod tests { #[test] fn auto_yields_square_hd() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Auto), + aspect_ratio: Some(RouterAspectRatio::Auto), ..base_builder() }; let req = unwrap_t2i(build_fal_flux_1_dev(builder)); @@ -340,7 +340,7 @@ mod tests { #[test] fn square() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Square), + aspect_ratio: Some(RouterAspectRatio::Square), ..base_builder() }; let req = unwrap_t2i(build_fal_flux_1_dev(builder)); @@ -350,7 +350,7 @@ mod tests { #[test] fn square_hd() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::SquareHd), + aspect_ratio: Some(RouterAspectRatio::SquareHd), ..base_builder() }; let req = unwrap_t2i(build_fal_flux_1_dev(builder)); @@ -360,7 +360,7 @@ mod tests { #[test] fn wide_four_by_three() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::WideFourByThree), + aspect_ratio: Some(RouterAspectRatio::WideFourByThree), ..base_builder() }; let req = unwrap_t2i(build_fal_flux_1_dev(builder)); @@ -370,7 +370,7 @@ mod tests { #[test] fn wide_sixteen_by_nine() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..base_builder() }; let req = unwrap_t2i(build_fal_flux_1_dev(builder)); @@ -380,7 +380,7 @@ mod tests { #[test] fn wide_twenty_one_by_nine_maps_to_sixteen_by_nine() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::WideTwentyOneByNine), + aspect_ratio: Some(RouterAspectRatio::WideTwentyOneByNine), ..base_builder() }; let req = unwrap_t2i(build_fal_flux_1_dev(builder)); @@ -390,7 +390,7 @@ mod tests { #[test] fn tall_three_by_four() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::TallThreeByFour), + aspect_ratio: Some(RouterAspectRatio::TallThreeByFour), ..base_builder() }; let req = unwrap_t2i(build_fal_flux_1_dev(builder)); @@ -400,7 +400,7 @@ mod tests { #[test] fn tall_nine_by_sixteen() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::TallNineBySixteen), + aspect_ratio: Some(RouterAspectRatio::TallNineBySixteen), ..base_builder() }; let req = unwrap_t2i(build_fal_flux_1_dev(builder)); diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/flux_1_schnell/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/flux_1_schnell/build.rs index fa956f54e1..8097f7660a 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/flux_1_schnell/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/flux_1_schnell/build.rs @@ -6,7 +6,7 @@ use fal_client::requests::api::image::text::flux_1_schnell_text_to_image::api::{ Flux1SchnellTextToImageRequest, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; +use crate::api::router_aspect_ratio::RouterAspectRatio; use crate::api::image_list_ref::ImageListRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -104,38 +104,38 @@ fn to_edit_num_images(n: PlannedNumImages) -> Flux1SchnellEditImageNumImages { // ── Aspect ratio ── fn plan_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, ) -> Flux1SchnellTextToImageAspectRatio { use Flux1SchnellTextToImageAspectRatio as T; match aspect_ratio { - None | Some(CommonAspectRatio::Auto) | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto3k) | Some(CommonAspectRatio::Auto4k) => T::SquareHd, - Some(CommonAspectRatio::Square) => T::Square, - Some(CommonAspectRatio::SquareHd) => T::SquareHd, - Some(CommonAspectRatio::WideFourByThree) | Some(CommonAspectRatio::WideFiveByFour) - | Some(CommonAspectRatio::WideThreeByTwo) | Some(CommonAspectRatio::Wide) => T::LandscapeFourByThree, - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::WideTwentyOneByNine) => T::LandscapeSixteenByNine, - Some(CommonAspectRatio::TallThreeByFour) | Some(CommonAspectRatio::TallFourByFive) - | Some(CommonAspectRatio::TallTwoByThree) | Some(CommonAspectRatio::Tall) => T::PortraitThreeByFour, - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::TallNineByTwentyOne) => T::PortraitNineBySixteen, + None | Some(RouterAspectRatio::Auto) | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto3k) | Some(RouterAspectRatio::Auto4k) => T::SquareHd, + Some(RouterAspectRatio::Square) => T::Square, + Some(RouterAspectRatio::SquareHd) => T::SquareHd, + Some(RouterAspectRatio::WideFourByThree) | Some(RouterAspectRatio::WideFiveByFour) + | Some(RouterAspectRatio::WideThreeByTwo) | Some(RouterAspectRatio::Wide) => T::LandscapeFourByThree, + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::WideTwentyOneByNine) => T::LandscapeSixteenByNine, + Some(RouterAspectRatio::TallThreeByFour) | Some(RouterAspectRatio::TallFourByFive) + | Some(RouterAspectRatio::TallTwoByThree) | Some(RouterAspectRatio::Tall) => T::PortraitThreeByFour, + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::TallNineByTwentyOne) => T::PortraitNineBySixteen, } } fn plan_edit_image_size( - aspect_ratio: Option, + aspect_ratio: Option, ) -> Option { use Flux1SchnellEditImageSize as S; aspect_ratio.and_then(|ar| match ar { - CommonAspectRatio::Auto | CommonAspectRatio::Auto2k - | CommonAspectRatio::Auto3k | CommonAspectRatio::Auto4k => None, - CommonAspectRatio::Square => Some(S::Square), - CommonAspectRatio::SquareHd => Some(S::SquareHd), - CommonAspectRatio::WideFourByThree | CommonAspectRatio::WideFiveByFour - | CommonAspectRatio::WideThreeByTwo | CommonAspectRatio::Wide => Some(S::LandscapeFourByThree), - CommonAspectRatio::WideSixteenByNine | CommonAspectRatio::WideTwentyOneByNine => Some(S::LandscapeSixteenByNine), - CommonAspectRatio::TallThreeByFour | CommonAspectRatio::TallFourByFive - | CommonAspectRatio::TallTwoByThree | CommonAspectRatio::Tall => Some(S::PortraitThreeByFour), - CommonAspectRatio::TallNineBySixteen | CommonAspectRatio::TallNineByTwentyOne => Some(S::PortraitNineBySixteen), + RouterAspectRatio::Auto | RouterAspectRatio::Auto2k + | RouterAspectRatio::Auto3k | RouterAspectRatio::Auto4k => None, + RouterAspectRatio::Square => Some(S::Square), + RouterAspectRatio::SquareHd => Some(S::SquareHd), + RouterAspectRatio::WideFourByThree | RouterAspectRatio::WideFiveByFour + | RouterAspectRatio::WideThreeByTwo | RouterAspectRatio::Wide => Some(S::LandscapeFourByThree), + RouterAspectRatio::WideSixteenByNine | RouterAspectRatio::WideTwentyOneByNine => Some(S::LandscapeSixteenByNine), + RouterAspectRatio::TallThreeByFour | RouterAspectRatio::TallFourByFive + | RouterAspectRatio::TallTwoByThree | RouterAspectRatio::Tall => Some(S::PortraitThreeByFour), + RouterAspectRatio::TallNineBySixteen | RouterAspectRatio::TallNineByTwentyOne => Some(S::PortraitNineBySixteen), }) } @@ -165,13 +165,13 @@ fn resolve_single_image_url( #[cfg(test)] mod tests { use super::*; - use crate::api::common_image_model::CommonImageModel; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_provider::RouterProvider; fn base_builder() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::Flux1Schnell, - provider: Provider::Fal, + model: RouterImageModel::Flux1Schnell, + provider: RouterProvider::Fal, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -351,7 +351,7 @@ mod tests { #[test] fn square() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Square), + aspect_ratio: Some(RouterAspectRatio::Square), ..base_builder() }; let req = unwrap_t2i(build_fal_flux_1_schnell(builder)); @@ -361,7 +361,7 @@ mod tests { #[test] fn wide_sixteen_by_nine() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..base_builder() }; let req = unwrap_t2i(build_fal_flux_1_schnell(builder)); @@ -371,7 +371,7 @@ mod tests { #[test] fn tall_nine_by_sixteen() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::TallNineBySixteen), + aspect_ratio: Some(RouterAspectRatio::TallNineBySixteen), ..base_builder() }; let req = unwrap_t2i(build_fal_flux_1_schnell(builder)); @@ -381,7 +381,7 @@ mod tests { #[test] fn edit_auto_yields_none() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Auto), + aspect_ratio: Some(RouterAspectRatio::Auto), image_inputs: Some(ImageListRef::Urls(vec!["https://example.com/img.jpg".to_string()])), ..base_builder() }; @@ -392,7 +392,7 @@ mod tests { #[test] fn edit_square() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Square), + aspect_ratio: Some(RouterAspectRatio::Square), image_inputs: Some(ImageListRef::Urls(vec!["https://example.com/img.jpg".to_string()])), ..base_builder() }; @@ -403,7 +403,7 @@ mod tests { #[test] fn edit_landscape() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), image_inputs: Some(ImageListRef::Urls(vec!["https://example.com/img.jpg".to_string()])), ..base_builder() }; diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/flux_2_lora_angles/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/flux_2_lora_angles/build.rs index 7537a716cb..6ee0173159 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/flux_2_lora_angles/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/flux_2_lora_angles/build.rs @@ -3,7 +3,7 @@ use fal_client::requests::webhook::image::angle::enqueue_flux_2_lora_edit_image_ EnqueueFlux2LoraEditImageAngleRequest, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; +use crate::api::router_aspect_ratio::RouterAspectRatio; use crate::api::image_list_ref::ImageListRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -79,26 +79,26 @@ fn plan_num_images( } fn plan_image_size( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { use EnqueueFlux2LoraAngleImageSize as S; match aspect_ratio { None => Ok(None), - Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto3k) - | Some(CommonAspectRatio::Auto4k) => Ok(Some(S::SquareHd)), + Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto3k) + | Some(RouterAspectRatio::Auto4k) => Ok(Some(S::SquareHd)), - Some(CommonAspectRatio::Square) => Ok(Some(S::Square)), - Some(CommonAspectRatio::SquareHd) => Ok(Some(S::SquareHd)), + Some(RouterAspectRatio::Square) => Ok(Some(S::Square)), + Some(RouterAspectRatio::SquareHd) => Ok(Some(S::SquareHd)), - Some(CommonAspectRatio::Wide) | Some(CommonAspectRatio::WideSixteenByNine) => Ok(Some(S::LandscapeSixteenNine)), - Some(CommonAspectRatio::WideFourByThree) => Ok(Some(S::LandscapeFourThree)), + Some(RouterAspectRatio::Wide) | Some(RouterAspectRatio::WideSixteenByNine) => Ok(Some(S::LandscapeSixteenNine)), + Some(RouterAspectRatio::WideFourByThree) => Ok(Some(S::LandscapeFourThree)), - Some(CommonAspectRatio::Tall) | Some(CommonAspectRatio::TallNineBySixteen) => Ok(Some(S::PortraitSixteenNine)), - Some(CommonAspectRatio::TallThreeByFour) => Ok(Some(S::PortraitFourThree)), + Some(RouterAspectRatio::Tall) | Some(RouterAspectRatio::TallNineBySixteen) => Ok(Some(S::PortraitSixteenNine)), + Some(RouterAspectRatio::TallThreeByFour) => Ok(Some(S::PortraitFourThree)), Some(unsupported) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -115,13 +115,13 @@ fn plan_image_size( #[cfg(test)] mod tests { use super::*; - use crate::api::common_image_model::CommonImageModel; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_provider::RouterProvider; fn base() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::Flux2LoraAngles, - provider: Provider::Fal, + model: RouterImageModel::Flux2LoraAngles, + provider: RouterProvider::Fal, prompt: None, image_inputs: Some(ImageListRef::Urls(vec!["https://example.com/x.jpg".to_string()])), resolution: None, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/flux_pro_1p1/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/flux_pro_1p1/build.rs index eb5bda88b7..a92dacfae0 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/flux_pro_1p1/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/flux_pro_1p1/build.rs @@ -2,7 +2,7 @@ use fal_client::requests::webhook::image::text::enqueue_flux_pro_11_text_to_imag FluxPro11AspectRatio, FluxPro11NumImages, FluxPro11Request, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; +use crate::api::router_aspect_ratio::RouterAspectRatio; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; use crate::errors::client_error::ClientError; @@ -40,30 +40,30 @@ pub fn build_fal_flux_pro_1p1( } fn plan_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result { use FluxPro11AspectRatio as Ar; match aspect_ratio { None => Ok(Ar::Square), - Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto4k) => Ok(Ar::Square), + Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto4k) => Ok(Ar::Square), - Some(CommonAspectRatio::Square) => Ok(Ar::Square), - Some(CommonAspectRatio::SquareHd) => Ok(Ar::SquareHd), - Some(CommonAspectRatio::WideFourByThree) => Ok(Ar::LandscapeFourByThree), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Ar::LandscapeSixteenByNine), - Some(CommonAspectRatio::TallThreeByFour) => Ok(Ar::PortraitThreeByFour), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Ar::PortraitNineBySixteen), + Some(RouterAspectRatio::Square) => Ok(Ar::Square), + Some(RouterAspectRatio::SquareHd) => Ok(Ar::SquareHd), + Some(RouterAspectRatio::WideFourByThree) => Ok(Ar::LandscapeFourByThree), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Ar::LandscapeSixteenByNine), + Some(RouterAspectRatio::TallThreeByFour) => Ok(Ar::PortraitThreeByFour), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Ar::PortraitNineBySixteen), - Some(CommonAspectRatio::WideFiveByFour) => Ok(Ar::LandscapeFourByThree), - Some(CommonAspectRatio::WideThreeByTwo) => Ok(Ar::LandscapeFourByThree), - Some(CommonAspectRatio::WideTwentyOneByNine) => Ok(Ar::LandscapeSixteenByNine), - Some(CommonAspectRatio::TallFourByFive) => Ok(Ar::PortraitThreeByFour), - Some(CommonAspectRatio::TallTwoByThree) => Ok(Ar::PortraitThreeByFour), - Some(CommonAspectRatio::TallNineByTwentyOne) => Ok(Ar::PortraitNineBySixteen), + Some(RouterAspectRatio::WideFiveByFour) => Ok(Ar::LandscapeFourByThree), + Some(RouterAspectRatio::WideThreeByTwo) => Ok(Ar::LandscapeFourByThree), + Some(RouterAspectRatio::WideTwentyOneByNine) => Ok(Ar::LandscapeSixteenByNine), + Some(RouterAspectRatio::TallFourByFive) => Ok(Ar::PortraitThreeByFour), + Some(RouterAspectRatio::TallTwoByThree) => Ok(Ar::PortraitThreeByFour), + Some(RouterAspectRatio::TallNineByTwentyOne) => Ok(Ar::PortraitNineBySixteen), Some(unsupported) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -103,14 +103,14 @@ fn plan_num_images( #[cfg(test)] mod tests { use super::*; - use crate::api::common_image_model::CommonImageModel; + use crate::api::router_image_model::RouterImageModel; use crate::api::image_list_ref::ImageListRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; fn base_builder() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::FluxPro11, - provider: Provider::Fal, + model: RouterImageModel::FluxPro11, + provider: RouterProvider::Fal, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -186,7 +186,7 @@ mod tests { #[test] fn auto_maps_to_square() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Auto), + aspect_ratio: Some(RouterAspectRatio::Auto), ..base_builder() }; let req = unwrap_request(build_fal_flux_pro_1p1(builder)); @@ -196,7 +196,7 @@ mod tests { #[test] fn square_hd() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::SquareHd), + aspect_ratio: Some(RouterAspectRatio::SquareHd), ..base_builder() }; let req = unwrap_request(build_fal_flux_pro_1p1(builder)); @@ -206,7 +206,7 @@ mod tests { #[test] fn wide_sixteen_by_nine() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..base_builder() }; let req = unwrap_request(build_fal_flux_pro_1p1(builder)); @@ -216,7 +216,7 @@ mod tests { #[test] fn tall_nine_by_sixteen() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::TallNineBySixteen), + aspect_ratio: Some(RouterAspectRatio::TallNineBySixteen), ..base_builder() }; let req = unwrap_request(build_fal_flux_pro_1p1(builder)); @@ -226,7 +226,7 @@ mod tests { #[test] fn wide_twenty_one_by_nine_collapses_to_sixteen_by_nine() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::WideTwentyOneByNine), + aspect_ratio: Some(RouterAspectRatio::WideTwentyOneByNine), ..base_builder() }; let req = unwrap_request(build_fal_flux_pro_1p1(builder)); @@ -236,7 +236,7 @@ mod tests { #[test] fn tall_four_by_five_collapses_to_three_by_four() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::TallFourByFive), + aspect_ratio: Some(RouterAspectRatio::TallFourByFive), ..base_builder() }; let req = unwrap_request(build_fal_flux_pro_1p1(builder)); diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/flux_pro_1p1_ultra/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/flux_pro_1p1_ultra/build.rs index 74179da342..9b4adbf9df 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/flux_pro_1p1_ultra/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/flux_pro_1p1_ultra/build.rs @@ -2,7 +2,7 @@ use fal_client::requests::webhook::image::text::enqueue_flux_pro_11_ultra_text_t FluxPro11UltraAspectRatio, FluxPro11UltraNumImages, FluxPro11UltraRequest, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; +use crate::api::router_aspect_ratio::RouterAspectRatio; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; use crate::errors::client_error::ClientError; @@ -41,29 +41,29 @@ pub fn build_fal_flux_pro_1p1_ultra( } fn plan_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result { use FluxPro11UltraAspectRatio as Ar; match aspect_ratio { None => Ok(Ar::Square), - Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto4k) => Ok(Ar::Square), + Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto4k) => Ok(Ar::Square), - Some(CommonAspectRatio::Square) | Some(CommonAspectRatio::SquareHd) => Ok(Ar::Square), - Some(CommonAspectRatio::WideFourByThree) => Ok(Ar::LandscapeFourByThree), - Some(CommonAspectRatio::WideThreeByTwo) => Ok(Ar::LandscapeThreeByTwo), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Ar::LandscapeSixteenByNine), - Some(CommonAspectRatio::WideTwentyOneByNine) => Ok(Ar::LandscapeTwentyOneByNine), - Some(CommonAspectRatio::TallThreeByFour) => Ok(Ar::PortraitThreeByFour), - Some(CommonAspectRatio::TallTwoByThree) => Ok(Ar::PortraitTwoByThree), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Ar::PortraitNineBySixteen), - Some(CommonAspectRatio::TallNineByTwentyOne) => Ok(Ar::PortraitNineByTwentyOne), + Some(RouterAspectRatio::Square) | Some(RouterAspectRatio::SquareHd) => Ok(Ar::Square), + Some(RouterAspectRatio::WideFourByThree) => Ok(Ar::LandscapeFourByThree), + Some(RouterAspectRatio::WideThreeByTwo) => Ok(Ar::LandscapeThreeByTwo), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Ar::LandscapeSixteenByNine), + Some(RouterAspectRatio::WideTwentyOneByNine) => Ok(Ar::LandscapeTwentyOneByNine), + Some(RouterAspectRatio::TallThreeByFour) => Ok(Ar::PortraitThreeByFour), + Some(RouterAspectRatio::TallTwoByThree) => Ok(Ar::PortraitTwoByThree), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Ar::PortraitNineBySixteen), + Some(RouterAspectRatio::TallNineByTwentyOne) => Ok(Ar::PortraitNineByTwentyOne), - Some(CommonAspectRatio::WideFiveByFour) => Ok(Ar::LandscapeFourByThree), - Some(CommonAspectRatio::TallFourByFive) => Ok(Ar::PortraitThreeByFour), + Some(RouterAspectRatio::WideFiveByFour) => Ok(Ar::LandscapeFourByThree), + Some(RouterAspectRatio::TallFourByFive) => Ok(Ar::PortraitThreeByFour), Some(unsupported) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -103,14 +103,14 @@ fn plan_num_images( #[cfg(test)] mod tests { use super::*; - use crate::api::common_image_model::CommonImageModel; + use crate::api::router_image_model::RouterImageModel; use crate::api::image_list_ref::ImageListRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; fn base_builder() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::FluxPro11Ultra, - provider: Provider::Fal, + model: RouterImageModel::FluxPro11Ultra, + provider: RouterProvider::Fal, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -186,7 +186,7 @@ mod tests { #[test] fn wide_sixteen_by_nine() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..base_builder() }; let req = unwrap_request(build_fal_flux_pro_1p1_ultra(builder)); @@ -196,7 +196,7 @@ mod tests { #[test] fn wide_three_by_two_has_direct_mapping() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::WideThreeByTwo), + aspect_ratio: Some(RouterAspectRatio::WideThreeByTwo), ..base_builder() }; let req = unwrap_request(build_fal_flux_pro_1p1_ultra(builder)); @@ -206,7 +206,7 @@ mod tests { #[test] fn tall_two_by_three_has_direct_mapping() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::TallTwoByThree), + aspect_ratio: Some(RouterAspectRatio::TallTwoByThree), ..base_builder() }; let req = unwrap_request(build_fal_flux_pro_1p1_ultra(builder)); @@ -216,7 +216,7 @@ mod tests { #[test] fn wide_twenty_one_by_nine_has_direct_mapping() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::WideTwentyOneByNine), + aspect_ratio: Some(RouterAspectRatio::WideTwentyOneByNine), ..base_builder() }; let req = unwrap_request(build_fal_flux_pro_1p1_ultra(builder)); @@ -226,7 +226,7 @@ mod tests { #[test] fn square_hd_collapses_to_square() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::SquareHd), + aspect_ratio: Some(RouterAspectRatio::SquareHd), ..base_builder() }; let req = unwrap_request(build_fal_flux_pro_1p1_ultra(builder)); diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/gpt_image_1/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/gpt_image_1/build.rs index 14f897dea8..94de9e018c 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/gpt_image_1/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/gpt_image_1/build.rs @@ -7,8 +7,8 @@ use fal_client::requests::api::image::text::gpt_image_1_text_to_image::api::{ GptImage1TextToImageRequest, GptImage1TextToImageSize, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_quality::CommonQuality; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_quality::RouterQuality; use crate::api::image_list_ref::ImageListRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -100,36 +100,36 @@ fn plan_num_images( } } -fn plan_quality(quality: Option) -> PlannedQuality { +fn plan_quality(quality: Option) -> PlannedQuality { match quality { - Some(CommonQuality::Low) => PlannedQuality::Low, - Some(CommonQuality::Medium) => PlannedQuality::Medium, - Some(CommonQuality::High) | None => PlannedQuality::High, + Some(RouterQuality::Low) => PlannedQuality::Low, + Some(RouterQuality::Medium) => PlannedQuality::Medium, + Some(RouterQuality::High) | None => PlannedQuality::High, } } -fn plan_image_size(aspect_ratio: Option) -> Option { +fn plan_image_size(aspect_ratio: Option) -> Option { match aspect_ratio { None - | Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto3k) - | Some(CommonAspectRatio::Auto4k) => None, - Some(CommonAspectRatio::Square) | Some(CommonAspectRatio::SquareHd) => { + | Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto3k) + | Some(RouterAspectRatio::Auto4k) => None, + Some(RouterAspectRatio::Square) | Some(RouterAspectRatio::SquareHd) => { Some(PlannedImageSize::Square) } - Some(CommonAspectRatio::WideThreeByTwo) - | Some(CommonAspectRatio::WideFourByThree) - | Some(CommonAspectRatio::WideFiveByFour) - | Some(CommonAspectRatio::WideSixteenByNine) - | Some(CommonAspectRatio::WideTwentyOneByNine) - | Some(CommonAspectRatio::Wide) => Some(PlannedImageSize::Horizontal), - Some(CommonAspectRatio::TallTwoByThree) - | Some(CommonAspectRatio::TallThreeByFour) - | Some(CommonAspectRatio::TallFourByFive) - | Some(CommonAspectRatio::TallNineBySixteen) - | Some(CommonAspectRatio::TallNineByTwentyOne) - | Some(CommonAspectRatio::Tall) => Some(PlannedImageSize::Vertical), + Some(RouterAspectRatio::WideThreeByTwo) + | Some(RouterAspectRatio::WideFourByThree) + | Some(RouterAspectRatio::WideFiveByFour) + | Some(RouterAspectRatio::WideSixteenByNine) + | Some(RouterAspectRatio::WideTwentyOneByNine) + | Some(RouterAspectRatio::Wide) => Some(PlannedImageSize::Horizontal), + Some(RouterAspectRatio::TallTwoByThree) + | Some(RouterAspectRatio::TallThreeByFour) + | Some(RouterAspectRatio::TallFourByFive) + | Some(RouterAspectRatio::TallNineBySixteen) + | Some(RouterAspectRatio::TallNineByTwentyOne) + | Some(RouterAspectRatio::Tall) => Some(PlannedImageSize::Vertical), } } @@ -200,13 +200,13 @@ mod tests { use super::*; use std::fmt::Debug; - use crate::api::common_image_model::CommonImageModel; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_provider::RouterProvider; fn base_builder() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::GptImage1, - provider: Provider::Fal, + model: RouterImageModel::GptImage1, + provider: RouterProvider::Fal, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -334,9 +334,9 @@ mod tests { fn quality_maps_exhaustively_for_text_and_edit() { let cases = [ (None, "Some(High)"), - (Some(CommonQuality::Low), "Some(Low)"), - (Some(CommonQuality::Medium), "Some(Medium)"), - (Some(CommonQuality::High), "Some(High)"), + (Some(RouterQuality::Low), "Some(Low)"), + (Some(RouterQuality::Medium), "Some(Medium)"), + (Some(RouterQuality::High), "Some(High)"), ]; for (quality, expected) in cases { @@ -361,24 +361,24 @@ mod tests { fn aspect_ratio_maps_exhaustively_for_text_and_edit() { let cases = [ (None, "None"), - (Some(CommonAspectRatio::Auto), "None"), - (Some(CommonAspectRatio::Auto2k), "None"), - (Some(CommonAspectRatio::Auto3k), "None"), - (Some(CommonAspectRatio::Auto4k), "None"), - (Some(CommonAspectRatio::Square), "Some(Square)"), - (Some(CommonAspectRatio::SquareHd), "Some(Square)"), - (Some(CommonAspectRatio::WideThreeByTwo), "Some(Horizontal)"), - (Some(CommonAspectRatio::WideFourByThree), "Some(Horizontal)"), - (Some(CommonAspectRatio::WideFiveByFour), "Some(Horizontal)"), - (Some(CommonAspectRatio::WideSixteenByNine), "Some(Horizontal)"), - (Some(CommonAspectRatio::WideTwentyOneByNine), "Some(Horizontal)"), - (Some(CommonAspectRatio::Wide), "Some(Horizontal)"), - (Some(CommonAspectRatio::TallTwoByThree), "Some(Vertical)"), - (Some(CommonAspectRatio::TallThreeByFour), "Some(Vertical)"), - (Some(CommonAspectRatio::TallFourByFive), "Some(Vertical)"), - (Some(CommonAspectRatio::TallNineBySixteen), "Some(Vertical)"), - (Some(CommonAspectRatio::TallNineByTwentyOne), "Some(Vertical)"), - (Some(CommonAspectRatio::Tall), "Some(Vertical)"), + (Some(RouterAspectRatio::Auto), "None"), + (Some(RouterAspectRatio::Auto2k), "None"), + (Some(RouterAspectRatio::Auto3k), "None"), + (Some(RouterAspectRatio::Auto4k), "None"), + (Some(RouterAspectRatio::Square), "Some(Square)"), + (Some(RouterAspectRatio::SquareHd), "Some(Square)"), + (Some(RouterAspectRatio::WideThreeByTwo), "Some(Horizontal)"), + (Some(RouterAspectRatio::WideFourByThree), "Some(Horizontal)"), + (Some(RouterAspectRatio::WideFiveByFour), "Some(Horizontal)"), + (Some(RouterAspectRatio::WideSixteenByNine), "Some(Horizontal)"), + (Some(RouterAspectRatio::WideTwentyOneByNine), "Some(Horizontal)"), + (Some(RouterAspectRatio::Wide), "Some(Horizontal)"), + (Some(RouterAspectRatio::TallTwoByThree), "Some(Vertical)"), + (Some(RouterAspectRatio::TallThreeByFour), "Some(Vertical)"), + (Some(RouterAspectRatio::TallFourByFive), "Some(Vertical)"), + (Some(RouterAspectRatio::TallNineBySixteen), "Some(Vertical)"), + (Some(RouterAspectRatio::TallNineByTwentyOne), "Some(Vertical)"), + (Some(RouterAspectRatio::Tall), "Some(Vertical)"), ]; for (aspect_ratio, expected) in cases { diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/gpt_image_1p5/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/gpt_image_1p5/build.rs index 3ab3c2cc59..24bd226bef 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/gpt_image_1p5/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/gpt_image_1p5/build.rs @@ -7,8 +7,8 @@ use fal_client::requests::api::image::text::gpt_image_1p5_text_to_image::api::{ GptImage1p5TextToImageRequest, GptImage1p5TextToImageSize, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_quality::CommonQuality; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_quality::RouterQuality; use crate::api::image_list_ref::ImageListRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -100,36 +100,36 @@ fn plan_num_images( } } -fn plan_quality(quality: Option) -> PlannedQuality { +fn plan_quality(quality: Option) -> PlannedQuality { match quality { - Some(CommonQuality::Low) => PlannedQuality::Low, - Some(CommonQuality::Medium) => PlannedQuality::Medium, - Some(CommonQuality::High) | None => PlannedQuality::High, + Some(RouterQuality::Low) => PlannedQuality::Low, + Some(RouterQuality::Medium) => PlannedQuality::Medium, + Some(RouterQuality::High) | None => PlannedQuality::High, } } -fn plan_image_size(aspect_ratio: Option) -> Option { +fn plan_image_size(aspect_ratio: Option) -> Option { match aspect_ratio { None - | Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto3k) - | Some(CommonAspectRatio::Auto4k) => None, - Some(CommonAspectRatio::Square) | Some(CommonAspectRatio::SquareHd) => { + | Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto3k) + | Some(RouterAspectRatio::Auto4k) => None, + Some(RouterAspectRatio::Square) | Some(RouterAspectRatio::SquareHd) => { Some(PlannedImageSize::Square) } - Some(CommonAspectRatio::WideThreeByTwo) - | Some(CommonAspectRatio::WideFourByThree) - | Some(CommonAspectRatio::WideFiveByFour) - | Some(CommonAspectRatio::WideSixteenByNine) - | Some(CommonAspectRatio::WideTwentyOneByNine) - | Some(CommonAspectRatio::Wide) => Some(PlannedImageSize::Wide), - Some(CommonAspectRatio::TallTwoByThree) - | Some(CommonAspectRatio::TallThreeByFour) - | Some(CommonAspectRatio::TallFourByFive) - | Some(CommonAspectRatio::TallNineBySixteen) - | Some(CommonAspectRatio::TallNineByTwentyOne) - | Some(CommonAspectRatio::Tall) => Some(PlannedImageSize::Tall), + Some(RouterAspectRatio::WideThreeByTwo) + | Some(RouterAspectRatio::WideFourByThree) + | Some(RouterAspectRatio::WideFiveByFour) + | Some(RouterAspectRatio::WideSixteenByNine) + | Some(RouterAspectRatio::WideTwentyOneByNine) + | Some(RouterAspectRatio::Wide) => Some(PlannedImageSize::Wide), + Some(RouterAspectRatio::TallTwoByThree) + | Some(RouterAspectRatio::TallThreeByFour) + | Some(RouterAspectRatio::TallFourByFive) + | Some(RouterAspectRatio::TallNineBySixteen) + | Some(RouterAspectRatio::TallNineByTwentyOne) + | Some(RouterAspectRatio::Tall) => Some(PlannedImageSize::Tall), } } @@ -200,13 +200,13 @@ mod tests { use super::*; use std::fmt::Debug; - use crate::api::common_image_model::CommonImageModel; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_provider::RouterProvider; fn base_builder() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::GptImage1p5, - provider: Provider::Fal, + model: RouterImageModel::GptImage1p5, + provider: RouterProvider::Fal, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -334,9 +334,9 @@ mod tests { fn quality_maps_exhaustively_for_text_and_edit() { let cases = [ (None, "Some(High)"), - (Some(CommonQuality::Low), "Some(Low)"), - (Some(CommonQuality::Medium), "Some(Medium)"), - (Some(CommonQuality::High), "Some(High)"), + (Some(RouterQuality::Low), "Some(Low)"), + (Some(RouterQuality::Medium), "Some(Medium)"), + (Some(RouterQuality::High), "Some(High)"), ]; for (quality, expected) in cases { @@ -361,24 +361,24 @@ mod tests { fn aspect_ratio_maps_exhaustively_for_text_and_edit() { let cases = [ (None, "None"), - (Some(CommonAspectRatio::Auto), "None"), - (Some(CommonAspectRatio::Auto2k), "None"), - (Some(CommonAspectRatio::Auto3k), "None"), - (Some(CommonAspectRatio::Auto4k), "None"), - (Some(CommonAspectRatio::Square), "Some(Square)"), - (Some(CommonAspectRatio::SquareHd), "Some(Square)"), - (Some(CommonAspectRatio::WideThreeByTwo), "Some(Wide)"), - (Some(CommonAspectRatio::WideFourByThree), "Some(Wide)"), - (Some(CommonAspectRatio::WideFiveByFour), "Some(Wide)"), - (Some(CommonAspectRatio::WideSixteenByNine), "Some(Wide)"), - (Some(CommonAspectRatio::WideTwentyOneByNine), "Some(Wide)"), - (Some(CommonAspectRatio::Wide), "Some(Wide)"), - (Some(CommonAspectRatio::TallTwoByThree), "Some(Tall)"), - (Some(CommonAspectRatio::TallThreeByFour), "Some(Tall)"), - (Some(CommonAspectRatio::TallFourByFive), "Some(Tall)"), - (Some(CommonAspectRatio::TallNineBySixteen), "Some(Tall)"), - (Some(CommonAspectRatio::TallNineByTwentyOne), "Some(Tall)"), - (Some(CommonAspectRatio::Tall), "Some(Tall)"), + (Some(RouterAspectRatio::Auto), "None"), + (Some(RouterAspectRatio::Auto2k), "None"), + (Some(RouterAspectRatio::Auto3k), "None"), + (Some(RouterAspectRatio::Auto4k), "None"), + (Some(RouterAspectRatio::Square), "Some(Square)"), + (Some(RouterAspectRatio::SquareHd), "Some(Square)"), + (Some(RouterAspectRatio::WideThreeByTwo), "Some(Wide)"), + (Some(RouterAspectRatio::WideFourByThree), "Some(Wide)"), + (Some(RouterAspectRatio::WideFiveByFour), "Some(Wide)"), + (Some(RouterAspectRatio::WideSixteenByNine), "Some(Wide)"), + (Some(RouterAspectRatio::WideTwentyOneByNine), "Some(Wide)"), + (Some(RouterAspectRatio::Wide), "Some(Wide)"), + (Some(RouterAspectRatio::TallTwoByThree), "Some(Tall)"), + (Some(RouterAspectRatio::TallThreeByFour), "Some(Tall)"), + (Some(RouterAspectRatio::TallFourByFive), "Some(Tall)"), + (Some(RouterAspectRatio::TallNineBySixteen), "Some(Tall)"), + (Some(RouterAspectRatio::TallNineByTwentyOne), "Some(Tall)"), + (Some(RouterAspectRatio::Tall), "Some(Tall)"), ]; for (aspect_ratio, expected) in cases { diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/gpt_image_2/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/gpt_image_2/build.rs index 64524a1735..086a35cd6a 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/gpt_image_2/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/gpt_image_2/build.rs @@ -8,9 +8,9 @@ use fal_client::requests::api::image::text::gpt_image_2_text_to_image::api::{ GptImage2TextToImageRequest, GptImage2TextToImageSize, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_quality::CommonQuality; -use crate::api::common_resolution::CommonResolution; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_quality::RouterQuality; +use crate::api::router_resolution::RouterResolution; use crate::api::image_list_ref::ImageListRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -106,47 +106,47 @@ fn plan_num_images( } } -fn plan_quality(quality: Option) -> PlannedQuality { +fn plan_quality(quality: Option) -> PlannedQuality { match quality { - Some(CommonQuality::Low) => PlannedQuality::Low, - Some(CommonQuality::Medium) => PlannedQuality::Medium, - Some(CommonQuality::High) | None => PlannedQuality::High, + Some(RouterQuality::Low) => PlannedQuality::Low, + Some(RouterQuality::Medium) => PlannedQuality::Medium, + Some(RouterQuality::High) | None => PlannedQuality::High, } } -fn plan_resolution(resolution: Option) -> Option { +fn plan_resolution(resolution: Option) -> Option { resolution.map(|r| match r { - CommonResolution::HalfK - | CommonResolution::FourEightyP - | CommonResolution::SevenTwentyP - | CommonResolution::OneK => GptImage2Resolution::OneK, - CommonResolution::TenEightyP | CommonResolution::TwoK => GptImage2Resolution::TwoK, - CommonResolution::ThreeK => GptImage2Resolution::ThreeK, - CommonResolution::FourK => GptImage2Resolution::FourK, + RouterResolution::HalfK + | RouterResolution::FourEightyP + | RouterResolution::SevenTwentyP + | RouterResolution::OneK => GptImage2Resolution::OneK, + RouterResolution::TenEightyP | RouterResolution::TwoK => GptImage2Resolution::TwoK, + RouterResolution::ThreeK => GptImage2Resolution::ThreeK, + RouterResolution::FourK => GptImage2Resolution::FourK, }) } -fn plan_image_size(aspect_ratio: Option) -> Option { +fn plan_image_size(aspect_ratio: Option) -> Option { match aspect_ratio { None => None, - Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto3k) - | Some(CommonAspectRatio::Auto4k) => Some(PlannedImageSize::Auto), - Some(CommonAspectRatio::Square) => Some(PlannedImageSize::Square), - Some(CommonAspectRatio::SquareHd) => Some(PlannedImageSize::SquareHd), - Some(CommonAspectRatio::WideFourByThree) - | Some(CommonAspectRatio::WideFiveByFour) => Some(PlannedImageSize::Landscape4x3), - Some(CommonAspectRatio::WideThreeByTwo) - | Some(CommonAspectRatio::WideSixteenByNine) - | Some(CommonAspectRatio::WideTwentyOneByNine) - | Some(CommonAspectRatio::Wide) => Some(PlannedImageSize::Landscape16x9), - Some(CommonAspectRatio::TallThreeByFour) - | Some(CommonAspectRatio::TallFourByFive) => Some(PlannedImageSize::Portrait4x3), - Some(CommonAspectRatio::TallTwoByThree) - | Some(CommonAspectRatio::TallNineBySixteen) - | Some(CommonAspectRatio::TallNineByTwentyOne) - | Some(CommonAspectRatio::Tall) => Some(PlannedImageSize::Portrait16x9), + Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto3k) + | Some(RouterAspectRatio::Auto4k) => Some(PlannedImageSize::Auto), + Some(RouterAspectRatio::Square) => Some(PlannedImageSize::Square), + Some(RouterAspectRatio::SquareHd) => Some(PlannedImageSize::SquareHd), + Some(RouterAspectRatio::WideFourByThree) + | Some(RouterAspectRatio::WideFiveByFour) => Some(PlannedImageSize::Landscape4x3), + Some(RouterAspectRatio::WideThreeByTwo) + | Some(RouterAspectRatio::WideSixteenByNine) + | Some(RouterAspectRatio::WideTwentyOneByNine) + | Some(RouterAspectRatio::Wide) => Some(PlannedImageSize::Landscape16x9), + Some(RouterAspectRatio::TallThreeByFour) + | Some(RouterAspectRatio::TallFourByFive) => Some(PlannedImageSize::Portrait4x3), + Some(RouterAspectRatio::TallTwoByThree) + | Some(RouterAspectRatio::TallNineBySixteen) + | Some(RouterAspectRatio::TallNineByTwentyOne) + | Some(RouterAspectRatio::Tall) => Some(PlannedImageSize::Portrait16x9), } } @@ -225,13 +225,13 @@ mod tests { use super::*; use std::fmt::Debug; - use crate::api::common_image_model::CommonImageModel; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_provider::RouterProvider; fn base_builder() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::GptImage2, - provider: Provider::Fal, + model: RouterImageModel::GptImage2, + provider: RouterProvider::Fal, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -359,9 +359,9 @@ mod tests { fn quality_maps_exhaustively_for_text_and_edit() { let cases = [ (None, "Some(High)"), - (Some(CommonQuality::Low), "Some(Low)"), - (Some(CommonQuality::Medium), "Some(Medium)"), - (Some(CommonQuality::High), "Some(High)"), + (Some(RouterQuality::Low), "Some(Low)"), + (Some(RouterQuality::Medium), "Some(Medium)"), + (Some(RouterQuality::High), "Some(High)"), ]; for (quality, expected) in cases { @@ -386,14 +386,14 @@ mod tests { fn resolution_maps_exhaustively_for_text_and_edit() { let cases = [ (None, "None"), - (Some(CommonResolution::HalfK), "Some(OneK)"), - (Some(CommonResolution::FourEightyP), "Some(OneK)"), - (Some(CommonResolution::SevenTwentyP), "Some(OneK)"), - (Some(CommonResolution::OneK), "Some(OneK)"), - (Some(CommonResolution::TenEightyP), "Some(TwoK)"), - (Some(CommonResolution::TwoK), "Some(TwoK)"), - (Some(CommonResolution::ThreeK), "Some(ThreeK)"), - (Some(CommonResolution::FourK), "Some(FourK)"), + (Some(RouterResolution::HalfK), "Some(OneK)"), + (Some(RouterResolution::FourEightyP), "Some(OneK)"), + (Some(RouterResolution::SevenTwentyP), "Some(OneK)"), + (Some(RouterResolution::OneK), "Some(OneK)"), + (Some(RouterResolution::TenEightyP), "Some(TwoK)"), + (Some(RouterResolution::TwoK), "Some(TwoK)"), + (Some(RouterResolution::ThreeK), "Some(ThreeK)"), + (Some(RouterResolution::FourK), "Some(FourK)"), ]; for (resolution, expected) in cases { @@ -418,24 +418,24 @@ mod tests { fn aspect_ratio_maps_exhaustively_for_text_and_edit() { let cases = [ (None, "None", "None"), - (Some(CommonAspectRatio::Auto), "None", "Some(Auto)"), - (Some(CommonAspectRatio::Auto2k), "None", "Some(Auto)"), - (Some(CommonAspectRatio::Auto3k), "None", "Some(Auto)"), - (Some(CommonAspectRatio::Auto4k), "None", "Some(Auto)"), - (Some(CommonAspectRatio::Square), "Some(Square)", "Some(Square)"), - (Some(CommonAspectRatio::SquareHd), "Some(SquareHd)", "Some(SquareHd)"), - (Some(CommonAspectRatio::WideThreeByTwo), "Some(Landscape16x9)", "Some(Landscape16x9)"), - (Some(CommonAspectRatio::WideFourByThree), "Some(Landscape4x3)", "Some(Landscape4x3)"), - (Some(CommonAspectRatio::WideFiveByFour), "Some(Landscape4x3)", "Some(Landscape4x3)"), - (Some(CommonAspectRatio::WideSixteenByNine), "Some(Landscape16x9)", "Some(Landscape16x9)"), - (Some(CommonAspectRatio::WideTwentyOneByNine), "Some(Landscape16x9)", "Some(Landscape16x9)"), - (Some(CommonAspectRatio::Wide), "Some(Landscape16x9)", "Some(Landscape16x9)"), - (Some(CommonAspectRatio::TallTwoByThree), "Some(Portrait16x9)", "Some(Portrait16x9)"), - (Some(CommonAspectRatio::TallThreeByFour), "Some(Portrait4x3)", "Some(Portrait4x3)"), - (Some(CommonAspectRatio::TallFourByFive), "Some(Portrait4x3)", "Some(Portrait4x3)"), - (Some(CommonAspectRatio::TallNineBySixteen), "Some(Portrait16x9)", "Some(Portrait16x9)"), - (Some(CommonAspectRatio::TallNineByTwentyOne), "Some(Portrait16x9)", "Some(Portrait16x9)"), - (Some(CommonAspectRatio::Tall), "Some(Portrait16x9)", "Some(Portrait16x9)"), + (Some(RouterAspectRatio::Auto), "None", "Some(Auto)"), + (Some(RouterAspectRatio::Auto2k), "None", "Some(Auto)"), + (Some(RouterAspectRatio::Auto3k), "None", "Some(Auto)"), + (Some(RouterAspectRatio::Auto4k), "None", "Some(Auto)"), + (Some(RouterAspectRatio::Square), "Some(Square)", "Some(Square)"), + (Some(RouterAspectRatio::SquareHd), "Some(SquareHd)", "Some(SquareHd)"), + (Some(RouterAspectRatio::WideThreeByTwo), "Some(Landscape16x9)", "Some(Landscape16x9)"), + (Some(RouterAspectRatio::WideFourByThree), "Some(Landscape4x3)", "Some(Landscape4x3)"), + (Some(RouterAspectRatio::WideFiveByFour), "Some(Landscape4x3)", "Some(Landscape4x3)"), + (Some(RouterAspectRatio::WideSixteenByNine), "Some(Landscape16x9)", "Some(Landscape16x9)"), + (Some(RouterAspectRatio::WideTwentyOneByNine), "Some(Landscape16x9)", "Some(Landscape16x9)"), + (Some(RouterAspectRatio::Wide), "Some(Landscape16x9)", "Some(Landscape16x9)"), + (Some(RouterAspectRatio::TallTwoByThree), "Some(Portrait16x9)", "Some(Portrait16x9)"), + (Some(RouterAspectRatio::TallThreeByFour), "Some(Portrait4x3)", "Some(Portrait4x3)"), + (Some(RouterAspectRatio::TallFourByFive), "Some(Portrait4x3)", "Some(Portrait4x3)"), + (Some(RouterAspectRatio::TallNineBySixteen), "Some(Portrait16x9)", "Some(Portrait16x9)"), + (Some(RouterAspectRatio::TallNineByTwentyOne), "Some(Portrait16x9)", "Some(Portrait16x9)"), + (Some(RouterAspectRatio::Tall), "Some(Portrait16x9)", "Some(Portrait16x9)"), ]; for (aspect_ratio, expected_t2i, _) in cases { diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/nano_banana/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/nano_banana/build.rs index 77ecb810da..bb6ba0d48f 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/nano_banana/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/nano_banana/build.rs @@ -6,7 +6,7 @@ use fal_client::requests::webhook::image::text::enqueue_gemini_25_flash_text_to_ Gemini25FlashTextToImageRequest, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; +use crate::api::router_aspect_ratio::RouterAspectRatio; use crate::api::image_list_ref::ImageListRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -103,27 +103,27 @@ fn to_edit_num_images(n: PlannedNumImages) -> Gemini25FlashEditNumImages { // 1:1, 5:4, 4:3, 3:2, 16:9, 21:9, 4:5, 3:4, 2:3, 9:16 // (no Auto for text-to-image) fn plan_t2i_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { use Gemini25FlashTextToImageAspectRatio as T; match aspect_ratio { None => Ok(None), - Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto4k) => Ok(Some(T::OneByOne)), + Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto4k) => Ok(Some(T::OneByOne)), - Some(CommonAspectRatio::Square) | Some(CommonAspectRatio::SquareHd) => Ok(Some(T::OneByOne)), - Some(CommonAspectRatio::WideFiveByFour) => Ok(Some(T::FiveByFour)), - Some(CommonAspectRatio::WideFourByThree) => Ok(Some(T::FourByThree)), - Some(CommonAspectRatio::WideThreeByTwo) => Ok(Some(T::ThreeByTwo)), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Some(T::SixteenByNine)), - Some(CommonAspectRatio::WideTwentyOneByNine) => Ok(Some(T::TwentyOneByNine)), - Some(CommonAspectRatio::TallFourByFive) => Ok(Some(T::FourByFive)), - Some(CommonAspectRatio::TallThreeByFour) => Ok(Some(T::ThreeByFour)), - Some(CommonAspectRatio::TallTwoByThree) => Ok(Some(T::TwoByThree)), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Some(T::NineBySixteen)), + Some(RouterAspectRatio::Square) | Some(RouterAspectRatio::SquareHd) => Ok(Some(T::OneByOne)), + Some(RouterAspectRatio::WideFiveByFour) => Ok(Some(T::FiveByFour)), + Some(RouterAspectRatio::WideFourByThree) => Ok(Some(T::FourByThree)), + Some(RouterAspectRatio::WideThreeByTwo) => Ok(Some(T::ThreeByTwo)), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Some(T::SixteenByNine)), + Some(RouterAspectRatio::WideTwentyOneByNine) => Ok(Some(T::TwentyOneByNine)), + Some(RouterAspectRatio::TallFourByFive) => Ok(Some(T::FourByFive)), + Some(RouterAspectRatio::TallThreeByFour) => Ok(Some(T::ThreeByFour)), + Some(RouterAspectRatio::TallTwoByThree) => Ok(Some(T::TwoByThree)), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Some(T::NineBySixteen)), Some(unsupported) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -139,27 +139,27 @@ fn plan_t2i_aspect_ratio( // Gemini 2.5 Flash image-edit supported aspect ratios: same as t2i plus Auto fn plan_edit_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { use Gemini25FlashEditAspectRatio as E; match aspect_ratio { None => Ok(None), - Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto4k) => Ok(Some(E::Auto)), + Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto4k) => Ok(Some(E::Auto)), - Some(CommonAspectRatio::Square) | Some(CommonAspectRatio::SquareHd) => Ok(Some(E::OneByOne)), - Some(CommonAspectRatio::WideFiveByFour) => Ok(Some(E::FiveByFour)), - Some(CommonAspectRatio::WideFourByThree) => Ok(Some(E::FourByThree)), - Some(CommonAspectRatio::WideThreeByTwo) => Ok(Some(E::ThreeByTwo)), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Some(E::SixteenByNine)), - Some(CommonAspectRatio::WideTwentyOneByNine) => Ok(Some(E::TwentyOneByNine)), - Some(CommonAspectRatio::TallFourByFive) => Ok(Some(E::FourByFive)), - Some(CommonAspectRatio::TallThreeByFour) => Ok(Some(E::ThreeByFour)), - Some(CommonAspectRatio::TallTwoByThree) => Ok(Some(E::TwoByThree)), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Some(E::NineBySixteen)), + Some(RouterAspectRatio::Square) | Some(RouterAspectRatio::SquareHd) => Ok(Some(E::OneByOne)), + Some(RouterAspectRatio::WideFiveByFour) => Ok(Some(E::FiveByFour)), + Some(RouterAspectRatio::WideFourByThree) => Ok(Some(E::FourByThree)), + Some(RouterAspectRatio::WideThreeByTwo) => Ok(Some(E::ThreeByTwo)), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Some(E::SixteenByNine)), + Some(RouterAspectRatio::WideTwentyOneByNine) => Ok(Some(E::TwentyOneByNine)), + Some(RouterAspectRatio::TallFourByFive) => Ok(Some(E::FourByFive)), + Some(RouterAspectRatio::TallThreeByFour) => Ok(Some(E::ThreeByFour)), + Some(RouterAspectRatio::TallTwoByThree) => Ok(Some(E::TwoByThree)), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Some(E::NineBySixteen)), Some(unsupported) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -190,13 +190,13 @@ fn resolve_image_list_ref( #[cfg(test)] mod tests { use super::*; - use crate::api::common_image_model::CommonImageModel; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_provider::RouterProvider; fn base_builder() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::NanoBanana, - provider: Provider::Fal, + model: RouterImageModel::NanoBanana, + provider: RouterProvider::Fal, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -301,7 +301,7 @@ mod tests { #[test] fn t2i_auto_falls_back_to_one_by_one() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Auto), + aspect_ratio: Some(RouterAspectRatio::Auto), ..base_builder() }; let req = unwrap_t2i(build_fal_nano_banana(builder)); @@ -311,7 +311,7 @@ mod tests { #[test] fn t2i_wide_sixteen_by_nine() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..base_builder() }; let req = unwrap_t2i(build_fal_nano_banana(builder)); @@ -322,7 +322,7 @@ mod tests { fn edit_auto_is_preserved() { let builder = GenerateImageRequestBuilder { image_inputs: Some(ImageListRef::Urls(vec!["https://example.com/img.jpg".to_string()])), - aspect_ratio: Some(CommonAspectRatio::Auto), + aspect_ratio: Some(RouterAspectRatio::Auto), ..base_builder() }; let req = unwrap_edit(build_fal_nano_banana(builder)); diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/nano_banana_2/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/nano_banana_2/build.rs index 5f1ebc621c..15afc9ebe5 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/nano_banana_2/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/nano_banana_2/build.rs @@ -7,8 +7,8 @@ use fal_client::requests::api::image::text::nano_banana_2_text_to_image::api::{ NanoBanana2TextToImageRequest, NanoBanana2TextToImageResolution, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_resolution::CommonResolution; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_resolution::RouterResolution; use crate::api::image_list_ref::ImageListRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -117,15 +117,15 @@ enum PlannedResolution { FourK, } -fn plan_resolution(resolution: Option) -> Option { +fn plan_resolution(resolution: Option) -> Option { resolution.map(|r| match r { - CommonResolution::HalfK | CommonResolution::FourEightyP => PlannedResolution::HalfK, - CommonResolution::OneK | CommonResolution::SevenTwentyP | CommonResolution::TenEightyP => PlannedResolution::OneK, - CommonResolution::TwoK => PlannedResolution::TwoK, + RouterResolution::HalfK | RouterResolution::FourEightyP => PlannedResolution::HalfK, + RouterResolution::OneK | RouterResolution::SevenTwentyP | RouterResolution::TenEightyP => PlannedResolution::OneK, + RouterResolution::TwoK => PlannedResolution::TwoK, // 3K isn't natively supported on Fal nano_banana_2; v1 downgrades to 2K // pricing (and TwoK resolution). Match v1 here so cost+behavior agree. - CommonResolution::ThreeK => PlannedResolution::TwoK, - CommonResolution::FourK => PlannedResolution::FourK, + RouterResolution::ThreeK => PlannedResolution::TwoK, + RouterResolution::FourK => PlannedResolution::FourK, }) } @@ -150,44 +150,44 @@ fn to_edit_resolution(r: PlannedResolution) -> NanoBanana2EditImageResolution { // ── Aspect ratio ── fn plan_t2i_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, ) -> Option { use NanoBanana2TextToImageAspectRatio as T; aspect_ratio.map(|ar| match ar { - CommonAspectRatio::Auto | CommonAspectRatio::Auto2k - | CommonAspectRatio::Auto3k | CommonAspectRatio::Auto4k => T::Auto, - CommonAspectRatio::Square | CommonAspectRatio::SquareHd => T::OneByOne, - CommonAspectRatio::WideFiveByFour => T::FiveByFour, - CommonAspectRatio::WideFourByThree => T::FourByThree, - CommonAspectRatio::WideThreeByTwo | CommonAspectRatio::Wide => T::ThreeByTwo, - CommonAspectRatio::WideSixteenByNine => T::SixteenByNine, - CommonAspectRatio::WideTwentyOneByNine => T::TwentyOneByNine, - CommonAspectRatio::TallFourByFive => T::FourByFive, - CommonAspectRatio::TallThreeByFour => T::ThreeByFour, - CommonAspectRatio::TallTwoByThree | CommonAspectRatio::Tall => T::TwoByThree, - CommonAspectRatio::TallNineBySixteen => T::NineBySixteen, - CommonAspectRatio::TallNineByTwentyOne => T::NineBySixteen, // nearest match + RouterAspectRatio::Auto | RouterAspectRatio::Auto2k + | RouterAspectRatio::Auto3k | RouterAspectRatio::Auto4k => T::Auto, + RouterAspectRatio::Square | RouterAspectRatio::SquareHd => T::OneByOne, + RouterAspectRatio::WideFiveByFour => T::FiveByFour, + RouterAspectRatio::WideFourByThree => T::FourByThree, + RouterAspectRatio::WideThreeByTwo | RouterAspectRatio::Wide => T::ThreeByTwo, + RouterAspectRatio::WideSixteenByNine => T::SixteenByNine, + RouterAspectRatio::WideTwentyOneByNine => T::TwentyOneByNine, + RouterAspectRatio::TallFourByFive => T::FourByFive, + RouterAspectRatio::TallThreeByFour => T::ThreeByFour, + RouterAspectRatio::TallTwoByThree | RouterAspectRatio::Tall => T::TwoByThree, + RouterAspectRatio::TallNineBySixteen => T::NineBySixteen, + RouterAspectRatio::TallNineByTwentyOne => T::NineBySixteen, // nearest match }) } fn plan_edit_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, ) -> Option { use NanoBanana2EditImageAspectRatio as E; aspect_ratio.map(|ar| match ar { - CommonAspectRatio::Auto | CommonAspectRatio::Auto2k - | CommonAspectRatio::Auto3k | CommonAspectRatio::Auto4k => E::Auto, - CommonAspectRatio::Square | CommonAspectRatio::SquareHd => E::OneByOne, - CommonAspectRatio::WideFiveByFour => E::FiveByFour, - CommonAspectRatio::WideFourByThree => E::FourByThree, - CommonAspectRatio::WideThreeByTwo | CommonAspectRatio::Wide => E::ThreeByTwo, - CommonAspectRatio::WideSixteenByNine => E::SixteenByNine, - CommonAspectRatio::WideTwentyOneByNine => E::TwentyOneByNine, - CommonAspectRatio::TallFourByFive => E::FourByFive, - CommonAspectRatio::TallThreeByFour => E::ThreeByFour, - CommonAspectRatio::TallTwoByThree | CommonAspectRatio::Tall => E::TwoByThree, - CommonAspectRatio::TallNineBySixteen => E::NineBySixteen, - CommonAspectRatio::TallNineByTwentyOne => E::NineBySixteen, // nearest match + RouterAspectRatio::Auto | RouterAspectRatio::Auto2k + | RouterAspectRatio::Auto3k | RouterAspectRatio::Auto4k => E::Auto, + RouterAspectRatio::Square | RouterAspectRatio::SquareHd => E::OneByOne, + RouterAspectRatio::WideFiveByFour => E::FiveByFour, + RouterAspectRatio::WideFourByThree => E::FourByThree, + RouterAspectRatio::WideThreeByTwo | RouterAspectRatio::Wide => E::ThreeByTwo, + RouterAspectRatio::WideSixteenByNine => E::SixteenByNine, + RouterAspectRatio::WideTwentyOneByNine => E::TwentyOneByNine, + RouterAspectRatio::TallFourByFive => E::FourByFive, + RouterAspectRatio::TallThreeByFour => E::ThreeByFour, + RouterAspectRatio::TallTwoByThree | RouterAspectRatio::Tall => E::TwoByThree, + RouterAspectRatio::TallNineBySixteen => E::NineBySixteen, + RouterAspectRatio::TallNineByTwentyOne => E::NineBySixteen, // nearest match }) } @@ -208,13 +208,13 @@ fn resolve_image_urls( #[cfg(test)] mod tests { use super::*; - use crate::api::common_image_model::CommonImageModel; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_provider::RouterProvider; fn base_builder() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::NanoBanana2, - provider: Provider::Fal, + model: RouterImageModel::NanoBanana2, + provider: RouterProvider::Fal, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -371,7 +371,7 @@ mod tests { #[test] fn half_k_maps_to_half_k() { let builder = GenerateImageRequestBuilder { - resolution: Some(CommonResolution::HalfK), + resolution: Some(RouterResolution::HalfK), ..base_builder() }; let req = unwrap_t2i(build_fal_nano_banana_2(builder)); @@ -381,7 +381,7 @@ mod tests { #[test] fn four_eighty_p_maps_to_half_k() { let builder = GenerateImageRequestBuilder { - resolution: Some(CommonResolution::FourEightyP), + resolution: Some(RouterResolution::FourEightyP), ..base_builder() }; let req = unwrap_t2i(build_fal_nano_banana_2(builder)); @@ -391,7 +391,7 @@ mod tests { #[test] fn one_k_maps_to_one_k() { let builder = GenerateImageRequestBuilder { - resolution: Some(CommonResolution::OneK), + resolution: Some(RouterResolution::OneK), ..base_builder() }; let req = unwrap_t2i(build_fal_nano_banana_2(builder)); @@ -401,7 +401,7 @@ mod tests { #[test] fn two_k_maps_to_two_k() { let builder = GenerateImageRequestBuilder { - resolution: Some(CommonResolution::TwoK), + resolution: Some(RouterResolution::TwoK), ..base_builder() }; let req = unwrap_t2i(build_fal_nano_banana_2(builder)); @@ -411,7 +411,7 @@ mod tests { #[test] fn four_k_maps_to_four_k() { let builder = GenerateImageRequestBuilder { - resolution: Some(CommonResolution::FourK), + resolution: Some(RouterResolution::FourK), ..base_builder() }; let req = unwrap_t2i(build_fal_nano_banana_2(builder)); @@ -422,7 +422,7 @@ mod tests { fn three_k_rounds_down_to_two_k() { // Match v1's downgrade behavior: 3K → 2K (cheaper, no 3K native support). let builder = GenerateImageRequestBuilder { - resolution: Some(CommonResolution::ThreeK), + resolution: Some(RouterResolution::ThreeK), ..base_builder() }; let req = unwrap_t2i(build_fal_nano_banana_2(builder)); @@ -433,7 +433,7 @@ mod tests { fn edit_mode_resolution() { let builder = GenerateImageRequestBuilder { image_inputs: Some(ImageListRef::Urls(vec!["https://example.com/img.jpg".to_string()])), - resolution: Some(CommonResolution::HalfK), + resolution: Some(RouterResolution::HalfK), ..base_builder() }; let req = unwrap_edit(build_fal_nano_banana_2(builder)); @@ -455,7 +455,7 @@ mod tests { #[test] fn auto_maps_to_auto_t2i() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Auto), + aspect_ratio: Some(RouterAspectRatio::Auto), ..base_builder() }; let req = unwrap_t2i(build_fal_nano_banana_2(builder)); @@ -465,7 +465,7 @@ mod tests { #[test] fn square_maps_to_one_by_one() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Square), + aspect_ratio: Some(RouterAspectRatio::Square), ..base_builder() }; let req = unwrap_t2i(build_fal_nano_banana_2(builder)); @@ -475,7 +475,7 @@ mod tests { #[test] fn wide_sixteen_by_nine() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..base_builder() }; let req = unwrap_t2i(build_fal_nano_banana_2(builder)); @@ -485,7 +485,7 @@ mod tests { #[test] fn tall_nine_by_sixteen() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::TallNineBySixteen), + aspect_ratio: Some(RouterAspectRatio::TallNineBySixteen), ..base_builder() }; let req = unwrap_t2i(build_fal_nano_banana_2(builder)); @@ -495,7 +495,7 @@ mod tests { #[test] fn edit_auto() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Auto), + aspect_ratio: Some(RouterAspectRatio::Auto), image_inputs: Some(ImageListRef::Urls(vec!["https://example.com/img.jpg".to_string()])), ..base_builder() }; @@ -506,7 +506,7 @@ mod tests { #[test] fn edit_square() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::SquareHd), + aspect_ratio: Some(RouterAspectRatio::SquareHd), image_inputs: Some(ImageListRef::Urls(vec!["https://example.com/img.jpg".to_string()])), ..base_builder() }; diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/nano_banana_pro/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/nano_banana_pro/build.rs index 17b4a4f810..7508f82117 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/nano_banana_pro/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/nano_banana_pro/build.rs @@ -7,8 +7,8 @@ use fal_client::requests::api::image::text::nano_banana_pro_text_to_image::api:: NanoBananaProTextToImageRequest, NanoBananaProTextToImageResolution, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_resolution::CommonResolution; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_resolution::RouterResolution; use crate::api::image_list_ref::ImageListRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -116,15 +116,15 @@ enum PlannedResolution { FourK, } -fn plan_resolution(resolution: Option) -> Option { +fn plan_resolution(resolution: Option) -> Option { resolution.map(|r| match r { - CommonResolution::HalfK | CommonResolution::FourEightyP | CommonResolution::SevenTwentyP - | CommonResolution::OneK | CommonResolution::TenEightyP => PlannedResolution::OneK, - CommonResolution::TwoK => PlannedResolution::TwoK, + RouterResolution::HalfK | RouterResolution::FourEightyP | RouterResolution::SevenTwentyP + | RouterResolution::OneK | RouterResolution::TenEightyP => PlannedResolution::OneK, + RouterResolution::TwoK => PlannedResolution::TwoK, // 3K isn't natively supported on Fal nano_banana_pro; v1 downgrades to 2K // pricing (and TwoK resolution). Match v1 here so cost+behavior agree. - CommonResolution::ThreeK => PlannedResolution::TwoK, - CommonResolution::FourK => PlannedResolution::FourK, + RouterResolution::ThreeK => PlannedResolution::TwoK, + RouterResolution::FourK => PlannedResolution::FourK, }) } @@ -147,44 +147,44 @@ fn to_edit_resolution(r: PlannedResolution) -> NanoBananaProEditImageResolution // ── Aspect ratio ── fn plan_t2i_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, ) -> Option { use NanoBananaProTextToImageAspectRatio as T; aspect_ratio.and_then(|ar| match ar { - CommonAspectRatio::Square | CommonAspectRatio::SquareHd => Some(T::OneByOne), - CommonAspectRatio::WideFiveByFour => Some(T::FiveByFour), - CommonAspectRatio::WideFourByThree => Some(T::FourByThree), - CommonAspectRatio::WideThreeByTwo | CommonAspectRatio::Wide => Some(T::ThreeByTwo), - CommonAspectRatio::WideSixteenByNine => Some(T::SixteenByNine), - CommonAspectRatio::WideTwentyOneByNine => Some(T::TwentyOneByNine), - CommonAspectRatio::TallFourByFive => Some(T::FourByFive), - CommonAspectRatio::TallThreeByFour => Some(T::ThreeByFour), - CommonAspectRatio::TallTwoByThree | CommonAspectRatio::Tall => Some(T::TwoByThree), - CommonAspectRatio::TallNineBySixteen => Some(T::NineBySixteen), - CommonAspectRatio::TallNineByTwentyOne => Some(T::NineBySixteen), // nearest match - CommonAspectRatio::Auto | CommonAspectRatio::Auto2k - | CommonAspectRatio::Auto3k | CommonAspectRatio::Auto4k => None, + RouterAspectRatio::Square | RouterAspectRatio::SquareHd => Some(T::OneByOne), + RouterAspectRatio::WideFiveByFour => Some(T::FiveByFour), + RouterAspectRatio::WideFourByThree => Some(T::FourByThree), + RouterAspectRatio::WideThreeByTwo | RouterAspectRatio::Wide => Some(T::ThreeByTwo), + RouterAspectRatio::WideSixteenByNine => Some(T::SixteenByNine), + RouterAspectRatio::WideTwentyOneByNine => Some(T::TwentyOneByNine), + RouterAspectRatio::TallFourByFive => Some(T::FourByFive), + RouterAspectRatio::TallThreeByFour => Some(T::ThreeByFour), + RouterAspectRatio::TallTwoByThree | RouterAspectRatio::Tall => Some(T::TwoByThree), + RouterAspectRatio::TallNineBySixteen => Some(T::NineBySixteen), + RouterAspectRatio::TallNineByTwentyOne => Some(T::NineBySixteen), // nearest match + RouterAspectRatio::Auto | RouterAspectRatio::Auto2k + | RouterAspectRatio::Auto3k | RouterAspectRatio::Auto4k => None, }) } fn plan_edit_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, ) -> Option { use NanoBananaProEditImageAspectRatio as E; aspect_ratio.map(|ar| match ar { - CommonAspectRatio::Auto | CommonAspectRatio::Auto2k - | CommonAspectRatio::Auto3k | CommonAspectRatio::Auto4k => E::Auto, - CommonAspectRatio::Square | CommonAspectRatio::SquareHd => E::OneByOne, - CommonAspectRatio::WideFiveByFour => E::FiveByFour, - CommonAspectRatio::WideFourByThree => E::FourByThree, - CommonAspectRatio::WideThreeByTwo | CommonAspectRatio::Wide => E::ThreeByTwo, - CommonAspectRatio::WideSixteenByNine => E::SixteenByNine, - CommonAspectRatio::WideTwentyOneByNine => E::TwentyOneByNine, - CommonAspectRatio::TallFourByFive => E::FourByFive, - CommonAspectRatio::TallThreeByFour => E::ThreeByFour, - CommonAspectRatio::TallTwoByThree | CommonAspectRatio::Tall => E::TwoByThree, - CommonAspectRatio::TallNineBySixteen => E::NineBySixteen, - CommonAspectRatio::TallNineByTwentyOne => E::NineBySixteen, // nearest match + RouterAspectRatio::Auto | RouterAspectRatio::Auto2k + | RouterAspectRatio::Auto3k | RouterAspectRatio::Auto4k => E::Auto, + RouterAspectRatio::Square | RouterAspectRatio::SquareHd => E::OneByOne, + RouterAspectRatio::WideFiveByFour => E::FiveByFour, + RouterAspectRatio::WideFourByThree => E::FourByThree, + RouterAspectRatio::WideThreeByTwo | RouterAspectRatio::Wide => E::ThreeByTwo, + RouterAspectRatio::WideSixteenByNine => E::SixteenByNine, + RouterAspectRatio::WideTwentyOneByNine => E::TwentyOneByNine, + RouterAspectRatio::TallFourByFive => E::FourByFive, + RouterAspectRatio::TallThreeByFour => E::ThreeByFour, + RouterAspectRatio::TallTwoByThree | RouterAspectRatio::Tall => E::TwoByThree, + RouterAspectRatio::TallNineBySixteen => E::NineBySixteen, + RouterAspectRatio::TallNineByTwentyOne => E::NineBySixteen, // nearest match }) } @@ -205,13 +205,13 @@ fn resolve_image_urls( #[cfg(test)] mod tests { use super::*; - use crate::api::common_image_model::CommonImageModel; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_provider::RouterProvider; fn base_builder() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::NanoBananaPro, - provider: Provider::Fal, + model: RouterImageModel::NanoBananaPro, + provider: RouterProvider::Fal, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -368,7 +368,7 @@ mod tests { #[test] fn one_k_maps_to_one_k() { let builder = GenerateImageRequestBuilder { - resolution: Some(CommonResolution::OneK), + resolution: Some(RouterResolution::OneK), ..base_builder() }; let req = unwrap_t2i(build_fal_nano_banana_pro(builder)); @@ -378,7 +378,7 @@ mod tests { #[test] fn two_k_maps_to_two_k() { let builder = GenerateImageRequestBuilder { - resolution: Some(CommonResolution::TwoK), + resolution: Some(RouterResolution::TwoK), ..base_builder() }; let req = unwrap_t2i(build_fal_nano_banana_pro(builder)); @@ -388,7 +388,7 @@ mod tests { #[test] fn four_k_maps_to_four_k() { let builder = GenerateImageRequestBuilder { - resolution: Some(CommonResolution::FourK), + resolution: Some(RouterResolution::FourK), ..base_builder() }; let req = unwrap_t2i(build_fal_nano_banana_pro(builder)); @@ -399,7 +399,7 @@ mod tests { fn three_k_rounds_down_to_two_k() { // Match v1's downgrade behavior: 3K → 2K (cheaper, no 3K native support). let builder = GenerateImageRequestBuilder { - resolution: Some(CommonResolution::ThreeK), + resolution: Some(RouterResolution::ThreeK), ..base_builder() }; let req = unwrap_t2i(build_fal_nano_banana_pro(builder)); @@ -409,7 +409,7 @@ mod tests { #[test] fn half_k_rounds_to_one_k() { let builder = GenerateImageRequestBuilder { - resolution: Some(CommonResolution::HalfK), + resolution: Some(RouterResolution::HalfK), ..base_builder() }; let req = unwrap_t2i(build_fal_nano_banana_pro(builder)); @@ -420,7 +420,7 @@ mod tests { fn edit_mode_resolution() { let builder = GenerateImageRequestBuilder { image_inputs: Some(ImageListRef::Urls(vec!["https://example.com/img.jpg".to_string()])), - resolution: Some(CommonResolution::FourK), + resolution: Some(RouterResolution::FourK), ..base_builder() }; let req = unwrap_edit(build_fal_nano_banana_pro(builder)); @@ -442,7 +442,7 @@ mod tests { #[test] fn square_maps_to_one_by_one() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Square), + aspect_ratio: Some(RouterAspectRatio::Square), ..base_builder() }; let req = unwrap_t2i(build_fal_nano_banana_pro(builder)); @@ -452,7 +452,7 @@ mod tests { #[test] fn wide_sixteen_by_nine() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..base_builder() }; let req = unwrap_t2i(build_fal_nano_banana_pro(builder)); @@ -462,7 +462,7 @@ mod tests { #[test] fn tall_nine_by_sixteen() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::TallNineBySixteen), + aspect_ratio: Some(RouterAspectRatio::TallNineBySixteen), ..base_builder() }; let req = unwrap_t2i(build_fal_nano_banana_pro(builder)); @@ -472,7 +472,7 @@ mod tests { #[test] fn auto_yields_none_for_t2i() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Auto), + aspect_ratio: Some(RouterAspectRatio::Auto), ..base_builder() }; let req = unwrap_t2i(build_fal_nano_banana_pro(builder)); @@ -482,7 +482,7 @@ mod tests { #[test] fn auto_yields_auto_for_edit() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Auto), + aspect_ratio: Some(RouterAspectRatio::Auto), image_inputs: Some(ImageListRef::Urls(vec!["https://example.com/img.jpg".to_string()])), ..base_builder() }; @@ -493,7 +493,7 @@ mod tests { #[test] fn edit_square() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::SquareHd), + aspect_ratio: Some(RouterAspectRatio::SquareHd), image_inputs: Some(ImageListRef::Urls(vec!["https://example.com/img.jpg".to_string()])), ..base_builder() }; diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/qwen_edit_2511_angles/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/qwen_edit_2511_angles/build.rs index 0af7e2a8e4..f104a327c4 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/qwen_edit_2511_angles/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/qwen_edit_2511_angles/build.rs @@ -3,7 +3,7 @@ use fal_client::requests::webhook::image::angle::enqueue_qwen_edit_2511_edit_ima EnqueueQwenEdit2511EditImageAngleRequest, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; +use crate::api::router_aspect_ratio::RouterAspectRatio; use crate::api::image_list_ref::ImageListRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -80,26 +80,26 @@ fn plan_num_images( } fn plan_image_size( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { use EnqueueQwenEdit2511AngleImageSize as S; match aspect_ratio { None => Ok(None), - Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto3k) - | Some(CommonAspectRatio::Auto4k) => Ok(Some(S::SquareHd)), + Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto3k) + | Some(RouterAspectRatio::Auto4k) => Ok(Some(S::SquareHd)), - Some(CommonAspectRatio::Square) => Ok(Some(S::Square)), - Some(CommonAspectRatio::SquareHd) => Ok(Some(S::SquareHd)), + Some(RouterAspectRatio::Square) => Ok(Some(S::Square)), + Some(RouterAspectRatio::SquareHd) => Ok(Some(S::SquareHd)), - Some(CommonAspectRatio::Wide) | Some(CommonAspectRatio::WideSixteenByNine) => Ok(Some(S::LandscapeSixteenNine)), - Some(CommonAspectRatio::WideFourByThree) => Ok(Some(S::LandscapeFourThree)), + Some(RouterAspectRatio::Wide) | Some(RouterAspectRatio::WideSixteenByNine) => Ok(Some(S::LandscapeSixteenNine)), + Some(RouterAspectRatio::WideFourByThree) => Ok(Some(S::LandscapeFourThree)), - Some(CommonAspectRatio::Tall) | Some(CommonAspectRatio::TallNineBySixteen) => Ok(Some(S::PortraitSixteenNine)), - Some(CommonAspectRatio::TallThreeByFour) => Ok(Some(S::PortraitFourThree)), + Some(RouterAspectRatio::Tall) | Some(RouterAspectRatio::TallNineBySixteen) => Ok(Some(S::PortraitSixteenNine)), + Some(RouterAspectRatio::TallThreeByFour) => Ok(Some(S::PortraitFourThree)), Some(unsupported) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -116,13 +116,13 @@ fn plan_image_size( #[cfg(test)] mod tests { use super::*; - use crate::api::common_image_model::CommonImageModel; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_provider::RouterProvider; fn base() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::QwenEdit2511Angles, - provider: Provider::Fal, + model: RouterImageModel::QwenEdit2511Angles, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), image_inputs: Some(ImageListRef::Urls(vec!["https://example.com/x.jpg".to_string()])), resolution: None, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/seedream_4/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/seedream_4/build.rs index e7f71c8d1e..8d857a8b1d 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/seedream_4/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/seedream_4/build.rs @@ -7,7 +7,7 @@ use fal_client::requests::webhook::image::text::enqueue_bytedance_seedream_v4_te EnqueueBytedanceSeedreamV4TextToImageSize, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; +use crate::api::router_aspect_ratio::RouterAspectRatio; use crate::api::image_list_ref::ImageListRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -118,7 +118,7 @@ enum PlannedImageSize { } fn plan_image_size( - aspect_ratio: Option, + aspect_ratio: Option, is_edit_mode: bool, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { @@ -126,21 +126,21 @@ fn plan_image_size( match aspect_ratio { None => Ok(None), - Some(CommonAspectRatio::Auto) => { + Some(RouterAspectRatio::Auto) => { if is_edit_mode { Ok(Some(S::Auto)) } else { Ok(Some(S::Square)) } } - Some(CommonAspectRatio::Auto2k) | Some(CommonAspectRatio::Auto3k) => Ok(Some(S::Auto2k)), - Some(CommonAspectRatio::Auto4k) => Ok(Some(S::Auto4k)), + Some(RouterAspectRatio::Auto2k) | Some(RouterAspectRatio::Auto3k) => Ok(Some(S::Auto2k)), + Some(RouterAspectRatio::Auto4k) => Ok(Some(S::Auto4k)), - Some(CommonAspectRatio::Square) => Ok(Some(S::Square)), - Some(CommonAspectRatio::SquareHd) => Ok(Some(S::SquareHd)), + Some(RouterAspectRatio::Square) => Ok(Some(S::Square)), + Some(RouterAspectRatio::SquareHd) => Ok(Some(S::SquareHd)), - Some(CommonAspectRatio::Wide) | Some(CommonAspectRatio::WideSixteenByNine) => Ok(Some(S::LandscapeSixteenNine)), - Some(CommonAspectRatio::WideFourByThree) => Ok(Some(S::LandscapeFourThree)), + Some(RouterAspectRatio::Wide) | Some(RouterAspectRatio::WideSixteenByNine) => Ok(Some(S::LandscapeSixteenNine)), + Some(RouterAspectRatio::WideFourByThree) => Ok(Some(S::LandscapeFourThree)), - Some(unsupported @ CommonAspectRatio::WideFiveByFour) - | Some(unsupported @ CommonAspectRatio::WideThreeByTwo) - | Some(unsupported @ CommonAspectRatio::WideTwentyOneByNine) => match strategy { + Some(unsupported @ RouterAspectRatio::WideFiveByFour) + | Some(unsupported @ RouterAspectRatio::WideThreeByTwo) + | Some(unsupported @ RouterAspectRatio::WideTwentyOneByNine) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { Err(ArtcraftRouterError::Client(ClientError::ModelDoesNotSupportOption { field: "aspect_ratio", @@ -150,12 +150,12 @@ fn plan_image_size( _ => Ok(Some(S::LandscapeSixteenNine)), }, - Some(CommonAspectRatio::Tall) | Some(CommonAspectRatio::TallNineBySixteen) => Ok(Some(S::PortraitSixteenNine)), - Some(CommonAspectRatio::TallThreeByFour) => Ok(Some(S::PortraitFourThree)), + Some(RouterAspectRatio::Tall) | Some(RouterAspectRatio::TallNineBySixteen) => Ok(Some(S::PortraitSixteenNine)), + Some(RouterAspectRatio::TallThreeByFour) => Ok(Some(S::PortraitFourThree)), - Some(unsupported @ CommonAspectRatio::TallFourByFive) - | Some(unsupported @ CommonAspectRatio::TallTwoByThree) - | Some(unsupported @ CommonAspectRatio::TallNineByTwentyOne) => match strategy { + Some(unsupported @ RouterAspectRatio::TallFourByFive) + | Some(unsupported @ RouterAspectRatio::TallTwoByThree) + | Some(unsupported @ RouterAspectRatio::TallNineByTwentyOne) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { Err(ArtcraftRouterError::Client(ClientError::ModelDoesNotSupportOption { field: "aspect_ratio", @@ -214,13 +214,13 @@ fn resolve_image_list_ref( #[cfg(test)] mod tests { use super::*; - use crate::api::common_image_model::CommonImageModel; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_provider::RouterProvider; fn base_builder() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::Seedream4, - provider: Provider::Fal, + model: RouterImageModel::Seedream4, + provider: RouterProvider::Fal, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -291,7 +291,7 @@ mod tests { #[test] fn t2i_auto_maps_to_square() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Auto), + aspect_ratio: Some(RouterAspectRatio::Auto), ..base_builder() }; let req = unwrap_t2i(build_fal_seedream_4(builder)); @@ -302,7 +302,7 @@ mod tests { fn edit_auto_stays_auto() { let builder = GenerateImageRequestBuilder { image_inputs: Some(ImageListRef::Urls(vec!["https://example.com/img.jpg".to_string()])), - aspect_ratio: Some(CommonAspectRatio::Auto), + aspect_ratio: Some(RouterAspectRatio::Auto), ..base_builder() }; let req = unwrap_edit(build_fal_seedream_4(builder)); @@ -312,7 +312,7 @@ mod tests { #[test] fn auto4k_maps_to_auto4k() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Auto4k), + aspect_ratio: Some(RouterAspectRatio::Auto4k), ..base_builder() }; let req = unwrap_t2i(build_fal_seedream_4(builder)); @@ -322,7 +322,7 @@ mod tests { #[test] fn wide_21_9_errors_out() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::WideTwentyOneByNine), + aspect_ratio: Some(RouterAspectRatio::WideTwentyOneByNine), ..base_builder() }; assert!(matches!( @@ -334,7 +334,7 @@ mod tests { #[test] fn wide_21_9_falls_back_with_upgrade() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::WideTwentyOneByNine), + aspect_ratio: Some(RouterAspectRatio::WideTwentyOneByNine), request_mismatch_mitigation_strategy: RequestMismatchMitigationStrategy::PayMoreUpgrade, ..base_builder() }; diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/seedream_4p5/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/seedream_4p5/build.rs index 57d6fc6513..dac12d5d59 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/seedream_4p5/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/seedream_4p5/build.rs @@ -7,7 +7,7 @@ use fal_client::requests::webhook::image::text::enqueue_bytedance_seedream_v4p5_ EnqueueBytedanceSeedreamV4p5TextToImageSize, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; +use crate::api::router_aspect_ratio::RouterAspectRatio; use crate::api::image_list_ref::ImageListRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -119,7 +119,7 @@ enum PlannedImageSize { } fn plan_image_size( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { use PlannedImageSize as S; @@ -127,18 +127,18 @@ fn plan_image_size( None => Ok(None), // No bare Auto for v4.5 — fall back to Auto2k. - Some(CommonAspectRatio::Auto) | Some(CommonAspectRatio::Auto2k) | Some(CommonAspectRatio::Auto3k) => Ok(Some(S::Auto2k)), - Some(CommonAspectRatio::Auto4k) => Ok(Some(S::Auto4k)), + Some(RouterAspectRatio::Auto) | Some(RouterAspectRatio::Auto2k) | Some(RouterAspectRatio::Auto3k) => Ok(Some(S::Auto2k)), + Some(RouterAspectRatio::Auto4k) => Ok(Some(S::Auto4k)), - Some(CommonAspectRatio::Square) => Ok(Some(S::Square)), - Some(CommonAspectRatio::SquareHd) => Ok(Some(S::SquareHd)), + Some(RouterAspectRatio::Square) => Ok(Some(S::Square)), + Some(RouterAspectRatio::SquareHd) => Ok(Some(S::SquareHd)), - Some(CommonAspectRatio::Wide) | Some(CommonAspectRatio::WideSixteenByNine) => Ok(Some(S::LandscapeSixteenNine)), - Some(CommonAspectRatio::WideFourByThree) => Ok(Some(S::LandscapeFourThree)), + Some(RouterAspectRatio::Wide) | Some(RouterAspectRatio::WideSixteenByNine) => Ok(Some(S::LandscapeSixteenNine)), + Some(RouterAspectRatio::WideFourByThree) => Ok(Some(S::LandscapeFourThree)), - Some(unsupported @ CommonAspectRatio::WideFiveByFour) - | Some(unsupported @ CommonAspectRatio::WideThreeByTwo) - | Some(unsupported @ CommonAspectRatio::WideTwentyOneByNine) => match strategy { + Some(unsupported @ RouterAspectRatio::WideFiveByFour) + | Some(unsupported @ RouterAspectRatio::WideThreeByTwo) + | Some(unsupported @ RouterAspectRatio::WideTwentyOneByNine) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { Err(ArtcraftRouterError::Client(ClientError::ModelDoesNotSupportOption { field: "aspect_ratio", @@ -148,12 +148,12 @@ fn plan_image_size( _ => Ok(Some(S::LandscapeSixteenNine)), }, - Some(CommonAspectRatio::Tall) | Some(CommonAspectRatio::TallNineBySixteen) => Ok(Some(S::PortraitSixteenNine)), - Some(CommonAspectRatio::TallThreeByFour) => Ok(Some(S::PortraitFourThree)), + Some(RouterAspectRatio::Tall) | Some(RouterAspectRatio::TallNineBySixteen) => Ok(Some(S::PortraitSixteenNine)), + Some(RouterAspectRatio::TallThreeByFour) => Ok(Some(S::PortraitFourThree)), - Some(unsupported @ CommonAspectRatio::TallFourByFive) - | Some(unsupported @ CommonAspectRatio::TallTwoByThree) - | Some(unsupported @ CommonAspectRatio::TallNineByTwentyOne) => match strategy { + Some(unsupported @ RouterAspectRatio::TallFourByFive) + | Some(unsupported @ RouterAspectRatio::TallTwoByThree) + | Some(unsupported @ RouterAspectRatio::TallNineByTwentyOne) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { Err(ArtcraftRouterError::Client(ClientError::ModelDoesNotSupportOption { field: "aspect_ratio", @@ -210,13 +210,13 @@ fn resolve_image_list_ref( #[cfg(test)] mod tests { use super::*; - use crate::api::common_image_model::CommonImageModel; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_provider::RouterProvider; fn base_builder() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::Seedream4p5, - provider: Provider::Fal, + model: RouterImageModel::Seedream4p5, + provider: RouterProvider::Fal, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -243,7 +243,7 @@ mod tests { fn auto_falls_back_to_auto2k() { // Seedream 4.5 has no bare Auto — request with Auto should map to Auto2k. let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Auto), + aspect_ratio: Some(RouterAspectRatio::Auto), ..base_builder() }; let req = unwrap_t2i(build_fal_seedream_4p5(builder)); @@ -253,7 +253,7 @@ mod tests { #[test] fn auto4k_stays_auto4k() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Auto4k), + aspect_ratio: Some(RouterAspectRatio::Auto4k), ..base_builder() }; let req = unwrap_t2i(build_fal_seedream_4p5(builder)); diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/seedream_5_lite/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/seedream_5_lite/build.rs index 838de45ece..59b5a84eb4 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/seedream_5_lite/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_image_v2/providers/fal/seedream_5_lite/build.rs @@ -7,8 +7,8 @@ use fal_client::requests::webhook::image::text::enqueue_bytedance_seedream_v5_li EnqueueBytedanceSeedreamV5LiteTextToImageSize, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_resolution::CommonResolution; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_resolution::RouterResolution; use crate::api::image_list_ref::ImageListRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -120,8 +120,8 @@ enum PlannedImageSize { } fn plan_image_size( - aspect_ratio: Option, - resolution: Option, + aspect_ratio: Option, + resolution: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { use PlannedImageSize as S; @@ -129,25 +129,25 @@ fn plan_image_size( // No aspect_ratio: use resolution as a hint for Auto sizes. // Seedream v5 lite has no 4K — clamp to 3K. None => match resolution { - Some(CommonResolution::TwoK) => Ok(Some(S::Auto2k)), - Some(CommonResolution::ThreeK) | Some(CommonResolution::FourK) => Ok(Some(S::Auto3k)), + Some(RouterResolution::TwoK) => Ok(Some(S::Auto2k)), + Some(RouterResolution::ThreeK) | Some(RouterResolution::FourK) => Ok(Some(S::Auto3k)), _ => Ok(None), }, - Some(CommonAspectRatio::Auto) | Some(CommonAspectRatio::Auto2k) => Ok(Some(S::Auto2k)), - Some(CommonAspectRatio::Auto3k) => Ok(Some(S::Auto3k)), + Some(RouterAspectRatio::Auto) | Some(RouterAspectRatio::Auto2k) => Ok(Some(S::Auto2k)), + Some(RouterAspectRatio::Auto3k) => Ok(Some(S::Auto3k)), // No 4K — fall back to 3K. - Some(CommonAspectRatio::Auto4k) => Ok(Some(S::Auto3k)), + Some(RouterAspectRatio::Auto4k) => Ok(Some(S::Auto3k)), - Some(CommonAspectRatio::Square) => Ok(Some(S::Square)), - Some(CommonAspectRatio::SquareHd) => Ok(Some(S::SquareHd)), + Some(RouterAspectRatio::Square) => Ok(Some(S::Square)), + Some(RouterAspectRatio::SquareHd) => Ok(Some(S::SquareHd)), - Some(CommonAspectRatio::Wide) | Some(CommonAspectRatio::WideSixteenByNine) => Ok(Some(S::LandscapeSixteenNine)), - Some(CommonAspectRatio::WideFourByThree) => Ok(Some(S::LandscapeFourThree)), + Some(RouterAspectRatio::Wide) | Some(RouterAspectRatio::WideSixteenByNine) => Ok(Some(S::LandscapeSixteenNine)), + Some(RouterAspectRatio::WideFourByThree) => Ok(Some(S::LandscapeFourThree)), - Some(unsupported @ CommonAspectRatio::WideFiveByFour) - | Some(unsupported @ CommonAspectRatio::WideThreeByTwo) - | Some(unsupported @ CommonAspectRatio::WideTwentyOneByNine) => match strategy { + Some(unsupported @ RouterAspectRatio::WideFiveByFour) + | Some(unsupported @ RouterAspectRatio::WideThreeByTwo) + | Some(unsupported @ RouterAspectRatio::WideTwentyOneByNine) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { Err(ArtcraftRouterError::Client(ClientError::ModelDoesNotSupportOption { field: "aspect_ratio", @@ -157,12 +157,12 @@ fn plan_image_size( _ => Ok(Some(S::LandscapeSixteenNine)), }, - Some(CommonAspectRatio::Tall) | Some(CommonAspectRatio::TallNineBySixteen) => Ok(Some(S::PortraitSixteenNine)), - Some(CommonAspectRatio::TallThreeByFour) => Ok(Some(S::PortraitFourThree)), + Some(RouterAspectRatio::Tall) | Some(RouterAspectRatio::TallNineBySixteen) => Ok(Some(S::PortraitSixteenNine)), + Some(RouterAspectRatio::TallThreeByFour) => Ok(Some(S::PortraitFourThree)), - Some(unsupported @ CommonAspectRatio::TallFourByFive) - | Some(unsupported @ CommonAspectRatio::TallTwoByThree) - | Some(unsupported @ CommonAspectRatio::TallNineByTwentyOne) => match strategy { + Some(unsupported @ RouterAspectRatio::TallFourByFive) + | Some(unsupported @ RouterAspectRatio::TallTwoByThree) + | Some(unsupported @ RouterAspectRatio::TallNineByTwentyOne) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { Err(ArtcraftRouterError::Client(ClientError::ModelDoesNotSupportOption { field: "aspect_ratio", @@ -219,13 +219,13 @@ fn resolve_image_list_ref( #[cfg(test)] mod tests { use super::*; - use crate::api::common_image_model::CommonImageModel; - use crate::api::provider::Provider; + use crate::api::router_image_model::RouterImageModel; + use crate::api::router_provider::RouterProvider; fn base_builder() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::Seedream5Lite, - provider: Provider::Fal, + model: RouterImageModel::Seedream5Lite, + provider: RouterProvider::Fal, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -251,7 +251,7 @@ mod tests { #[test] fn auto_maps_to_auto2k() { let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Auto), + aspect_ratio: Some(RouterAspectRatio::Auto), ..base_builder() }; let req = unwrap_t2i(build_fal_seedream_5_lite(builder)); @@ -262,7 +262,7 @@ mod tests { fn auto4k_falls_back_to_auto3k() { // Seedream 5 Lite has no 4K — clamp to 3K. let builder = GenerateImageRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Auto4k), + aspect_ratio: Some(RouterAspectRatio::Auto4k), ..base_builder() }; let req = unwrap_t2i(build_fal_seedream_5_lite(builder)); @@ -278,7 +278,7 @@ mod tests { #[test] fn resolution_two_k_triggers_auto2k_when_no_aspect() { let builder = GenerateImageRequestBuilder { - resolution: Some(CommonResolution::TwoK), + resolution: Some(RouterResolution::TwoK), ..base_builder() }; let req = unwrap_t2i(build_fal_seedream_5_lite(builder)); @@ -288,7 +288,7 @@ mod tests { #[test] fn resolution_four_k_clamps_to_auto3k() { let builder = GenerateImageRequestBuilder { - resolution: Some(CommonResolution::FourK), + resolution: Some(RouterResolution::FourK), ..base_builder() }; let req = unwrap_t2i(build_fal_seedream_5_lite(builder)); diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_splat/cost/artcraft/estimate_splat_cost_artcraft_marble_0p1_mini.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_splat/cost/artcraft/estimate_splat_cost_artcraft_marble_0p1_mini.rs index 7459c6087a..34da23c64c 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_splat/cost/artcraft/estimate_splat_cost_artcraft_marble_0p1_mini.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_splat/cost/artcraft/estimate_splat_cost_artcraft_marble_0p1_mini.rs @@ -28,16 +28,16 @@ pub(crate) fn estimate_splat_cost_artcraft_marble_0p1_mini( #[cfg(test)] mod tests { - use crate::api::common_splat_model::CommonSplatModel; - use crate::api::provider::Provider; + use crate::api::router_splat_model::RouterSplatModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_splat::generate_splat_request::GenerateSplatRequest; use tokens::tokens::media_files::MediaFileToken; fn estimate_usd_cents(prompt: Option<&str>, image_tokens: Option>) -> u64 { let request = GenerateSplatRequest { - model: CommonSplatModel::Marble0p1Mini, - provider: Provider::Artcraft, + model: RouterSplatModel::Marble0p1Mini, + provider: RouterProvider::Artcraft, prompt: prompt.map(|s| s.to_string()), reference_images: image_tokens.map(crate::api::image_list_ref::ImageListRef::MediaFileTokens), idempotency_token: None, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_splat/cost/artcraft/estimate_splat_cost_artcraft_marble_0p1_plus.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_splat/cost/artcraft/estimate_splat_cost_artcraft_marble_0p1_plus.rs index 63e17ef2b5..5b5be1f770 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_splat/cost/artcraft/estimate_splat_cost_artcraft_marble_0p1_plus.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_splat/cost/artcraft/estimate_splat_cost_artcraft_marble_0p1_plus.rs @@ -28,16 +28,16 @@ pub(crate) fn estimate_splat_cost_artcraft_marble_0p1_plus( #[cfg(test)] mod tests { - use crate::api::common_splat_model::CommonSplatModel; - use crate::api::provider::Provider; + use crate::api::router_splat_model::RouterSplatModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_splat::generate_splat_request::GenerateSplatRequest; use tokens::tokens::media_files::MediaFileToken; fn estimate_usd_cents(prompt: Option<&str>, image_tokens: Option>) -> u64 { let request = GenerateSplatRequest { - model: CommonSplatModel::Marble0p1Plus, - provider: Provider::Artcraft, + model: RouterSplatModel::Marble0p1Plus, + provider: RouterProvider::Artcraft, prompt: prompt.map(|s| s.to_string()), reference_images: image_tokens.map(crate::api::image_list_ref::ImageListRef::MediaFileTokens), idempotency_token: None, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_splat/generate_splat_request.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_splat/generate_splat_request.rs index 017c1cbd8d..c1f5f24882 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_splat/generate_splat_request.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_splat/generate_splat_request.rs @@ -1,6 +1,6 @@ -use crate::api::common_splat_model::CommonSplatModel; +use crate::api::router_splat_model::RouterSplatModel; use crate::api::image_list_ref::ImageListRef; -use crate::api::provider::Provider; +use crate::api::router_provider::RouterProvider; use crate::errors::artcraft_router_error::ArtcraftRouterError; use crate::generate::generate_splat::plan::artcraft::plan_generate_splat_artcraft_marble_0p1_mini::plan_generate_splat_artcraft_marble_0p1_mini; use crate::generate::generate_splat::plan::artcraft::plan_generate_splat_artcraft_marble_0p1_plus::plan_generate_splat_artcraft_marble_0p1_plus; @@ -8,10 +8,10 @@ use crate::generate::generate_splat::splat_generation_plan::SplatGenerationPlan; pub struct GenerateSplatRequest { /// Which model to use. - pub model: CommonSplatModel, + pub model: RouterSplatModel, /// Which provider to use. - pub provider: Provider, + pub provider: RouterProvider, /// The prompt for splat generation (optional). pub prompt: Option, @@ -28,15 +28,15 @@ impl GenerateSplatRequest { /// Read the splat generation request, construct a plan, then yield a means to execute it. pub fn build(&self) -> Result { match self.provider { - Provider::Artcraft => self.build_artcraft(), + RouterProvider::Artcraft => self.build_artcraft(), _ => self.unsupported_provider(), } } fn build_artcraft(&self) -> Result { match self.model { - CommonSplatModel::Marble0p1Mini => plan_generate_splat_artcraft_marble_0p1_mini(self), - CommonSplatModel::Marble0p1Plus => plan_generate_splat_artcraft_marble_0p1_plus(self), + RouterSplatModel::Marble0p1Mini => plan_generate_splat_artcraft_marble_0p1_mini(self), + RouterSplatModel::Marble0p1Plus => plan_generate_splat_artcraft_marble_0p1_plus(self), } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video/generate_video_request_builder.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video/generate_video_request_builder.rs index 438e020c19..e63162dca1 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video/generate_video_request_builder.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video/generate_video_request_builder.rs @@ -1,11 +1,11 @@ use crate::api::audio_list_ref::AudioListRef; use crate::api::character_list_ref::CharacterListRef; -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_resolution::CommonResolution; -use crate::api::common_video_model::CommonVideoModel; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_resolution::RouterResolution; +use crate::api::router_video_model::RouterVideoModel; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; -use crate::api::provider::Provider; +use crate::api::router_provider::RouterProvider; use crate::api::video_list_ref::VideoListRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -59,15 +59,15 @@ use crate::generate::generate_video_v2::providers::fal::veo_3p1_fast::build::bui use crate::generate::generate_video_v2::providers::kinovi::seedance_2p0_fast::build::build_kinovi_seedance_2p0_fast; use crate::generate::generate_video_v2::video_generation_draft_or_request::VideoGenerationDraftOrRequest; -/// Provider-agnostic video generation request. Distilled by `build2()` into a +/// RouterProvider-agnostic video generation request. Distilled by `build2()` into a /// `VideoGenerationDraftOrRequest` for the selected (provider, model) pair. #[derive(Clone, Debug)] pub struct GenerateVideoRequestBuilder { /// Which model to use. - pub model: CommonVideoModel, + pub model: RouterVideoModel, /// Which provider to use. - pub provider: Provider, + pub provider: RouterProvider, /// The prompt for the video generation pub prompt: Option, @@ -94,10 +94,10 @@ pub struct GenerateVideoRequestBuilder { pub reference_character_tokens: Option, /// The resolution to use - pub resolution: Option, + pub resolution: Option, /// The aspect ratio to use - pub aspect_ratio: Option, + pub aspect_ratio: Option, /// How many seconds to generate. pub duration_seconds: Option, @@ -122,8 +122,8 @@ pub struct GenerateVideoRequestBuilder { impl Default for GenerateVideoRequestBuilder { fn default() -> Self { Self { - model: CommonVideoModel::Seedance2p0, - provider: Provider::Artcraft, + model: RouterVideoModel::Seedance2p0, + provider: RouterProvider::Artcraft, request_mismatch_mitigation_strategy: RequestMismatchMitigationStrategy::PayMoreUpgrade, prompt: None, negative_prompt: None, @@ -148,58 +148,58 @@ impl GenerateVideoRequestBuilder { pub fn build2(self) -> Result { match (self.provider, self.model) { // Artcraft - (Provider::Artcraft, CommonVideoModel::GrokImagineVideo) => build_artcraft_grok_imagine_video(self), - (Provider::Artcraft, CommonVideoModel::HappyHorse1p0) => build_artcraft_happy_horse_1p0(self), - (Provider::Artcraft, CommonVideoModel::Kling16Pro) => build_artcraft_kling_1_6_pro(self), - (Provider::Artcraft, CommonVideoModel::Kling21Master) => build_artcraft_kling_2_1_master(self), - (Provider::Artcraft, CommonVideoModel::Kling21Pro) => build_artcraft_kling_2_1_pro(self), - (Provider::Artcraft, CommonVideoModel::Kling2p5TurboPro) => build_artcraft_kling_2_5_turbo_pro(self), - (Provider::Artcraft, CommonVideoModel::Kling2p6Pro) => build_artcraft_kling_2_6_pro(self), - (Provider::Artcraft, CommonVideoModel::Kling3p0Pro) => build_artcraft_kling_3p0_pro(self), - (Provider::Artcraft, CommonVideoModel::Kling3p0Standard) => build_artcraft_kling_3p0_standard(self), - (Provider::Artcraft, CommonVideoModel::Seedance2p0) => build_artcraft_seedance_2p0(self), - (Provider::Artcraft, CommonVideoModel::Seedance2p0Fast) => build_artcraft_seedance_2p0_fast(self), - (Provider::Artcraft, CommonVideoModel::Seedance2p0Ultra) => build_artcraft_seedance_2p0_u(self), - (Provider::Artcraft, CommonVideoModel::Seedance2p0UltraFast) => build_artcraft_seedance_2p0_u_fast(self), - (Provider::Artcraft, CommonVideoModel::Seedance2p0BytePlus) => build_artcraft_seedance_2p0_bp(self), - (Provider::Artcraft, CommonVideoModel::Seedance2p0BytePlusFast) => build_artcraft_seedance_2p0_bp_fast(self), - (Provider::Artcraft, CommonVideoModel::PreviewModel) => build_artcraft_preview_model(self), - (Provider::Artcraft, CommonVideoModel::PreviewModelFast) => build_artcraft_preview_model_fast(self), - (Provider::Artcraft, CommonVideoModel::Seedance10Lite) => build_artcraft_seedance_1p0_lite(self), - (Provider::Artcraft, CommonVideoModel::Seedance1p5Pro) => build_artcraft_seedance_1p5_pro(self), - (Provider::Artcraft, CommonVideoModel::Sora2) => build_artcraft_sora_2(self), - (Provider::Artcraft, CommonVideoModel::Sora2Pro) => build_artcraft_sora_2_pro(self), - (Provider::Artcraft, CommonVideoModel::Veo2) => build_artcraft_veo_2(self), - (Provider::Artcraft, CommonVideoModel::Veo3) => build_artcraft_veo_3(self), - (Provider::Artcraft, CommonVideoModel::Veo3Fast) => build_artcraft_veo_3_fast(self), - (Provider::Artcraft, CommonVideoModel::Veo3p1) => build_artcraft_veo_3p1(self), - (Provider::Artcraft, CommonVideoModel::Veo3p1Fast) => build_artcraft_veo_3p1_fast(self), + (RouterProvider::Artcraft, RouterVideoModel::GrokImagineVideo) => build_artcraft_grok_imagine_video(self), + (RouterProvider::Artcraft, RouterVideoModel::HappyHorse1p0) => build_artcraft_happy_horse_1p0(self), + (RouterProvider::Artcraft, RouterVideoModel::Kling16Pro) => build_artcraft_kling_1_6_pro(self), + (RouterProvider::Artcraft, RouterVideoModel::Kling21Master) => build_artcraft_kling_2_1_master(self), + (RouterProvider::Artcraft, RouterVideoModel::Kling21Pro) => build_artcraft_kling_2_1_pro(self), + (RouterProvider::Artcraft, RouterVideoModel::Kling2p5TurboPro) => build_artcraft_kling_2_5_turbo_pro(self), + (RouterProvider::Artcraft, RouterVideoModel::Kling2p6Pro) => build_artcraft_kling_2_6_pro(self), + (RouterProvider::Artcraft, RouterVideoModel::Kling3p0Pro) => build_artcraft_kling_3p0_pro(self), + (RouterProvider::Artcraft, RouterVideoModel::Kling3p0Standard) => build_artcraft_kling_3p0_standard(self), + (RouterProvider::Artcraft, RouterVideoModel::Seedance2p0) => build_artcraft_seedance_2p0(self), + (RouterProvider::Artcraft, RouterVideoModel::Seedance2p0Fast) => build_artcraft_seedance_2p0_fast(self), + (RouterProvider::Artcraft, RouterVideoModel::Seedance2p0Ultra) => build_artcraft_seedance_2p0_u(self), + (RouterProvider::Artcraft, RouterVideoModel::Seedance2p0UltraFast) => build_artcraft_seedance_2p0_u_fast(self), + (RouterProvider::Artcraft, RouterVideoModel::Seedance2p0BytePlus) => build_artcraft_seedance_2p0_bp(self), + (RouterProvider::Artcraft, RouterVideoModel::Seedance2p0BytePlusFast) => build_artcraft_seedance_2p0_bp_fast(self), + (RouterProvider::Artcraft, RouterVideoModel::PreviewModel) => build_artcraft_preview_model(self), + (RouterProvider::Artcraft, RouterVideoModel::PreviewModelFast) => build_artcraft_preview_model_fast(self), + (RouterProvider::Artcraft, RouterVideoModel::Seedance10Lite) => build_artcraft_seedance_1p0_lite(self), + (RouterProvider::Artcraft, RouterVideoModel::Seedance1p5Pro) => build_artcraft_seedance_1p5_pro(self), + (RouterProvider::Artcraft, RouterVideoModel::Sora2) => build_artcraft_sora_2(self), + (RouterProvider::Artcraft, RouterVideoModel::Sora2Pro) => build_artcraft_sora_2_pro(self), + (RouterProvider::Artcraft, RouterVideoModel::Veo2) => build_artcraft_veo_2(self), + (RouterProvider::Artcraft, RouterVideoModel::Veo3) => build_artcraft_veo_3(self), + (RouterProvider::Artcraft, RouterVideoModel::Veo3Fast) => build_artcraft_veo_3_fast(self), + (RouterProvider::Artcraft, RouterVideoModel::Veo3p1) => build_artcraft_veo_3p1(self), + (RouterProvider::Artcraft, RouterVideoModel::Veo3p1Fast) => build_artcraft_veo_3p1_fast(self), // Fal - (Provider::Fal, CommonVideoModel::Kling16Pro) => build_fal_kling_1_6_pro(self), - (Provider::Fal, CommonVideoModel::Kling21Master) => build_fal_kling_2_1_master(self), - (Provider::Fal, CommonVideoModel::Kling21Pro) => build_fal_kling_2_1_pro(self), - (Provider::Fal, CommonVideoModel::Kling2p5TurboPro) => build_fal_kling_2_5_turbo_pro(self), - (Provider::Fal, CommonVideoModel::Kling2p6Pro) => build_fal_kling_2_6_pro(self), - (Provider::Fal, CommonVideoModel::Kling3p0Pro) => build_fal_kling_3p0_pro(self), - (Provider::Fal, CommonVideoModel::Kling3p0Standard) => build_fal_kling_3p0_standard(self), - (Provider::Fal, CommonVideoModel::Seedance10Lite) => build_fal_seedance_1p0_lite(self), - (Provider::Fal, CommonVideoModel::Seedance1p5Pro) => build_fal_seedance_1p5_pro(self), - (Provider::Fal, CommonVideoModel::Sora2) => build_fal_sora_2(self), - (Provider::Fal, CommonVideoModel::Sora2Pro) => build_fal_sora_2_pro(self), - (Provider::Fal, CommonVideoModel::Veo2) => build_fal_veo_2(self), - (Provider::Fal, CommonVideoModel::Veo3) => build_fal_veo_3(self), - (Provider::Fal, CommonVideoModel::Veo3Fast) => build_fal_veo_3_fast(self), - (Provider::Fal, CommonVideoModel::Veo3p1) => build_fal_veo_3p1(self), - (Provider::Fal, CommonVideoModel::Veo3p1Fast) => build_fal_veo_3p1_fast(self), + (RouterProvider::Fal, RouterVideoModel::Kling16Pro) => build_fal_kling_1_6_pro(self), + (RouterProvider::Fal, RouterVideoModel::Kling21Master) => build_fal_kling_2_1_master(self), + (RouterProvider::Fal, RouterVideoModel::Kling21Pro) => build_fal_kling_2_1_pro(self), + (RouterProvider::Fal, RouterVideoModel::Kling2p5TurboPro) => build_fal_kling_2_5_turbo_pro(self), + (RouterProvider::Fal, RouterVideoModel::Kling2p6Pro) => build_fal_kling_2_6_pro(self), + (RouterProvider::Fal, RouterVideoModel::Kling3p0Pro) => build_fal_kling_3p0_pro(self), + (RouterProvider::Fal, RouterVideoModel::Kling3p0Standard) => build_fal_kling_3p0_standard(self), + (RouterProvider::Fal, RouterVideoModel::Seedance10Lite) => build_fal_seedance_1p0_lite(self), + (RouterProvider::Fal, RouterVideoModel::Seedance1p5Pro) => build_fal_seedance_1p5_pro(self), + (RouterProvider::Fal, RouterVideoModel::Sora2) => build_fal_sora_2(self), + (RouterProvider::Fal, RouterVideoModel::Sora2Pro) => build_fal_sora_2_pro(self), + (RouterProvider::Fal, RouterVideoModel::Veo2) => build_fal_veo_2(self), + (RouterProvider::Fal, RouterVideoModel::Veo3) => build_fal_veo_3(self), + (RouterProvider::Fal, RouterVideoModel::Veo3Fast) => build_fal_veo_3_fast(self), + (RouterProvider::Fal, RouterVideoModel::Veo3p1) => build_fal_veo_3p1(self), + (RouterProvider::Fal, RouterVideoModel::Veo3p1Fast) => build_fal_veo_3p1_fast(self), // GmiCloud - (Provider::GmiCloud, CommonVideoModel::Seedance2p0Ultra) => build_gmicloud_seedance_2p0_u(self), - (Provider::GmiCloud, CommonVideoModel::Seedance2p0UltraFast) => build_gmicloud_seedance_2p0_u_fast(self), + (RouterProvider::GmiCloud, RouterVideoModel::Seedance2p0Ultra) => build_gmicloud_seedance_2p0_u(self), + (RouterProvider::GmiCloud, RouterVideoModel::Seedance2p0UltraFast) => build_gmicloud_seedance_2p0_u_fast(self), // Grok - (Provider::GrokApi, CommonVideoModel::GrokImagineVideo) => build_grok_api_grok_imagine_video(self), + (RouterProvider::GrokApi, RouterVideoModel::GrokImagineVideo) => build_grok_api_grok_imagine_video(self), // Kinovi - (Provider::Seedance2Pro, CommonVideoModel::HappyHorse1p0) => build_kinovi_happy_horse_1p0(self), - (Provider::Seedance2Pro, CommonVideoModel::Seedance2p0) => build_kinovi_seedance_2p0(self), - (Provider::Seedance2Pro, CommonVideoModel::Seedance2p0Fast) => build_kinovi_seedance_2p0_fast(self), + (RouterProvider::Seedance2Pro, RouterVideoModel::HappyHorse1p0) => build_kinovi_happy_horse_1p0(self), + (RouterProvider::Seedance2Pro, RouterVideoModel::Seedance2p0) => build_kinovi_seedance_2p0(self), + (RouterProvider::Seedance2Pro, RouterVideoModel::Seedance2p0Fast) => build_kinovi_seedance_2p0_fast(self), _ => self.unsupported_provider_and_model(), } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/build_common.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/build_common.rs index cdfd086a90..dcb72bfa6a 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/build_common.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/build_common.rs @@ -3,8 +3,8 @@ use enums::common::generation::common_aspect_ratio::CommonAspectRatio as CommonA use enums::common::generation::common_resolution::CommonResolution as CommonResolutionEnum; use enums::common::generation::common_video_model::CommonVideoModel as CommonVideoModelEnum; -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_resolution::CommonResolution; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_resolution::RouterResolution; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; use crate::errors::client_error::ClientError; @@ -82,38 +82,38 @@ pub fn build_artcraft_omni_video_request( // ── Plan helpers ── fn plan_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ultra_wide: UltraWideSupport, ) -> Result, ArtcraftRouterError> { match aspect_ratio { None - | Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto4k) => Ok(None), + | Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto4k) => Ok(None), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => { + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => { Ok(Some(CommonAspectRatioEnum::WideSixteenByNine)) } - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => { + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => { Ok(Some(CommonAspectRatioEnum::TallNineBySixteen)) } - Some(CommonAspectRatio::Square) | Some(CommonAspectRatio::SquareHd) => { + Some(RouterAspectRatio::Square) | Some(RouterAspectRatio::SquareHd) => { Ok(Some(CommonAspectRatioEnum::Square)) } - Some(CommonAspectRatio::WideFourByThree) => Ok(Some(CommonAspectRatioEnum::WideFourByThree)), - Some(CommonAspectRatio::TallThreeByFour) => Ok(Some(CommonAspectRatioEnum::TallThreeByFour)), + Some(RouterAspectRatio::WideFourByThree) => Ok(Some(CommonAspectRatioEnum::WideFourByThree)), + Some(RouterAspectRatio::TallThreeByFour) => Ok(Some(CommonAspectRatioEnum::TallThreeByFour)), - Some(CommonAspectRatio::WideTwentyOneByNine) => match ultra_wide { + Some(RouterAspectRatio::WideTwentyOneByNine) => match ultra_wide { UltraWideSupport::Supported => Ok(Some(CommonAspectRatioEnum::WideTwentyOneByNine)), UltraWideSupport::Unsupported => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { Err(ArtcraftRouterError::Client(ClientError::ModelDoesNotSupportOption { field: "aspect_ratio", - value: format!("{:?}", CommonAspectRatio::WideTwentyOneByNine), + value: format!("{:?}", RouterAspectRatio::WideTwentyOneByNine), })) } - _ => Ok(Some(nearest_aspect_ratio(CommonAspectRatio::WideTwentyOneByNine))), + _ => Ok(Some(nearest_aspect_ratio(RouterAspectRatio::WideTwentyOneByNine))), }, }, @@ -132,27 +132,27 @@ fn plan_aspect_ratio( } } -fn nearest_aspect_ratio(aspect_ratio: CommonAspectRatio) -> CommonAspectRatioEnum { +fn nearest_aspect_ratio(aspect_ratio: RouterAspectRatio) -> CommonAspectRatioEnum { match aspect_ratio { - CommonAspectRatio::WideFiveByFour => CommonAspectRatioEnum::WideFourByThree, - CommonAspectRatio::WideThreeByTwo => CommonAspectRatioEnum::WideFourByThree, - CommonAspectRatio::WideTwentyOneByNine => CommonAspectRatioEnum::WideSixteenByNine, - CommonAspectRatio::TallFourByFive => CommonAspectRatioEnum::TallThreeByFour, - CommonAspectRatio::TallTwoByThree => CommonAspectRatioEnum::TallThreeByFour, - CommonAspectRatio::TallNineByTwentyOne => CommonAspectRatioEnum::TallNineBySixteen, + RouterAspectRatio::WideFiveByFour => CommonAspectRatioEnum::WideFourByThree, + RouterAspectRatio::WideThreeByTwo => CommonAspectRatioEnum::WideFourByThree, + RouterAspectRatio::WideTwentyOneByNine => CommonAspectRatioEnum::WideSixteenByNine, + RouterAspectRatio::TallFourByFive => CommonAspectRatioEnum::TallThreeByFour, + RouterAspectRatio::TallTwoByThree => CommonAspectRatioEnum::TallThreeByFour, + RouterAspectRatio::TallNineByTwentyOne => CommonAspectRatioEnum::TallNineBySixteen, _ => CommonAspectRatioEnum::Square, } } fn plan_output_resolution( - resolution: Option, + resolution: Option, strategy: RequestMismatchMitigationStrategy, supported: SupportedResolutions, ) -> Result, ArtcraftRouterError> { match resolution { None => Ok(None), - Some(CommonResolution::FourEightyP) => match supported { + Some(RouterResolution::FourEightyP) => match supported { SupportedResolutions::Full | SupportedResolutions::Fast => { Ok(Some(CommonResolutionEnum::FourEightyP)) } @@ -160,7 +160,7 @@ fn plan_output_resolution( RequestMismatchMitigationStrategy::ErrorOut => { Err(ArtcraftRouterError::Client(ClientError::ModelDoesNotSupportOption { field: "resolution", - value: format!("{:?}", CommonResolution::FourEightyP), + value: format!("{:?}", RouterResolution::FourEightyP), })) } RequestMismatchMitigationStrategy::PayMoreUpgrade => Ok(Some(CommonResolutionEnum::TenEightyP)), @@ -168,9 +168,9 @@ fn plan_output_resolution( }, }, - Some(CommonResolution::SevenTwentyP) => Ok(Some(CommonResolutionEnum::SevenTwentyP)), + Some(RouterResolution::SevenTwentyP) => Ok(Some(CommonResolutionEnum::SevenTwentyP)), - Some(CommonResolution::TenEightyP) => match supported { + Some(RouterResolution::TenEightyP) => match supported { SupportedResolutions::Full | SupportedResolutions::NoFourEightyP => { Ok(Some(CommonResolutionEnum::TenEightyP)) } @@ -178,7 +178,7 @@ fn plan_output_resolution( RequestMismatchMitigationStrategy::ErrorOut => { Err(ArtcraftRouterError::Client(ClientError::ModelDoesNotSupportOption { field: "resolution", - value: format!("{:?}", CommonResolution::TenEightyP), + value: format!("{:?}", RouterResolution::TenEightyP), })) } _ => Ok(Some(CommonResolutionEnum::SevenTwentyP)), @@ -194,14 +194,14 @@ fn plan_output_resolution( } RequestMismatchMitigationStrategy::PayMoreUpgrade => { Ok(Some(match (unsupported, supported) { - (CommonResolution::HalfK, _) => CommonResolutionEnum::FourEightyP, + (RouterResolution::HalfK, _) => CommonResolutionEnum::FourEightyP, (_, SupportedResolutions::Fast) => CommonResolutionEnum::SevenTwentyP, _ => CommonResolutionEnum::TenEightyP, })) } RequestMismatchMitigationStrategy::PayLessDowngrade => { Ok(Some(match (unsupported, supported) { - (CommonResolution::HalfK, _) => CommonResolutionEnum::FourEightyP, + (RouterResolution::HalfK, _) => CommonResolutionEnum::FourEightyP, (_, SupportedResolutions::Fast) => CommonResolutionEnum::SevenTwentyP, _ => CommonResolutionEnum::TenEightyP, })) diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/grok_imagine_video/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/grok_imagine_video/build.rs index b7ffbd4259..ad4df58620 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/grok_imagine_video/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/grok_imagine_video/build.rs @@ -38,10 +38,10 @@ mod tests { use tokens::tokens::media_files::MediaFileToken; use crate::api::character_list_ref::CharacterListRef; - use crate::api::common_resolution::CommonResolution; + use crate::api::router_resolution::RouterResolution; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use crate::generate::generate_video_v2::video_generation_draft_or_request::VideoGenerationDraftOrRequest; use crate::generate::generate_video_v2::video_generation_request::VideoGenerationRequest; @@ -87,20 +87,20 @@ mod tests { #[test] fn res_480p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::FourEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::FourEightyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::FourEightyP)); } #[test] fn res_720p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::SevenTwentyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::SevenTwentyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::SevenTwentyP)); } #[test] fn res_1080p_downgrades_to_720p() { // SupportedResolutions::Fast caps at 720p (Grok Imagine doesn't render 1080p output). - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::TenEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::TenEightyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::SevenTwentyP)); } @@ -155,7 +155,7 @@ mod tests { fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - provider: Provider::Artcraft, + provider: RouterProvider::Artcraft, duration_seconds: Some(5), video_batch_count: Some(1), ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/grok_imagine_video/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/grok_imagine_video/cost.rs index e725e1a230..fbe937c4b1 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/grok_imagine_video/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/grok_imagine_video/cost.rs @@ -72,11 +72,11 @@ impl ArtcraftGrokImagineVideoCostState { mod tests { use tokens::tokens::media_files::MediaFileToken; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use crate::generate::generate_video::video_generation_cost_estimate::VideoGenerationCostEstimate; @@ -90,30 +90,30 @@ mod tests { // 9.1 × 5 = 45.5 → 46 // 9.1 × 10 = 91.0 → 91 // 9.1 × 15 = 136.5 → 137 - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1), 46); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 10, 1), 91); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 15, 1), 137); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1), 46); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 10, 1), 91); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 15, 1), 137); } #[test] fn batch_2() { // 9.1 × 5 × 2 = 91 → 91 - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 2), 91); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 2), 91); // 9.1 × 15 × 2 = 273 → 273 - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 15, 2), 273); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 15, 2), 273); } #[test] fn batch_4() { // 9.1 × 5 × 4 = 182 → 182 - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 4), 182); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 4), 182); } #[test] fn none_defaults_to_720p() { assert_eq!( cost_cents(None, 5, 1), - cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1), + cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1), ); } } @@ -128,21 +128,21 @@ mod tests { // 6.5 × 5 = 32.5 → 33 // 6.5 × 10 = 65.0 → 65 // 6.5 × 15 = 97.5 → 98 - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 1), 33); - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 10, 1), 65); - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 15, 1), 98); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 1), 33); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 10, 1), 65); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 15, 1), 98); } #[test] fn batch_2() { // 6.5 × 5 × 2 = 65 → 65 - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 2), 65); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 2), 65); } #[test] fn batch_4() { // 6.5 × 5 × 4 = 130 → 130 - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 4), 130); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 4), 130); } } @@ -155,8 +155,8 @@ mod tests { fn single_start_frame_adds_input_charge() { // 720p 5s batch 1 = 45.5 + 0.26 (one start_frame) = 45.76 → ceil 46 // Identical to the no-image case (45.5 → 46) because of ceil rounding. - let with_img = cost_cents_with_images(Some(CommonResolution::SevenTwentyP), 5, 1, true, 0); - let no_img = cost_cents_with_images(Some(CommonResolution::SevenTwentyP), 5, 1, false, 0); + let with_img = cost_cents_with_images(Some(RouterResolution::SevenTwentyP), 5, 1, true, 0); + let no_img = cost_cents_with_images(Some(RouterResolution::SevenTwentyP), 5, 1, false, 0); assert_eq!(with_img, 46); assert_eq!(no_img, 46); } @@ -167,9 +167,9 @@ mod tests { // N=0 → 26 // N=1 → 26.26 → 27 // N=4 → 27.04 → 28 - assert_eq!(cost_cents_with_images(Some(CommonResolution::FourEightyP), 4, 1, false, 0), 26); - assert_eq!(cost_cents_with_images(Some(CommonResolution::FourEightyP), 4, 1, false, 1), 27); - assert_eq!(cost_cents_with_images(Some(CommonResolution::FourEightyP), 4, 1, false, 4), 28); + assert_eq!(cost_cents_with_images(Some(RouterResolution::FourEightyP), 4, 1, false, 0), 26); + assert_eq!(cost_cents_with_images(Some(RouterResolution::FourEightyP), 4, 1, false, 1), 27); + assert_eq!(cost_cents_with_images(Some(RouterResolution::FourEightyP), 4, 1, false, 4), 28); } } @@ -180,25 +180,25 @@ mod tests { #[test] fn cost_480p_cheaper_than_720p() { - let c480 = cost_cents(Some(CommonResolution::FourEightyP), 10, 1); - let c720 = cost_cents(Some(CommonResolution::SevenTwentyP), 10, 1); + let c480 = cost_cents(Some(RouterResolution::FourEightyP), 10, 1); + let c720 = cost_cents(Some(RouterResolution::SevenTwentyP), 10, 1); assert!(c480 < c720, "480p ({c480}) should be cheaper than 720p ({c720})"); } #[test] fn cost_scales_with_duration() { - let c5 = cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1); - let c10 = cost_cents(Some(CommonResolution::SevenTwentyP), 10, 1); - let c15 = cost_cents(Some(CommonResolution::SevenTwentyP), 15, 1); + let c5 = cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1); + let c10 = cost_cents(Some(RouterResolution::SevenTwentyP), 10, 1); + let c15 = cost_cents(Some(RouterResolution::SevenTwentyP), 15, 1); assert!(c5 < c10); assert!(c10 < c15); } #[test] fn cost_scales_with_batch() { - let b1 = cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1); - let b2 = cost_cents(Some(CommonResolution::SevenTwentyP), 5, 2); - let b4 = cost_cents(Some(CommonResolution::SevenTwentyP), 5, 4); + let b1 = cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1); + let b2 = cost_cents(Some(RouterResolution::SevenTwentyP), 5, 2); + let b4 = cost_cents(Some(RouterResolution::SevenTwentyP), 5, 4); assert!(b1 < b2); assert!(b2 < b4); } @@ -212,8 +212,8 @@ mod tests { #[test] fn credits_equal_usd_cents_all_combos() { let resolutions = [ - Some(CommonResolution::FourEightyP), - Some(CommonResolution::SevenTwentyP), + Some(RouterResolution::FourEightyP), + Some(RouterResolution::SevenTwentyP), None, ]; for res in resolutions { @@ -235,27 +235,27 @@ mod tests { mod small_margin { use super::*; - use crate::api::common_aspect_ratio::CommonAspectRatio; + use crate::api::router_aspect_ratio::RouterAspectRatio; #[test] fn small_margin() { let resolutions = [ None, - Some(CommonResolution::FourEightyP), - Some(CommonResolution::SevenTwentyP), - Some(CommonResolution::TenEightyP), // clamps to 720p on both sides + Some(RouterResolution::FourEightyP), + Some(RouterResolution::SevenTwentyP), + Some(RouterResolution::TenEightyP), // clamps to 720p on both sides ]; let durations: &[u16] = &[1, 4, 5, 8, 10, 12, 15]; let aspect_ratios = [ None, - Some(CommonAspectRatio::Auto), - Some(CommonAspectRatio::Square), - Some(CommonAspectRatio::WideSixteenByNine), - Some(CommonAspectRatio::TallNineBySixteen), - Some(CommonAspectRatio::WideFourByThree), - Some(CommonAspectRatio::TallThreeByFour), - Some(CommonAspectRatio::WideThreeByTwo), - Some(CommonAspectRatio::TallTwoByThree), + Some(RouterAspectRatio::Auto), + Some(RouterAspectRatio::Square), + Some(RouterAspectRatio::WideSixteenByNine), + Some(RouterAspectRatio::TallNineBySixteen), + Some(RouterAspectRatio::WideFourByThree), + Some(RouterAspectRatio::TallThreeByFour), + Some(RouterAspectRatio::WideThreeByTwo), + Some(RouterAspectRatio::TallTwoByThree), ]; // (has_start_frame, num_reference_images). At most one of the two is // non-default — start_frame and reference_images are mutually exclusive @@ -322,9 +322,9 @@ mod tests { // ── Cross-provider helpers ── fn artcraft_cents( - resolution: Option, + resolution: Option, duration_seconds: u16, - aspect_ratio: Option, + aspect_ratio: Option, has_start_frame: bool, num_reference_images: usize, ) -> u64 { @@ -341,8 +341,8 @@ mod tests { } else { None }; let builder = GenerateVideoRequestBuilder { - model: CommonVideoModel::GrokImagineVideo, - provider: Provider::Artcraft, + model: RouterVideoModel::GrokImagineVideo, + provider: RouterProvider::Artcraft, resolution, aspect_ratio, duration_seconds: Some(duration_seconds), @@ -363,9 +363,9 @@ mod tests { } fn grokapi_cents( - resolution: Option, + resolution: Option, duration_seconds: u16, - aspect_ratio: Option, + aspect_ratio: Option, has_start_frame: bool, num_reference_images: usize, ) -> u64 { @@ -382,8 +382,8 @@ mod tests { } else { None }; let builder = GenerateVideoRequestBuilder { - model: CommonVideoModel::GrokImagineVideo, - provider: Provider::GrokApi, + model: RouterVideoModel::GrokImagineVideo, + provider: RouterProvider::GrokApi, resolution, aspect_ratio, duration_seconds: Some(duration_seconds), @@ -404,13 +404,13 @@ mod tests { // ── Helpers ── fn build_cost( - resolution: Option, + resolution: Option, duration_seconds: u16, video_batch_count: u16, ) -> VideoGenerationCostEstimate { let builder = GenerateVideoRequestBuilder { - model: CommonVideoModel::GrokImagineVideo, - provider: Provider::Artcraft, + model: RouterVideoModel::GrokImagineVideo, + provider: RouterProvider::Artcraft, resolution, duration_seconds: Some(duration_seconds), video_batch_count: Some(video_batch_count), @@ -423,7 +423,7 @@ mod tests { } fn cost_cents( - resolution: Option, + resolution: Option, duration_seconds: u16, video_batch_count: u16, ) -> u64 { @@ -433,7 +433,7 @@ mod tests { } fn cost_cents_with_images( - resolution: Option, + resolution: Option, duration_seconds: u16, video_batch_count: u16, has_start_frame: bool, @@ -451,8 +451,8 @@ mod tests { } else { None }; let builder = GenerateVideoRequestBuilder { - model: CommonVideoModel::GrokImagineVideo, - provider: Provider::Artcraft, + model: RouterVideoModel::GrokImagineVideo, + provider: RouterProvider::Artcraft, resolution, duration_seconds: Some(duration_seconds), video_batch_count: Some(video_batch_count), diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/happy_horse_1p0/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/happy_horse_1p0/build.rs index 0409013935..76fc4754a2 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/happy_horse_1p0/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/happy_horse_1p0/build.rs @@ -28,10 +28,10 @@ mod tests { use tokens::tokens::media_files::MediaFileToken; use crate::api::character_list_ref::CharacterListRef; - use crate::api::common_resolution::CommonResolution; + use crate::api::router_resolution::RouterResolution; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use crate::generate::generate_video_v2::video_generation_draft_or_request::VideoGenerationDraftOrRequest; use crate::generate::generate_video_v2::video_generation_request::VideoGenerationRequest; @@ -77,13 +77,13 @@ mod tests { #[test] fn res_720p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::SevenTwentyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::SevenTwentyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::SevenTwentyP)); } #[test] fn res_1080p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::TenEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::TenEightyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::TenEightyP)); } @@ -95,7 +95,7 @@ mod tests { #[test] fn unsupported_480p_upgrades() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::FourEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::FourEightyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::TenEightyP)); } } @@ -144,8 +144,8 @@ mod tests { fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: crate::api::common_video_model::CommonVideoModel::HappyHorse1p0, - provider: Provider::Artcraft, + model: crate::api::router_video_model::RouterVideoModel::HappyHorse1p0, + provider: RouterProvider::Artcraft, duration_seconds: Some(5), video_batch_count: Some(1), ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/happy_horse_1p0/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/happy_horse_1p0/cost.rs index bb44ba1c89..e9b82bb50d 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/happy_horse_1p0/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/happy_horse_1p0/cost.rs @@ -66,9 +66,9 @@ impl ArtcraftHappyHorse1p0CostState { #[cfg(test)] mod tests { - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; // ── 720p pricing (33 upstream credits/sec) ── @@ -80,25 +80,25 @@ mod tests { fn batch_1() { // 33 credits/sec; upstream_credits / 193 * 100 // (NB: duration 3s is clamped to 4s by the builder) - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 4, 1), 68); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1), 85); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 10, 1), 171); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 15, 1), 256); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 4, 1), 68); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1), 85); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 10, 1), 171); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 15, 1), 256); } #[test] fn batch_2() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 2), 171); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 2), 171); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 4), 342); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 4), 342); } #[test] fn none_defaults_to_720p() { - assert_eq!(cost_cents(None, 5, 1), cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1)); + assert_eq!(cost_cents(None, 5, 1), cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1)); } } @@ -111,20 +111,20 @@ mod tests { fn batch_1() { // 66 credits/sec; upstream_credits / 193 * 100 // (NB: duration 3s is clamped to 4s by the builder) - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 4, 1), 137); - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 5, 1), 171); - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 10, 1), 342); - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 15, 1), 513); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 4, 1), 137); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 5, 1), 171); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 10, 1), 342); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 15, 1), 513); } #[test] fn batch_2() { - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 5, 2), 342); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 5, 2), 342); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 5, 4), 684); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 5, 4), 684); } } @@ -135,8 +135,8 @@ mod tests { #[test] fn cost_720p_cheaper_than_1080p() { - let c720 = cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1); - let c1080 = cost_cents(Some(CommonResolution::TenEightyP), 5, 1); + let c720 = cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1); + let c1080 = cost_cents(Some(RouterResolution::TenEightyP), 5, 1); assert!(c720 < c1080); } @@ -145,8 +145,8 @@ mod tests { // 1080p upstream credits are exactly 2× 720p, but USD cents may differ // by ±1 due to rounding (each is rounded independently). for dur in [4u16, 5, 10, 15] { - let c720 = cost_cents(Some(CommonResolution::SevenTwentyP), dur, 1); - let c1080 = cost_cents(Some(CommonResolution::TenEightyP), dur, 1); + let c720 = cost_cents(Some(RouterResolution::SevenTwentyP), dur, 1); + let c1080 = cost_cents(Some(RouterResolution::TenEightyP), dur, 1); let expected = c720 * 2; assert!( c1080 >= expected - 1 && c1080 <= expected + 1, @@ -182,8 +182,8 @@ mod tests { #[test] fn credits_equal_usd_cents() { let resolutions = [ - Some(CommonResolution::SevenTwentyP), - Some(CommonResolution::TenEightyP), + Some(RouterResolution::SevenTwentyP), + Some(RouterResolution::TenEightyP), None, ]; for res in resolutions { @@ -209,9 +209,9 @@ mod tests { #[test] fn artcraft_matches_kinovi_all_combos() { let resolutions = [ - Some(CommonResolution::SevenTwentyP), + Some(RouterResolution::SevenTwentyP), None, - Some(CommonResolution::TenEightyP), + Some(RouterResolution::TenEightyP), ]; let durations: [u16; 4] = [4, 5, 10, 15]; let batches: [u16; 3] = [1, 2, 4]; @@ -222,8 +222,8 @@ mod tests { let artcraft_cost = build_cost(*res, *dur, *batch); let kinovi = GenerateVideoRequestBuilder { - model: CommonVideoModel::HappyHorse1p0, - provider: Provider::Seedance2Pro, + model: RouterVideoModel::HappyHorse1p0, + provider: RouterProvider::Seedance2Pro, resolution: *res, duration_seconds: Some(*dur), video_batch_count: Some(*batch), @@ -248,13 +248,13 @@ mod tests { // ── Helpers ── fn build_cost( - resolution: Option, + resolution: Option, duration_seconds: u16, video_batch_count: u16, ) -> crate::generate::generate_video::video_generation_cost_estimate::VideoGenerationCostEstimate { let builder = GenerateVideoRequestBuilder { - model: CommonVideoModel::HappyHorse1p0, - provider: Provider::Artcraft, + model: RouterVideoModel::HappyHorse1p0, + provider: RouterProvider::Artcraft, resolution, duration_seconds: Some(duration_seconds), video_batch_count: Some(video_batch_count), @@ -267,7 +267,7 @@ mod tests { } fn cost_cents( - resolution: Option, + resolution: Option, duration_seconds: u16, video_batch_count: u16, ) -> u64 { diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/happy_horse_1p0/request.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/happy_horse_1p0/request.rs index 465b8c9272..49896eeb5b 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/happy_horse_1p0/request.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/happy_horse_1p0/request.rs @@ -20,11 +20,11 @@ impl ArtcraftHappyHorse1p0RequestState { mod tests { use tokens::tokens::media_files::MediaFileToken; - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::client::router_artcraft_client::RouterArtcraftClient; use crate::client::router_client::RouterClient; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; @@ -43,7 +43,7 @@ mod tests { async fn landscape() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A corgi running through a field of wildflowers at sunset.".to_string()), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -55,7 +55,7 @@ mod tests { async fn portrait() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A cat sitting on a windowsill watching rain.".to_string()), - aspect_ratio: Some(CommonAspectRatio::TallNineBySixteen), + aspect_ratio: Some(RouterAspectRatio::TallNineBySixteen), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -67,7 +67,7 @@ mod tests { async fn square() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A hummingbird hovering near a flower.".to_string()), - aspect_ratio: Some(CommonAspectRatio::Square), + aspect_ratio: Some(RouterAspectRatio::Square), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -83,7 +83,7 @@ mod tests { async fn res_720p() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A golden retriever catching a frisbee on the beach.".to_string()), - resolution: Some(CommonResolution::SevenTwentyP), + resolution: Some(RouterResolution::SevenTwentyP), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -95,7 +95,7 @@ mod tests { async fn res_1080p() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A fox walking through a snowy forest.".to_string()), - resolution: Some(CommonResolution::TenEightyP), + resolution: Some(RouterResolution::TenEightyP), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -111,7 +111,7 @@ mod tests { async fn text_to_video() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A whale breaching in the open ocean at dawn, cinematic.".to_string()), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -124,7 +124,7 @@ mod tests { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("The dog watches the lake as the sun sets.".to_string()), start_frame: Some(ImageRef::MediaFileToken(MediaFileToken::new(JUNO_AT_LAKE_PRODUCTION_MEDIA_TOKEN.to_string()))), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -136,8 +136,8 @@ mod tests { fn artcraft_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::HappyHorse1p0, - provider: Provider::Artcraft, + model: RouterVideoModel::HappyHorse1p0, + provider: RouterProvider::Artcraft, duration_seconds: Some(4), video_batch_count: Some(1), ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_1_6_pro/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_1_6_pro/cost.rs index 6a00713823..6b434e4b21 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_1_6_pro/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_1_6_pro/cost.rs @@ -32,16 +32,16 @@ impl ArtcraftKling16ProCostState { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use tokens::tokens::media_files::MediaFileToken; fn cost_cents(duration_seconds: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Kling16Pro, - provider: Provider::Artcraft, + model: RouterVideoModel::Kling16Pro, + provider: RouterProvider::Artcraft, prompt: Some("test".to_string()), start_frame: Some(ImageRef::MediaFileToken(MediaFileToken::new("mf_x".to_string()))), duration_seconds, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_2_1_master/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_2_1_master/cost.rs index 8583691ca2..58a2f61330 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_2_1_master/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_2_1_master/cost.rs @@ -29,16 +29,16 @@ impl ArtcraftKling21MasterCostState { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use tokens::tokens::media_files::MediaFileToken; fn cost_cents(duration_seconds: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Kling21Master, - provider: Provider::Artcraft, + model: RouterVideoModel::Kling21Master, + provider: RouterProvider::Artcraft, prompt: Some("test".to_string()), start_frame: Some(ImageRef::MediaFileToken(MediaFileToken::new("mf_x".to_string()))), duration_seconds, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_2_1_pro/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_2_1_pro/cost.rs index 5b6550ca74..bdc7db61b5 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_2_1_pro/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_2_1_pro/cost.rs @@ -29,16 +29,16 @@ impl ArtcraftKling21ProCostState { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use tokens::tokens::media_files::MediaFileToken; fn cost_cents(duration_seconds: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Kling21Pro, - provider: Provider::Artcraft, + model: RouterVideoModel::Kling21Pro, + provider: RouterProvider::Artcraft, prompt: Some("test".to_string()), start_frame: Some(ImageRef::MediaFileToken(MediaFileToken::new("mf_x".to_string()))), duration_seconds, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_2_5_turbo_pro/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_2_5_turbo_pro/cost.rs index f1d4cae014..8b7cba9772 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_2_5_turbo_pro/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_2_5_turbo_pro/cost.rs @@ -29,14 +29,14 @@ impl ArtcraftKling2p5TurboProCostState { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; fn cost_cents(duration_seconds: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Kling2p5TurboPro, - provider: Provider::Artcraft, + model: RouterVideoModel::Kling2p5TurboPro, + provider: RouterProvider::Artcraft, prompt: Some("test".to_string()), duration_seconds, ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_2_6_pro/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_2_6_pro/cost.rs index 5c91df95d0..fe803cb3e8 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_2_6_pro/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_2_6_pro/cost.rs @@ -41,14 +41,14 @@ impl ArtcraftKling2p6ProCostState { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; fn cost_cents(duration_seconds: Option, generate_audio: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Kling2p6Pro, - provider: Provider::Artcraft, + model: RouterVideoModel::Kling2p6Pro, + provider: RouterProvider::Artcraft, prompt: Some("test".to_string()), duration_seconds, generate_audio, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_3p0_pro/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_3p0_pro/cost.rs index 182bc3cb17..bc5465aa86 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_3p0_pro/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_3p0_pro/cost.rs @@ -38,14 +38,14 @@ impl ArtcraftKling3p0ProCostState { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; fn cost_cents(duration_seconds: Option, generate_audio: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Kling3p0Pro, - provider: Provider::Artcraft, + model: RouterVideoModel::Kling3p0Pro, + provider: RouterProvider::Artcraft, prompt: Some("test".to_string()), duration_seconds, generate_audio, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_3p0_standard/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_3p0_standard/cost.rs index 7cb3b41834..a70762f303 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_3p0_standard/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/kling_3p0_standard/cost.rs @@ -36,14 +36,14 @@ impl ArtcraftKling3p0StandardCostState { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; fn cost_cents(duration_seconds: Option, generate_audio: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Kling3p0Standard, - provider: Provider::Artcraft, + model: RouterVideoModel::Kling3p0Standard, + provider: RouterProvider::Artcraft, prompt: Some("test".to_string()), duration_seconds, generate_audio, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/preview_model/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/preview_model/build.rs index b3014bf0a7..461d3735a3 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/preview_model/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/preview_model/build.rs @@ -28,10 +28,10 @@ mod tests { use tokens::tokens::media_files::MediaFileToken; use crate::api::character_list_ref::CharacterListRef; - use crate::api::common_resolution::CommonResolution; + use crate::api::router_resolution::RouterResolution; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use crate::generate::generate_video_v2::video_generation_draft_or_request::VideoGenerationDraftOrRequest; use crate::generate::generate_video_v2::video_generation_request::VideoGenerationRequest; @@ -81,19 +81,19 @@ mod tests { #[test] fn res_480p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::FourEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::FourEightyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::FourEightyP)); } #[test] fn res_720p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::SevenTwentyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::SevenTwentyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::SevenTwentyP)); } #[test] fn res_1080p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::TenEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::TenEightyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::TenEightyP)); } @@ -150,7 +150,7 @@ mod tests { fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - provider: Provider::Artcraft, + provider: RouterProvider::Artcraft, duration_seconds: Some(5), video_batch_count: Some(1), ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/preview_model/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/preview_model/cost.rs index 56ad1865b4..4148d4f26b 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/preview_model/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/preview_model/cost.rs @@ -55,9 +55,9 @@ impl ArtcraftPreviewModelCostState { #[cfg(test)] mod tests { - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; // -- 720p pricing -- @@ -67,27 +67,27 @@ mod tests { #[test] fn batch_1() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 4, 1), 100); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1), 125); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 10, 1), 250); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 15, 1), 375); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 4, 1), 100); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1), 125); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 10, 1), 250); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 15, 1), 375); } #[test] fn batch_2() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 2), 250); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 15, 2), 750); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 2), 250); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 15, 2), 750); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 4), 500); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 15, 4), 1500); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 4), 500); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 15, 4), 1500); } #[test] fn none_defaults_to_720p() { - assert_eq!(cost_cents(None, 5, 1), cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1)); + assert_eq!(cost_cents(None, 5, 1), cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1)); } } @@ -98,20 +98,20 @@ mod tests { #[test] fn batch_1() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 4, 1), 40); - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 1), 50); - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 10, 1), 100); - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 15, 1), 150); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 4, 1), 40); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 1), 50); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 10, 1), 100); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 15, 1), 150); } #[test] fn batch_2() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 2), 100); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 2), 100); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 4), 200); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 4), 200); } } @@ -122,20 +122,20 @@ mod tests { #[test] fn batch_1() { - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 4, 1), 200); - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 5, 1), 250); - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 10, 1), 500); - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 15, 1), 750); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 4, 1), 200); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 5, 1), 250); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 10, 1), 500); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 15, 1), 750); } #[test] fn batch_2() { - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 5, 2), 500); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 5, 2), 500); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 5, 4), 1000); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 5, 4), 1000); } } @@ -146,27 +146,27 @@ mod tests { #[test] fn cost_480p_cheaper_than_720p_cheaper_than_1080p() { - let c480 = cost_cents(Some(CommonResolution::FourEightyP), 5, 1); - let c720 = cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1); - let c1080 = cost_cents(Some(CommonResolution::TenEightyP), 5, 1); + let c480 = cost_cents(Some(RouterResolution::FourEightyP), 5, 1); + let c720 = cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1); + let c1080 = cost_cents(Some(RouterResolution::TenEightyP), 5, 1); assert!(c480 < c720); assert!(c720 < c1080); } #[test] fn cost_scales_with_duration() { - let c4 = cost_cents(Some(CommonResolution::SevenTwentyP), 4, 1); - let c10 = cost_cents(Some(CommonResolution::SevenTwentyP), 10, 1); - let c15 = cost_cents(Some(CommonResolution::SevenTwentyP), 15, 1); + let c4 = cost_cents(Some(RouterResolution::SevenTwentyP), 4, 1); + let c10 = cost_cents(Some(RouterResolution::SevenTwentyP), 10, 1); + let c15 = cost_cents(Some(RouterResolution::SevenTwentyP), 15, 1); assert!(c4 < c10); assert!(c10 < c15); } #[test] fn cost_scales_with_batch() { - let b1 = cost_cents(Some(CommonResolution::TenEightyP), 5, 1); - let b2 = cost_cents(Some(CommonResolution::TenEightyP), 5, 2); - let b4 = cost_cents(Some(CommonResolution::TenEightyP), 5, 4); + let b1 = cost_cents(Some(RouterResolution::TenEightyP), 5, 1); + let b2 = cost_cents(Some(RouterResolution::TenEightyP), 5, 2); + let b4 = cost_cents(Some(RouterResolution::TenEightyP), 5, 4); assert!(b1 < b2); assert!(b2 < b4); } @@ -180,9 +180,9 @@ mod tests { #[test] fn credits_equal_usd_cents_all_combos() { let resolutions = [ - Some(CommonResolution::FourEightyP), - Some(CommonResolution::SevenTwentyP), - Some(CommonResolution::TenEightyP), + Some(RouterResolution::FourEightyP), + Some(RouterResolution::SevenTwentyP), + Some(RouterResolution::TenEightyP), None, ]; for res in resolutions { @@ -203,13 +203,13 @@ mod tests { // -- Helpers -- fn build_cost( - resolution: Option, + resolution: Option, duration_seconds: u16, video_batch_count: u16, ) -> crate::generate::generate_video::video_generation_cost_estimate::VideoGenerationCostEstimate { let builder = GenerateVideoRequestBuilder { - model: CommonVideoModel::PreviewModel, - provider: Provider::Artcraft, + model: RouterVideoModel::PreviewModel, + provider: RouterProvider::Artcraft, resolution, duration_seconds: Some(duration_seconds), video_batch_count: Some(video_batch_count), @@ -222,7 +222,7 @@ mod tests { } fn cost_cents( - resolution: Option, + resolution: Option, duration_seconds: u16, video_batch_count: u16, ) -> u64 { diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/preview_model_fast/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/preview_model_fast/build.rs index 78c7fdab85..c52a42ab4f 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/preview_model_fast/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/preview_model_fast/build.rs @@ -28,11 +28,11 @@ mod tests { use tokens::tokens::media_files::MediaFileToken; use crate::api::character_list_ref::CharacterListRef; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use crate::generate::generate_video_v2::video_generation_draft_or_request::VideoGenerationDraftOrRequest; @@ -83,28 +83,28 @@ mod tests { #[test] fn res_480p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::FourEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::FourEightyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::FourEightyP)); } #[test] fn res_720p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::SevenTwentyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::SevenTwentyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::SevenTwentyP)); } #[test] fn res_1080p_downgrades_to_720p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::TenEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::TenEightyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::SevenTwentyP)); } #[test] fn res_1080p_error_out() { let result = build_artcraft_preview_model_fast(GenerateVideoRequestBuilder { - model: CommonVideoModel::PreviewModelFast, - provider: Provider::Artcraft, - resolution: Some(CommonResolution::TenEightyP), + model: RouterVideoModel::PreviewModelFast, + provider: RouterProvider::Artcraft, + resolution: Some(RouterResolution::TenEightyP), request_mismatch_mitigation_strategy: RequestMismatchMitigationStrategy::ErrorOut, ..Default::default() }); @@ -135,8 +135,8 @@ mod tests { #[test] fn url_start_frame_rejected() { let result = build_artcraft_preview_model_fast(GenerateVideoRequestBuilder { - model: CommonVideoModel::PreviewModelFast, - provider: Provider::Artcraft, + model: RouterVideoModel::PreviewModelFast, + provider: RouterProvider::Artcraft, start_frame: Some(ImageRef::Url("https://example.com".to_string())), ..Default::default() }); @@ -166,8 +166,8 @@ mod tests { fn make_builder(f: impl FnOnce(&mut GenerateVideoRequestBuilder)) -> GenerateVideoRequestBuilder { let mut builder = GenerateVideoRequestBuilder { - model: CommonVideoModel::PreviewModelFast, - provider: Provider::Artcraft, + model: RouterVideoModel::PreviewModelFast, + provider: RouterProvider::Artcraft, duration_seconds: Some(5), video_batch_count: Some(1), ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/preview_model_fast/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/preview_model_fast/cost.rs index 89116f7ad2..3b6c3e19d9 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/preview_model_fast/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/preview_model_fast/cost.rs @@ -52,9 +52,9 @@ impl ArtcraftPreviewModelFastCostState { #[cfg(test)] mod tests { - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; // -- 720p pricing -- @@ -64,27 +64,27 @@ mod tests { #[test] fn batch_1() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 4, 1), 80); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1), 100); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 10, 1), 200); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 15, 1), 300); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 4, 1), 80); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1), 100); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 10, 1), 200); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 15, 1), 300); } #[test] fn batch_2() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 2), 200); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 15, 2), 600); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 2), 200); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 15, 2), 600); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 4), 400); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 15, 4), 1200); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 4), 400); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 15, 4), 1200); } #[test] fn none_defaults_to_720p() { - assert_eq!(cost_cents(None, 5, 1), cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1)); + assert_eq!(cost_cents(None, 5, 1), cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1)); } } @@ -95,20 +95,20 @@ mod tests { #[test] fn batch_1() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 4, 1), 36); - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 1), 45); - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 10, 1), 90); - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 15, 1), 135); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 4, 1), 36); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 1), 45); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 10, 1), 90); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 15, 1), 135); } #[test] fn batch_2() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 2), 90); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 2), 90); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 4), 180); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 4), 180); } } @@ -119,25 +119,25 @@ mod tests { #[test] fn cost_480p_cheaper_than_720p() { - let c480 = cost_cents(Some(CommonResolution::FourEightyP), 5, 1); - let c720 = cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1); + let c480 = cost_cents(Some(RouterResolution::FourEightyP), 5, 1); + let c720 = cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1); assert!(c480 < c720); } #[test] fn cost_scales_with_duration() { - let c4 = cost_cents(Some(CommonResolution::SevenTwentyP), 4, 1); - let c10 = cost_cents(Some(CommonResolution::SevenTwentyP), 10, 1); - let c15 = cost_cents(Some(CommonResolution::SevenTwentyP), 15, 1); + let c4 = cost_cents(Some(RouterResolution::SevenTwentyP), 4, 1); + let c10 = cost_cents(Some(RouterResolution::SevenTwentyP), 10, 1); + let c15 = cost_cents(Some(RouterResolution::SevenTwentyP), 15, 1); assert!(c4 < c10); assert!(c10 < c15); } #[test] fn cost_scales_with_batch() { - let b1 = cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1); - let b2 = cost_cents(Some(CommonResolution::SevenTwentyP), 5, 2); - let b4 = cost_cents(Some(CommonResolution::SevenTwentyP), 5, 4); + let b1 = cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1); + let b2 = cost_cents(Some(RouterResolution::SevenTwentyP), 5, 2); + let b4 = cost_cents(Some(RouterResolution::SevenTwentyP), 5, 4); assert!(b1 < b2); assert!(b2 < b4); } @@ -151,8 +151,8 @@ mod tests { #[test] fn credits_equal_usd_cents_all_combos() { let resolutions = [ - Some(CommonResolution::FourEightyP), - Some(CommonResolution::SevenTwentyP), + Some(RouterResolution::FourEightyP), + Some(RouterResolution::SevenTwentyP), None, ]; for res in resolutions { @@ -173,13 +173,13 @@ mod tests { // -- Helpers -- fn build_cost( - resolution: Option, + resolution: Option, duration_seconds: u16, video_batch_count: u16, ) -> crate::generate::generate_video::video_generation_cost_estimate::VideoGenerationCostEstimate { let builder = GenerateVideoRequestBuilder { - model: CommonVideoModel::PreviewModelFast, - provider: Provider::Artcraft, + model: RouterVideoModel::PreviewModelFast, + provider: RouterProvider::Artcraft, resolution, duration_seconds: Some(duration_seconds), video_batch_count: Some(video_batch_count), @@ -192,7 +192,7 @@ mod tests { } fn cost_cents( - resolution: Option, + resolution: Option, duration_seconds: u16, video_batch_count: u16, ) -> u64 { diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_1p0_lite/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_1p0_lite/cost.rs index e3c71523ea..0297040000 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_1p0_lite/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_1p0_lite/cost.rs @@ -57,15 +57,15 @@ impl ArtcraftSeedance10LiteCostState { #[cfg(test)] mod tests { - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; - fn cost_cents(duration_seconds: Option, resolution: Option) -> u64 { + fn cost_cents(duration_seconds: Option, resolution: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance10Lite, - provider: Provider::Artcraft, + model: RouterVideoModel::Seedance10Lite, + provider: RouterProvider::Artcraft, prompt: Some("test".to_string()), duration_seconds, resolution, @@ -81,22 +81,22 @@ mod tests { } #[test] - fn p720_5s_is_18() { assert_eq!(cost_cents(Some(5), Some(CommonResolution::SevenTwentyP)), 18); } + fn p720_5s_is_18() { assert_eq!(cost_cents(Some(5), Some(RouterResolution::SevenTwentyP)), 18); } #[test] fn p720_10s_is_95() { // 1280×720×30×10/1024 = 270000 tokens × $1.8/M = $0.486 → ceil = 49¢ ... // No wait — fal kling not seedance. The Seedance 1.0 Lite rate is different. // Trust the fal calculator: assert whatever the actual computed value is. - let v = cost_cents(Some(10), Some(CommonResolution::SevenTwentyP)); + let v = cost_cents(Some(10), Some(RouterResolution::SevenTwentyP)); assert!(v > 18, "10s should cost more than 5s, got {}", v); } #[test] fn p480_5s_cheaper_than_p720_5s() { assert!( - cost_cents(Some(5), Some(CommonResolution::FourEightyP)) - < cost_cents(Some(5), Some(CommonResolution::SevenTwentyP)) + cost_cents(Some(5), Some(RouterResolution::FourEightyP)) + < cost_cents(Some(5), Some(RouterResolution::SevenTwentyP)) ); } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_1p5_pro/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_1p5_pro/cost.rs index 80e471d09b..98aee4bb65 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_1p5_pro/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_1p5_pro/cost.rs @@ -78,14 +78,14 @@ fn common_resolution_to_seedance(r: CommonResolutionEnum) -> Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance1p5Pro, - provider: Provider::Artcraft, + model: RouterVideoModel::Seedance1p5Pro, + provider: RouterProvider::Artcraft, prompt: Some("test".to_string()), duration_seconds, ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0/build.rs index 4425d2ab8c..6562f4fce6 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0/build.rs @@ -28,10 +28,10 @@ mod tests { use tokens::tokens::media_files::MediaFileToken; use crate::api::character_list_ref::CharacterListRef; - use crate::api::common_resolution::CommonResolution; + use crate::api::router_resolution::RouterResolution; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use crate::generate::generate_video_v2::video_generation_draft_or_request::VideoGenerationDraftOrRequest; use crate::generate::generate_video_v2::video_generation_request::VideoGenerationRequest; @@ -81,19 +81,19 @@ mod tests { #[test] fn res_480p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::FourEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::FourEightyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::FourEightyP)); } #[test] fn res_720p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::SevenTwentyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::SevenTwentyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::SevenTwentyP)); } #[test] fn res_1080p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::TenEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::TenEightyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::TenEightyP)); } @@ -150,7 +150,7 @@ mod tests { fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - provider: Provider::Artcraft, + provider: RouterProvider::Artcraft, duration_seconds: Some(5), video_batch_count: Some(1), ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0/cost.rs index 6c9fbfd8c7..87b534dfe3 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0/cost.rs @@ -67,8 +67,8 @@ impl ArtcraftSeedance2p0CostState { #[cfg(test)] mod tests { - use crate::api::common_resolution::CommonResolution; - use crate::api::provider::Provider; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; // -- 720p pricing -- @@ -78,30 +78,30 @@ mod tests { #[test] fn batch_1() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 4, 1), 64); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1), 80); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 6, 1), 96); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 10, 1), 160); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 15, 1), 240); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 4, 1), 64); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1), 80); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 6, 1), 96); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 10, 1), 160); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 15, 1), 240); } #[test] fn batch_2() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 4, 2), 128); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 2), 160); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 15, 2), 480); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 4, 2), 128); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 2), 160); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 15, 2), 480); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 4, 4), 256); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 4), 320); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 15, 4), 960); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 4, 4), 256); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 4), 320); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 15, 4), 960); } #[test] fn none_defaults_to_720p() { - assert_eq!(cost_cents(None, 5, 1), cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1)); + assert_eq!(cost_cents(None, 5, 1), cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1)); } } @@ -112,20 +112,20 @@ mod tests { #[test] fn batch_1() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 4, 1), 31); - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 1), 39); - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 10, 1), 78); - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 15, 1), 117); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 4, 1), 31); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 1), 39); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 10, 1), 78); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 15, 1), 117); } #[test] fn batch_2() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 2), 78); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 2), 78); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 4), 155); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 4), 155); } } @@ -136,20 +136,20 @@ mod tests { #[test] fn batch_1() { - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 4, 1), 187); - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 5, 1), 233); - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 10, 1), 466); - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 15, 1), 699); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 4, 1), 187); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 5, 1), 233); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 10, 1), 466); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 15, 1), 699); } #[test] fn batch_2() { - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 5, 2), 466); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 5, 2), 466); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 5, 4), 933); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 5, 4), 933); } } @@ -160,27 +160,27 @@ mod tests { #[test] fn cost_480p_cheaper_than_720p_cheaper_than_1080p() { - let c480 = cost_cents(Some(CommonResolution::FourEightyP), 5, 1); - let c720 = cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1); - let c1080 = cost_cents(Some(CommonResolution::TenEightyP), 5, 1); + let c480 = cost_cents(Some(RouterResolution::FourEightyP), 5, 1); + let c720 = cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1); + let c1080 = cost_cents(Some(RouterResolution::TenEightyP), 5, 1); assert!(c480 < c720); assert!(c720 < c1080); } #[test] fn cost_scales_with_duration() { - let c4 = cost_cents(Some(CommonResolution::SevenTwentyP), 4, 1); - let c10 = cost_cents(Some(CommonResolution::SevenTwentyP), 10, 1); - let c15 = cost_cents(Some(CommonResolution::SevenTwentyP), 15, 1); + let c4 = cost_cents(Some(RouterResolution::SevenTwentyP), 4, 1); + let c10 = cost_cents(Some(RouterResolution::SevenTwentyP), 10, 1); + let c15 = cost_cents(Some(RouterResolution::SevenTwentyP), 15, 1); assert!(c4 < c10); assert!(c10 < c15); } #[test] fn cost_scales_with_batch() { - let b1 = cost_cents(Some(CommonResolution::TenEightyP), 5, 1); - let b2 = cost_cents(Some(CommonResolution::TenEightyP), 5, 2); - let b4 = cost_cents(Some(CommonResolution::TenEightyP), 5, 4); + let b1 = cost_cents(Some(RouterResolution::TenEightyP), 5, 1); + let b2 = cost_cents(Some(RouterResolution::TenEightyP), 5, 2); + let b4 = cost_cents(Some(RouterResolution::TenEightyP), 5, 4); assert!(b1 < b2); assert!(b2 < b4); } @@ -194,9 +194,9 @@ mod tests { #[test] fn credits_equal_usd_cents_all_combos() { let resolutions = [ - Some(CommonResolution::FourEightyP), - Some(CommonResolution::SevenTwentyP), - Some(CommonResolution::TenEightyP), + Some(RouterResolution::FourEightyP), + Some(RouterResolution::SevenTwentyP), + Some(RouterResolution::TenEightyP), None, ]; for res in resolutions { @@ -222,10 +222,10 @@ mod tests { #[test] fn artcraft_matches_kinovi_all_combos() { let resolutions = [ - Some(CommonResolution::FourEightyP), - Some(CommonResolution::TenEightyP), + Some(RouterResolution::FourEightyP), + Some(RouterResolution::TenEightyP), // NB: These are underpriced (for now) - //Some(CommonResolution::SevenTwentyP), + //Some(RouterResolution::SevenTwentyP), //None, ]; let durations: [u16; 4] = [4, 5, 10, 15]; @@ -237,7 +237,7 @@ mod tests { let artcraft_cost = build_cost(*res, *dur, *batch); let kinovi = GenerateVideoRequestBuilder { - provider: Provider::Seedance2Pro, + provider: RouterProvider::Seedance2Pro, resolution: *res, duration_seconds: Some(*dur), video_batch_count: Some(*batch), @@ -263,12 +263,12 @@ mod tests { /// Build a cost estimate end-to-end: GenerateVideoRequestBuilder → build2 → estimate_cost. fn build_cost( - resolution: Option, + resolution: Option, duration_seconds: u16, video_batch_count: u16, ) -> crate::generate::generate_video::video_generation_cost_estimate::VideoGenerationCostEstimate { let builder = GenerateVideoRequestBuilder { - provider: Provider::Artcraft, + provider: RouterProvider::Artcraft, resolution, duration_seconds: Some(duration_seconds), video_batch_count: Some(video_batch_count), @@ -281,7 +281,7 @@ mod tests { } fn cost_cents( - resolution: Option, + resolution: Option, duration_seconds: u16, video_batch_count: u16, ) -> u64 { diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0/request.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0/request.rs index 5346e8b6e3..4984a473a7 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0/request.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0/request.rs @@ -22,11 +22,11 @@ mod tests { use tokens::tokens::media_files::MediaFileToken; use crate::api::character_list_ref::CharacterListRef; - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_resolution::CommonResolution; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_resolution::RouterResolution; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::client::router_artcraft_client::RouterArtcraftClient; use crate::client::router_client::RouterClient; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; @@ -52,7 +52,7 @@ mod tests { async fn landscape() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A corgi running through a field of wildflowers at sunset.".to_string()), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -64,7 +64,7 @@ mod tests { async fn portrait() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A cat sitting on a windowsill watching rain.".to_string()), - aspect_ratio: Some(CommonAspectRatio::TallNineBySixteen), + aspect_ratio: Some(RouterAspectRatio::TallNineBySixteen), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -76,7 +76,7 @@ mod tests { async fn square() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A hummingbird hovering near a flower.".to_string()), - aspect_ratio: Some(CommonAspectRatio::Square), + aspect_ratio: Some(RouterAspectRatio::Square), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -94,7 +94,7 @@ mod tests { async fn res_480p() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A shiba inu playing in autumn leaves.".to_string()), - resolution: Some(CommonResolution::FourEightyP), + resolution: Some(RouterResolution::FourEightyP), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -106,7 +106,7 @@ mod tests { async fn res_720p() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A golden retriever catching a frisbee on the beach.".to_string()), - resolution: Some(CommonResolution::SevenTwentyP), + resolution: Some(RouterResolution::SevenTwentyP), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -118,7 +118,7 @@ mod tests { async fn res_1080p() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A fox walking through a snowy forest.".to_string()), - resolution: Some(CommonResolution::TenEightyP), + resolution: Some(RouterResolution::TenEightyP), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -137,7 +137,7 @@ mod tests { async fn text_to_video() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A whale breaching in the open ocean at dawn, cinematic.".to_string()), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -151,7 +151,7 @@ mod tests { prompt: Some("The dog walks from the lake to the forest.".to_string()), start_frame: Some(ImageRef::MediaFileToken(MediaFileToken::new(JUNO_AT_LAKE_PRODUCTION_MEDIA_TOKEN.to_string()))), end_frame: Some(ImageRef::MediaFileToken(MediaFileToken::new(FOREST_BACKDROP_PRODUCTION_MEDIA_TOKEN.to_string()))), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -168,7 +168,7 @@ mod tests { MediaFileToken::new(TALL_MOCHI_WITH_GLASSES_PRODUCTION_MEDIA_TOKEN.to_string()), MediaFileToken::new(WHITE_HOUSE_SUNSET_PRODUCTION_MEDIA_TOKEN.to_string()), ])), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -184,7 +184,7 @@ mod tests { CharacterToken::new(JIM.token.to_string()), CharacterToken::new(KNIGHT.token.to_string()), ])), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -196,7 +196,7 @@ mod tests { fn artcraft_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - provider: Provider::Artcraft, + provider: RouterProvider::Artcraft, duration_seconds: Some(4), video_batch_count: Some(1), ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_bp/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_bp/build.rs index a6a70875bd..53c002acd0 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_bp/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_bp/build.rs @@ -28,10 +28,10 @@ mod tests { use tokens::tokens::media_files::MediaFileToken; use crate::api::character_list_ref::CharacterListRef; - use crate::api::common_resolution::CommonResolution; + use crate::api::router_resolution::RouterResolution; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use crate::generate::generate_video_v2::video_generation_draft_or_request::VideoGenerationDraftOrRequest; use crate::generate::generate_video_v2::video_generation_request::VideoGenerationRequest; @@ -77,19 +77,19 @@ mod tests { #[test] fn res_480p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::FourEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::FourEightyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::FourEightyP)); } #[test] fn res_720p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::SevenTwentyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::SevenTwentyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::SevenTwentyP)); } #[test] fn res_1080p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::TenEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::TenEightyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::TenEightyP)); } @@ -142,7 +142,7 @@ mod tests { fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - provider: Provider::Artcraft, + provider: RouterProvider::Artcraft, duration_seconds: Some(5), video_batch_count: Some(1), ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_bp/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_bp/cost.rs index b06b3f50c3..b1d9b24158 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_bp/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_bp/cost.rs @@ -49,9 +49,9 @@ impl ArtcraftSeedance2p0BytePlusCostState { #[cfg(test)] mod tests { - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; mod pricing_720p { @@ -59,25 +59,25 @@ mod tests { #[test] fn batch_1() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 4, 1), 100); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1), 125); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 10, 1), 250); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 15, 1), 375); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 4, 1), 100); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1), 125); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 10, 1), 250); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 15, 1), 375); } #[test] fn batch_2() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 2), 250); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 2), 250); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 4), 500); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 4), 500); } #[test] fn none_defaults_to_720p() { - assert_eq!(cost_cents(None, 5, 1), cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1)); + assert_eq!(cost_cents(None, 5, 1), cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1)); } } @@ -86,20 +86,20 @@ mod tests { #[test] fn batch_1() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 4, 1), 40); - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 1), 50); - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 10, 1), 100); - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 15, 1), 150); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 4, 1), 40); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 1), 50); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 10, 1), 100); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 15, 1), 150); } #[test] fn batch_2() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 2), 100); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 2), 100); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 4), 200); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 4), 200); } } @@ -108,20 +108,20 @@ mod tests { #[test] fn batch_1() { - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 4, 1), 200); - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 5, 1), 250); - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 10, 1), 500); - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 15, 1), 750); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 4, 1), 200); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 5, 1), 250); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 10, 1), 500); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 15, 1), 750); } #[test] fn batch_2() { - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 5, 2), 500); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 5, 2), 500); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 5, 4), 1000); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 5, 4), 1000); } } @@ -130,9 +130,9 @@ mod tests { #[test] fn cost_480p_cheaper_than_720p_cheaper_than_1080p() { - let c480 = cost_cents(Some(CommonResolution::FourEightyP), 5, 1); - let c720 = cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1); - let c1080 = cost_cents(Some(CommonResolution::TenEightyP), 5, 1); + let c480 = cost_cents(Some(RouterResolution::FourEightyP), 5, 1); + let c720 = cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1); + let c1080 = cost_cents(Some(RouterResolution::TenEightyP), 5, 1); assert!(c480 < c720); assert!(c720 < c1080); } @@ -143,7 +143,7 @@ mod tests { #[test] fn credits_equal_usd_cents() { - for res in [Some(CommonResolution::FourEightyP), Some(CommonResolution::SevenTwentyP), Some(CommonResolution::TenEightyP), None] { + for res in [Some(RouterResolution::FourEightyP), Some(RouterResolution::SevenTwentyP), Some(RouterResolution::TenEightyP), None] { for dur in [4, 5, 10, 15] { for batch in [1, 2, 4] { let cost = build_cost(res, dur, batch); @@ -155,13 +155,13 @@ mod tests { } fn build_cost( - resolution: Option, + resolution: Option, duration_seconds: u16, video_batch_count: u16, ) -> crate::generate::generate_video::video_generation_cost_estimate::VideoGenerationCostEstimate { GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0BytePlus, - provider: Provider::Artcraft, + model: RouterVideoModel::Seedance2p0BytePlus, + provider: RouterProvider::Artcraft, resolution, duration_seconds: Some(duration_seconds), video_batch_count: Some(video_batch_count), @@ -169,7 +169,7 @@ mod tests { }.build2().expect("build2").estimate_cost().expect("estimate_cost") } - fn cost_cents(resolution: Option, duration_seconds: u16, video_batch_count: u16) -> u64 { + fn cost_cents(resolution: Option, duration_seconds: u16, video_batch_count: u16) -> u64 { build_cost(resolution, duration_seconds, video_batch_count).cost_in_usd_cents.unwrap() } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_bp_fast/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_bp_fast/build.rs index d83303c82e..a9971d3cf0 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_bp_fast/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_bp_fast/build.rs @@ -28,11 +28,11 @@ mod tests { use tokens::tokens::media_files::MediaFileToken; use crate::api::character_list_ref::CharacterListRef; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use crate::generate::generate_video_v2::video_generation_draft_or_request::VideoGenerationDraftOrRequest; @@ -79,28 +79,28 @@ mod tests { #[test] fn res_480p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::FourEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::FourEightyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::FourEightyP)); } #[test] fn res_720p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::SevenTwentyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::SevenTwentyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::SevenTwentyP)); } #[test] fn res_1080p_downgrades_to_720p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::TenEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::TenEightyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::SevenTwentyP)); } #[test] fn res_1080p_error_out() { let result = build_artcraft_seedance_2p0_bp_fast(GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0BytePlusFast, - provider: Provider::Artcraft, - resolution: Some(CommonResolution::TenEightyP), + model: RouterVideoModel::Seedance2p0BytePlusFast, + provider: RouterProvider::Artcraft, + resolution: Some(RouterResolution::TenEightyP), request_mismatch_mitigation_strategy: RequestMismatchMitigationStrategy::ErrorOut, ..Default::default() }); @@ -129,8 +129,8 @@ mod tests { #[test] fn url_start_frame_rejected() { let result = build_artcraft_seedance_2p0_bp_fast(GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0BytePlusFast, - provider: Provider::Artcraft, + model: RouterVideoModel::Seedance2p0BytePlusFast, + provider: RouterProvider::Artcraft, start_frame: Some(ImageRef::Url("https://example.com".to_string())), ..Default::default() }); @@ -158,8 +158,8 @@ mod tests { fn make_builder(f: impl FnOnce(&mut GenerateVideoRequestBuilder)) -> GenerateVideoRequestBuilder { let mut builder = GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0BytePlusFast, - provider: Provider::Artcraft, + model: RouterVideoModel::Seedance2p0BytePlusFast, + provider: RouterProvider::Artcraft, duration_seconds: Some(5), video_batch_count: Some(1), ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_bp_fast/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_bp_fast/cost.rs index 9c07584123..cf503957ee 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_bp_fast/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_bp_fast/cost.rs @@ -46,9 +46,9 @@ impl ArtcraftSeedance2p0BytePlusFastCostState { #[cfg(test)] mod tests { - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; mod pricing_720p { @@ -56,25 +56,25 @@ mod tests { #[test] fn batch_1() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 4, 1), 80); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1), 100); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 10, 1), 200); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 15, 1), 300); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 4, 1), 80); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1), 100); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 10, 1), 200); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 15, 1), 300); } #[test] fn batch_2() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 2), 200); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 2), 200); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 4), 400); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 4), 400); } #[test] fn none_defaults_to_720p() { - assert_eq!(cost_cents(None, 5, 1), cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1)); + assert_eq!(cost_cents(None, 5, 1), cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1)); } } @@ -83,20 +83,20 @@ mod tests { #[test] fn batch_1() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 4, 1), 36); - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 1), 45); - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 10, 1), 90); - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 15, 1), 135); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 4, 1), 36); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 1), 45); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 10, 1), 90); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 15, 1), 135); } #[test] fn batch_2() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 2), 90); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 2), 90); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 4), 180); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 4), 180); } } @@ -105,7 +105,7 @@ mod tests { #[test] fn cost_480p_cheaper_than_720p() { - assert!(cost_cents(Some(CommonResolution::FourEightyP), 5, 1) < cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1)); + assert!(cost_cents(Some(RouterResolution::FourEightyP), 5, 1) < cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1)); } } @@ -114,7 +114,7 @@ mod tests { #[test] fn credits_equal_usd_cents() { - for res in [Some(CommonResolution::FourEightyP), Some(CommonResolution::SevenTwentyP), None] { + for res in [Some(RouterResolution::FourEightyP), Some(RouterResolution::SevenTwentyP), None] { for dur in [4, 5, 10, 15] { for batch in [1, 2, 4] { let cost = build_cost(res, dur, batch); @@ -126,13 +126,13 @@ mod tests { } fn build_cost( - resolution: Option, + resolution: Option, duration_seconds: u16, video_batch_count: u16, ) -> crate::generate::generate_video::video_generation_cost_estimate::VideoGenerationCostEstimate { GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0BytePlusFast, - provider: Provider::Artcraft, + model: RouterVideoModel::Seedance2p0BytePlusFast, + provider: RouterProvider::Artcraft, resolution, duration_seconds: Some(duration_seconds), video_batch_count: Some(video_batch_count), @@ -140,7 +140,7 @@ mod tests { }.build2().expect("build2").estimate_cost().expect("estimate_cost") } - fn cost_cents(resolution: Option, duration_seconds: u16, video_batch_count: u16) -> u64 { + fn cost_cents(resolution: Option, duration_seconds: u16, video_batch_count: u16) -> u64 { build_cost(resolution, duration_seconds, video_batch_count).cost_in_usd_cents.unwrap() } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_fast/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_fast/build.rs index 38223260d3..541bff7064 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_fast/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_fast/build.rs @@ -29,12 +29,12 @@ mod tests { use tokens::tokens::media_files::MediaFileToken; use crate::api::character_list_ref::CharacterListRef; - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::api::video_list_ref::VideoListRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; @@ -93,7 +93,7 @@ mod tests { #[test] fn wide() { let req = unwrap_request(artcraft_fast_builder_with(|b| { - b.aspect_ratio = Some(CommonAspectRatio::WideSixteenByNine); + b.aspect_ratio = Some(RouterAspectRatio::WideSixteenByNine); })); assert_eq!(req.request.aspect_ratio, Some(CommonAspectRatioEnum::WideSixteenByNine)); } @@ -101,7 +101,7 @@ mod tests { #[test] fn tall() { let req = unwrap_request(artcraft_fast_builder_with(|b| { - b.aspect_ratio = Some(CommonAspectRatio::TallNineBySixteen); + b.aspect_ratio = Some(RouterAspectRatio::TallNineBySixteen); })); assert_eq!(req.request.aspect_ratio, Some(CommonAspectRatioEnum::TallNineBySixteen)); } @@ -109,7 +109,7 @@ mod tests { #[test] fn square() { let req = unwrap_request(artcraft_fast_builder_with(|b| { - b.aspect_ratio = Some(CommonAspectRatio::Square); + b.aspect_ratio = Some(RouterAspectRatio::Square); })); assert_eq!(req.request.aspect_ratio, Some(CommonAspectRatioEnum::Square)); } @@ -129,7 +129,7 @@ mod tests { #[test] fn res_480p() { let req = unwrap_request(artcraft_fast_builder_with(|b| { - b.resolution = Some(CommonResolution::FourEightyP); + b.resolution = Some(RouterResolution::FourEightyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::FourEightyP)); } @@ -137,7 +137,7 @@ mod tests { #[test] fn res_720p() { let req = unwrap_request(artcraft_fast_builder_with(|b| { - b.resolution = Some(CommonResolution::SevenTwentyP); + b.resolution = Some(RouterResolution::SevenTwentyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::SevenTwentyP)); } @@ -145,7 +145,7 @@ mod tests { #[test] fn res_1080p_downgrades_to_720p() { let req = unwrap_request(artcraft_fast_builder_with(|b| { - b.resolution = Some(CommonResolution::TenEightyP); + b.resolution = Some(RouterResolution::TenEightyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::SevenTwentyP)); } @@ -153,9 +153,9 @@ mod tests { #[test] fn res_1080p_error_out() { let result = build_artcraft_seedance_2p0_fast(GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0Fast, - provider: Provider::Artcraft, - resolution: Some(CommonResolution::TenEightyP), + model: RouterVideoModel::Seedance2p0Fast, + provider: RouterProvider::Artcraft, + resolution: Some(RouterResolution::TenEightyP), request_mismatch_mitigation_strategy: RequestMismatchMitigationStrategy::ErrorOut, ..Default::default() }); @@ -186,8 +186,8 @@ mod tests { #[test] fn url_start_frame_rejected() { let result = build_artcraft_seedance_2p0_fast(GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0Fast, - provider: Provider::Artcraft, + model: RouterVideoModel::Seedance2p0Fast, + provider: RouterProvider::Artcraft, start_frame: Some(ImageRef::Url("https://example.com".to_string())), ..Default::default() }); @@ -223,8 +223,8 @@ mod tests { fn artcraft_fast_builder_with(f: impl FnOnce(&mut GenerateVideoRequestBuilder)) -> GenerateVideoRequestBuilder { let mut builder = GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0Fast, - provider: Provider::Artcraft, + model: RouterVideoModel::Seedance2p0Fast, + provider: RouterProvider::Artcraft, duration_seconds: Some(5), video_batch_count: Some(1), ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_fast/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_fast/cost.rs index e8a0e199ff..41551a05cf 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_fast/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_fast/cost.rs @@ -64,9 +64,9 @@ impl ArtcraftSeedance2p0FastCostState { #[cfg(test)] mod tests { - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; // -- 720p pricing -- @@ -76,29 +76,29 @@ mod tests { #[test] fn batch_1() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 4, 1), 51); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1), 64); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 10, 1), 127); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 15, 1), 191); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 4, 1), 51); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1), 64); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 10, 1), 127); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 15, 1), 191); } #[test] fn batch_2() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 4, 2), 102); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 2), 127); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 15, 2), 382); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 4, 2), 102); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 2), 127); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 15, 2), 382); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 4, 4), 204); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 4), 255); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 15, 4), 764); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 4, 4), 204); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 4), 255); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 15, 4), 764); } #[test] fn none_defaults_to_720p() { - assert_eq!(cost_cents(None, 5, 1), cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1)); + assert_eq!(cost_cents(None, 5, 1), cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1)); } } @@ -109,20 +109,20 @@ mod tests { #[test] fn batch_1() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 4, 1), 21); - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 1), 26); - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 10, 1), 52); - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 15, 1), 78); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 4, 1), 21); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 1), 26); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 10, 1), 52); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 15, 1), 78); } #[test] fn batch_2() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 2), 52); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 2), 52); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 4), 104); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 4), 104); } } @@ -133,25 +133,25 @@ mod tests { #[test] fn cost_480p_cheaper_than_720p() { - let c480 = cost_cents(Some(CommonResolution::FourEightyP), 5, 1); - let c720 = cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1); + let c480 = cost_cents(Some(RouterResolution::FourEightyP), 5, 1); + let c720 = cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1); assert!(c480 < c720, "480p ({}) should be cheaper than 720p ({})", c480, c720); } #[test] fn cost_scales_with_duration() { - let c4 = cost_cents(Some(CommonResolution::SevenTwentyP), 4, 1); - let c10 = cost_cents(Some(CommonResolution::SevenTwentyP), 10, 1); - let c15 = cost_cents(Some(CommonResolution::SevenTwentyP), 15, 1); + let c4 = cost_cents(Some(RouterResolution::SevenTwentyP), 4, 1); + let c10 = cost_cents(Some(RouterResolution::SevenTwentyP), 10, 1); + let c15 = cost_cents(Some(RouterResolution::SevenTwentyP), 15, 1); assert!(c4 < c10); assert!(c10 < c15); } #[test] fn cost_scales_with_batch() { - let b1 = cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1); - let b2 = cost_cents(Some(CommonResolution::SevenTwentyP), 5, 2); - let b4 = cost_cents(Some(CommonResolution::SevenTwentyP), 5, 4); + let b1 = cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1); + let b2 = cost_cents(Some(RouterResolution::SevenTwentyP), 5, 2); + let b4 = cost_cents(Some(RouterResolution::SevenTwentyP), 5, 4); assert!(b1 < b2); assert!(b2 < b4); } @@ -165,8 +165,8 @@ mod tests { #[test] fn credits_equal_usd_cents_all_combos() { let resolutions = [ - Some(CommonResolution::FourEightyP), - Some(CommonResolution::SevenTwentyP), + Some(RouterResolution::FourEightyP), + Some(RouterResolution::SevenTwentyP), None, ]; for res in resolutions { @@ -192,8 +192,8 @@ mod tests { // #[test] // fn artcraft_fast_matches_kinovi_fast_all_combos() { // let resolutions = [ - // Some(CommonResolution::FourEightyP), - // Some(CommonResolution::SevenTwentyP), + // Some(RouterResolution::FourEightyP), + // Some(RouterResolution::SevenTwentyP), // None, // ]; // let durations: [u16; 4] = [4, 5, 10, 15]; @@ -205,8 +205,8 @@ mod tests { // let artcraft_cost = build_cost(*res, *dur, *batch); // // let kinovi = GenerateVideoRequestBuilder { - // model: CommonVideoModel::Seedance2p0Fast, - // provider: Provider::Seedance2Pro, + // model: RouterVideoModel::Seedance2p0Fast, + // provider: RouterProvider::Seedance2Pro, // resolution: *res, // duration_seconds: Some(*dur), // video_batch_count: Some(*batch), @@ -231,13 +231,13 @@ mod tests { // -- Helpers -- fn build_cost( - resolution: Option, + resolution: Option, duration_seconds: u16, video_batch_count: u16, ) -> crate::generate::generate_video::video_generation_cost_estimate::VideoGenerationCostEstimate { let builder = GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0Fast, - provider: Provider::Artcraft, + model: RouterVideoModel::Seedance2p0Fast, + provider: RouterProvider::Artcraft, resolution, duration_seconds: Some(duration_seconds), video_batch_count: Some(video_batch_count), @@ -250,7 +250,7 @@ mod tests { } fn cost_cents( - resolution: Option, + resolution: Option, duration_seconds: u16, video_batch_count: u16, ) -> u64 { diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_fast/request.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_fast/request.rs index 43bee43220..55a1e92c3b 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_fast/request.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_fast/request.rs @@ -22,12 +22,12 @@ mod tests { use tokens::tokens::media_files::MediaFileToken; use crate::api::character_list_ref::CharacterListRef; - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::client::router_artcraft_client::RouterArtcraftClient; use crate::client::router_client::RouterClient; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; @@ -53,7 +53,7 @@ mod tests { async fn landscape() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A corgi running through a field of wildflowers at sunset.".to_string()), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_fast_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -65,7 +65,7 @@ mod tests { async fn portrait() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A cat sitting on a windowsill watching rain.".to_string()), - aspect_ratio: Some(CommonAspectRatio::TallNineBySixteen), + aspect_ratio: Some(RouterAspectRatio::TallNineBySixteen), ..artcraft_fast_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -77,7 +77,7 @@ mod tests { async fn square() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A hummingbird hovering near a flower.".to_string()), - aspect_ratio: Some(CommonAspectRatio::Square), + aspect_ratio: Some(RouterAspectRatio::Square), ..artcraft_fast_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -95,7 +95,7 @@ mod tests { async fn res_480p() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A shiba inu playing in autumn leaves.".to_string()), - resolution: Some(CommonResolution::FourEightyP), + resolution: Some(RouterResolution::FourEightyP), ..artcraft_fast_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -107,7 +107,7 @@ mod tests { async fn res_720p() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A golden retriever catching a frisbee on the beach.".to_string()), - resolution: Some(CommonResolution::SevenTwentyP), + resolution: Some(RouterResolution::SevenTwentyP), ..artcraft_fast_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -126,7 +126,7 @@ mod tests { async fn text_to_video() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A sky whale breaching in the open sky, pink clouds at dawn, cinematic.".to_string()), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_fast_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -140,7 +140,7 @@ mod tests { prompt: Some("The dog walks from the lake to the forest.".to_string()), start_frame: Some(ImageRef::MediaFileToken(MediaFileToken::new(JUNO_AT_LAKE_PRODUCTION_MEDIA_TOKEN.to_string()))), end_frame: Some(ImageRef::MediaFileToken(MediaFileToken::new(FOREST_BACKDROP_PRODUCTION_MEDIA_TOKEN.to_string()))), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_fast_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -157,7 +157,7 @@ mod tests { MediaFileToken::new(TALL_MOCHI_WITH_GLASSES_PRODUCTION_MEDIA_TOKEN.to_string()), MediaFileToken::new(WHITE_HOUSE_SUNSET_PRODUCTION_MEDIA_TOKEN.to_string()), ])), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_fast_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -173,7 +173,7 @@ mod tests { CharacterToken::new(JIM.token.to_string()), CharacterToken::new(KNIGHT.token.to_string()), ])), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_fast_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -185,8 +185,8 @@ mod tests { fn artcraft_fast_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0Fast, - provider: Provider::Artcraft, + model: RouterVideoModel::Seedance2p0Fast, + provider: RouterProvider::Artcraft, duration_seconds: Some(4), video_batch_count: Some(1), ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u/build.rs index 6b969e2fe2..94dfaa91ba 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u/build.rs @@ -28,10 +28,10 @@ mod tests { use tokens::tokens::media_files::MediaFileToken; use crate::api::character_list_ref::CharacterListRef; - use crate::api::common_resolution::CommonResolution; + use crate::api::router_resolution::RouterResolution; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use crate::generate::generate_video_v2::video_generation_draft_or_request::VideoGenerationDraftOrRequest; use crate::generate::generate_video_v2::video_generation_request::VideoGenerationRequest; @@ -81,19 +81,19 @@ mod tests { #[test] fn res_480p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::FourEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::FourEightyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::FourEightyP)); } #[test] fn res_720p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::SevenTwentyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::SevenTwentyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::SevenTwentyP)); } #[test] fn res_1080p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::TenEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::TenEightyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::TenEightyP)); } @@ -150,7 +150,7 @@ mod tests { fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - provider: Provider::Artcraft, + provider: RouterProvider::Artcraft, duration_seconds: Some(5), video_batch_count: Some(1), ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u/cost.rs index 846f7cb74b..4b7182d0d1 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u/cost.rs @@ -49,9 +49,9 @@ impl ArtcraftSeedance2p0UltraCostState { #[cfg(test)] mod tests { - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; mod pricing_720p { @@ -60,27 +60,27 @@ mod tests { #[test] fn batch_1() { // 11.2 * 5 = 56¢ - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1), 56); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1), 56); // 11.2 * 10 = 112¢ - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 10, 1), 112); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 10, 1), 112); // 11.2 * 15 = 168¢ - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 15, 1), 168); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 15, 1), 168); } #[test] fn batch_2() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 2), 112); - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 10, 2), 224); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 2), 112); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 10, 2), 224); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 4), 224); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 4), 224); } #[test] fn none_defaults_to_720p() { - assert_eq!(cost_cents(None, 10, 1), cost_cents(Some(CommonResolution::SevenTwentyP), 10, 1)); + assert_eq!(cost_cents(None, 10, 1), cost_cents(Some(RouterResolution::SevenTwentyP), 10, 1)); } } @@ -90,16 +90,16 @@ mod tests { #[test] fn batch_1() { // 5.4404 * 5 = 27.202 → ceil = 28¢ - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 1), 28); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 1), 28); // 5.4404 * 10 = 54.404 → ceil = 55¢ - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 10, 1), 55); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 10, 1), 55); // 5.4404 * 15 = 81.606 → ceil = 82¢ - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 15, 1), 82); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 15, 1), 82); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 10, 4), 220); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 10, 4), 220); } } @@ -109,16 +109,16 @@ mod tests { #[test] fn batch_1() { // 32.6424 * 5 = 163.212 → ceil = 164¢ - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 5, 1), 164); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 5, 1), 164); // 32.6424 * 10 = 326.424 → ceil = 327¢ - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 10, 1), 327); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 10, 1), 327); // 32.6424 * 15 = 489.636 → ceil = 490¢ - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 15, 1), 490); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 15, 1), 490); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 10, 4), 1308); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 10, 4), 1308); } } @@ -127,9 +127,9 @@ mod tests { #[test] fn cost_480p_cheaper_than_720p_cheaper_than_1080p() { - let c480 = cost_cents(Some(CommonResolution::FourEightyP), 10, 1); - let c720 = cost_cents(Some(CommonResolution::SevenTwentyP), 10, 1); - let c1080 = cost_cents(Some(CommonResolution::TenEightyP), 10, 1); + let c480 = cost_cents(Some(RouterResolution::FourEightyP), 10, 1); + let c720 = cost_cents(Some(RouterResolution::SevenTwentyP), 10, 1); + let c1080 = cost_cents(Some(RouterResolution::TenEightyP), 10, 1); assert!(c480 < c720); assert!(c720 < c1080); } @@ -160,13 +160,13 @@ mod tests { } fn build_cost( - resolution: Option, + resolution: Option, duration_seconds: u16, video_batch_count: u16, ) -> crate::generate::generate_video::video_generation_cost_estimate::VideoGenerationCostEstimate { let builder = GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0Ultra, - provider: Provider::Artcraft, + model: RouterVideoModel::Seedance2p0Ultra, + provider: RouterProvider::Artcraft, resolution, duration_seconds: Some(duration_seconds), video_batch_count: Some(video_batch_count), @@ -175,7 +175,7 @@ mod tests { builder.build2().expect("build2").estimate_cost().expect("estimate_cost") } - fn cost_cents(resolution: Option, duration_seconds: u16, batch: u16) -> u64 { + fn cost_cents(resolution: Option, duration_seconds: u16, batch: u16) -> u64 { build_cost(resolution, duration_seconds, batch).cost_in_usd_cents.unwrap() } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u/request.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u/request.rs index 0a72a0e562..f053cce3eb 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u/request.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u/request.rs @@ -22,11 +22,11 @@ mod tests { use tokens::tokens::media_files::MediaFileToken; use crate::api::character_list_ref::CharacterListRef; - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_resolution::CommonResolution; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_resolution::RouterResolution; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::client::router_artcraft_client::RouterArtcraftClient; use crate::client::router_client::RouterClient; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; @@ -52,7 +52,7 @@ mod tests { async fn landscape() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A corgi running through a field of wildflowers at sunset.".to_string()), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -64,7 +64,7 @@ mod tests { async fn portrait() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A cat sitting on a windowsill watching rain.".to_string()), - aspect_ratio: Some(CommonAspectRatio::TallNineBySixteen), + aspect_ratio: Some(RouterAspectRatio::TallNineBySixteen), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -76,7 +76,7 @@ mod tests { async fn square() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A hummingbird hovering near a flower.".to_string()), - aspect_ratio: Some(CommonAspectRatio::Square), + aspect_ratio: Some(RouterAspectRatio::Square), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -94,7 +94,7 @@ mod tests { async fn res_480p() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A shiba inu playing in autumn leaves.".to_string()), - resolution: Some(CommonResolution::FourEightyP), + resolution: Some(RouterResolution::FourEightyP), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -106,7 +106,7 @@ mod tests { async fn res_720p() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A golden retriever catching a frisbee on the beach.".to_string()), - resolution: Some(CommonResolution::SevenTwentyP), + resolution: Some(RouterResolution::SevenTwentyP), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -118,7 +118,7 @@ mod tests { async fn res_1080p() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A fox walking through a snowy forest.".to_string()), - resolution: Some(CommonResolution::TenEightyP), + resolution: Some(RouterResolution::TenEightyP), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -137,7 +137,7 @@ mod tests { async fn text_to_video() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A whale breaching in the open ocean at dawn, cinematic.".to_string()), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -151,7 +151,7 @@ mod tests { prompt: Some("The dog walks from the lake to the forest.".to_string()), start_frame: Some(ImageRef::MediaFileToken(MediaFileToken::new(JUNO_AT_LAKE_PRODUCTION_MEDIA_TOKEN.to_string()))), end_frame: Some(ImageRef::MediaFileToken(MediaFileToken::new(FOREST_BACKDROP_PRODUCTION_MEDIA_TOKEN.to_string()))), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -168,7 +168,7 @@ mod tests { MediaFileToken::new(TALL_MOCHI_WITH_GLASSES_PRODUCTION_MEDIA_TOKEN.to_string()), MediaFileToken::new(WHITE_HOUSE_SUNSET_PRODUCTION_MEDIA_TOKEN.to_string()), ])), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -184,7 +184,7 @@ mod tests { CharacterToken::new(JIM.token.to_string()), CharacterToken::new(KNIGHT.token.to_string()), ])), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -196,7 +196,7 @@ mod tests { fn artcraft_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - provider: Provider::Artcraft, + provider: RouterProvider::Artcraft, duration_seconds: Some(4), video_batch_count: Some(1), ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u_fast/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u_fast/build.rs index 6ce5b2f092..ac8fdb6e24 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u_fast/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u_fast/build.rs @@ -29,12 +29,12 @@ mod tests { use tokens::tokens::media_files::MediaFileToken; use crate::api::character_list_ref::CharacterListRef; - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::api::video_list_ref::VideoListRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; @@ -93,7 +93,7 @@ mod tests { #[test] fn wide() { let req = unwrap_request(artcraft_fast_builder_with(|b| { - b.aspect_ratio = Some(CommonAspectRatio::WideSixteenByNine); + b.aspect_ratio = Some(RouterAspectRatio::WideSixteenByNine); })); assert_eq!(req.request.aspect_ratio, Some(CommonAspectRatioEnum::WideSixteenByNine)); } @@ -101,7 +101,7 @@ mod tests { #[test] fn tall() { let req = unwrap_request(artcraft_fast_builder_with(|b| { - b.aspect_ratio = Some(CommonAspectRatio::TallNineBySixteen); + b.aspect_ratio = Some(RouterAspectRatio::TallNineBySixteen); })); assert_eq!(req.request.aspect_ratio, Some(CommonAspectRatioEnum::TallNineBySixteen)); } @@ -109,7 +109,7 @@ mod tests { #[test] fn square() { let req = unwrap_request(artcraft_fast_builder_with(|b| { - b.aspect_ratio = Some(CommonAspectRatio::Square); + b.aspect_ratio = Some(RouterAspectRatio::Square); })); assert_eq!(req.request.aspect_ratio, Some(CommonAspectRatioEnum::Square)); } @@ -129,7 +129,7 @@ mod tests { #[test] fn res_480p() { let req = unwrap_request(artcraft_fast_builder_with(|b| { - b.resolution = Some(CommonResolution::FourEightyP); + b.resolution = Some(RouterResolution::FourEightyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::FourEightyP)); } @@ -137,7 +137,7 @@ mod tests { #[test] fn res_720p() { let req = unwrap_request(artcraft_fast_builder_with(|b| { - b.resolution = Some(CommonResolution::SevenTwentyP); + b.resolution = Some(RouterResolution::SevenTwentyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::SevenTwentyP)); } @@ -145,7 +145,7 @@ mod tests { #[test] fn res_1080p_downgrades_to_720p() { let req = unwrap_request(artcraft_fast_builder_with(|b| { - b.resolution = Some(CommonResolution::TenEightyP); + b.resolution = Some(RouterResolution::TenEightyP); })); assert_eq!(req.request.resolution, Some(CommonResolutionEnum::SevenTwentyP)); } @@ -153,9 +153,9 @@ mod tests { #[test] fn res_1080p_error_out() { let result = build_artcraft_seedance_2p0_u_fast(GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0UltraFast, - provider: Provider::Artcraft, - resolution: Some(CommonResolution::TenEightyP), + model: RouterVideoModel::Seedance2p0UltraFast, + provider: RouterProvider::Artcraft, + resolution: Some(RouterResolution::TenEightyP), request_mismatch_mitigation_strategy: RequestMismatchMitigationStrategy::ErrorOut, ..Default::default() }); @@ -186,8 +186,8 @@ mod tests { #[test] fn url_start_frame_rejected() { let result = build_artcraft_seedance_2p0_u_fast(GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0UltraFast, - provider: Provider::Artcraft, + model: RouterVideoModel::Seedance2p0UltraFast, + provider: RouterProvider::Artcraft, start_frame: Some(ImageRef::Url("https://example.com".to_string())), ..Default::default() }); @@ -223,8 +223,8 @@ mod tests { fn artcraft_fast_builder_with(f: impl FnOnce(&mut GenerateVideoRequestBuilder)) -> GenerateVideoRequestBuilder { let mut builder = GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0UltraFast, - provider: Provider::Artcraft, + model: RouterVideoModel::Seedance2p0UltraFast, + provider: RouterProvider::Artcraft, duration_seconds: Some(5), video_batch_count: Some(1), ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u_fast/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u_fast/cost.rs index 684da99835..d2b199b6d5 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u_fast/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u_fast/cost.rs @@ -48,9 +48,9 @@ impl ArtcraftSeedance2p0UltraFastCostState { #[cfg(test)] mod tests { - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; mod pricing_720p { @@ -59,26 +59,26 @@ mod tests { #[test] fn batch_1() { // 8.9089 * 5 = 44.5445 → ceil = 45¢ - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, 1), 45); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, 1), 45); // 8.9089 * 10 = 89.089 → ceil = 90¢ - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 10, 1), 90); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 10, 1), 90); // 8.9089 * 15 = 133.6335 → ceil = 134¢ - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 15, 1), 134); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 15, 1), 134); } #[test] fn batch_2() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 10, 2), 180); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 10, 2), 180); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 10, 4), 360); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 10, 4), 360); } #[test] fn none_defaults_to_720p() { - assert_eq!(cost_cents(None, 10, 1), cost_cents(Some(CommonResolution::SevenTwentyP), 10, 1)); + assert_eq!(cost_cents(None, 10, 1), cost_cents(Some(RouterResolution::SevenTwentyP), 10, 1)); } } @@ -88,16 +88,16 @@ mod tests { #[test] fn batch_1() { // 3.6267 * 5 = 18.1335 → ceil = 19¢ - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, 1), 19); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, 1), 19); // 3.6267 * 10 = 36.267 → ceil = 37¢ - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 10, 1), 37); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 10, 1), 37); // 3.6267 * 15 = 54.4005 → ceil = 55¢ - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 15, 1), 55); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 15, 1), 55); } #[test] fn batch_4() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 10, 4), 148); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 10, 4), 148); } } @@ -106,8 +106,8 @@ mod tests { #[test] fn cost_480p_cheaper_than_720p() { - let c480 = cost_cents(Some(CommonResolution::FourEightyP), 10, 1); - let c720 = cost_cents(Some(CommonResolution::SevenTwentyP), 10, 1); + let c480 = cost_cents(Some(RouterResolution::FourEightyP), 10, 1); + let c720 = cost_cents(Some(RouterResolution::SevenTwentyP), 10, 1); assert!(c480 < c720, "480p ({c480}) should be < 720p ({c720})"); } @@ -122,12 +122,12 @@ mod tests { #[test] fn fast_g_cheaper_than_standard_g() { - let fast = cost_cents(Some(CommonResolution::SevenTwentyP), 10, 1); + let fast = cost_cents(Some(RouterResolution::SevenTwentyP), 10, 1); let standard = { let builder = GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0Ultra, - provider: Provider::Artcraft, - resolution: Some(CommonResolution::SevenTwentyP), + model: RouterVideoModel::Seedance2p0Ultra, + provider: RouterProvider::Artcraft, + resolution: Some(RouterResolution::SevenTwentyP), duration_seconds: Some(10), video_batch_count: Some(1), ..Default::default() @@ -145,13 +145,13 @@ mod tests { } fn build_cost( - resolution: Option, + resolution: Option, duration_seconds: u16, video_batch_count: u16, ) -> crate::generate::generate_video::video_generation_cost_estimate::VideoGenerationCostEstimate { let builder = GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0UltraFast, - provider: Provider::Artcraft, + model: RouterVideoModel::Seedance2p0UltraFast, + provider: RouterProvider::Artcraft, resolution, duration_seconds: Some(duration_seconds), video_batch_count: Some(video_batch_count), @@ -160,7 +160,7 @@ mod tests { builder.build2().expect("build2").estimate_cost().expect("estimate_cost") } - fn cost_cents(resolution: Option, duration_seconds: u16, batch: u16) -> u64 { + fn cost_cents(resolution: Option, duration_seconds: u16, batch: u16) -> u64 { build_cost(resolution, duration_seconds, batch).cost_in_usd_cents.unwrap() } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u_fast/request.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u_fast/request.rs index 404c625dbd..4b5e713696 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u_fast/request.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/seedance_2p0_u_fast/request.rs @@ -22,12 +22,12 @@ mod tests { use tokens::tokens::media_files::MediaFileToken; use crate::api::character_list_ref::CharacterListRef; - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::client::router_artcraft_client::RouterArtcraftClient; use crate::client::router_client::RouterClient; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; @@ -53,7 +53,7 @@ mod tests { async fn landscape() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A corgi running through a field of wildflowers at sunset.".to_string()), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_fast_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -65,7 +65,7 @@ mod tests { async fn portrait() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A cat sitting on a windowsill watching rain.".to_string()), - aspect_ratio: Some(CommonAspectRatio::TallNineBySixteen), + aspect_ratio: Some(RouterAspectRatio::TallNineBySixteen), ..artcraft_fast_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -77,7 +77,7 @@ mod tests { async fn square() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A hummingbird hovering near a flower.".to_string()), - aspect_ratio: Some(CommonAspectRatio::Square), + aspect_ratio: Some(RouterAspectRatio::Square), ..artcraft_fast_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -95,7 +95,7 @@ mod tests { async fn res_480p() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A shiba inu playing in autumn leaves.".to_string()), - resolution: Some(CommonResolution::FourEightyP), + resolution: Some(RouterResolution::FourEightyP), ..artcraft_fast_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -107,7 +107,7 @@ mod tests { async fn res_720p() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A golden retriever catching a frisbee on the beach.".to_string()), - resolution: Some(CommonResolution::SevenTwentyP), + resolution: Some(RouterResolution::SevenTwentyP), ..artcraft_fast_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -126,7 +126,7 @@ mod tests { async fn text_to_video() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A sky whale breaching in the open sky, pink clouds at dawn, cinematic.".to_string()), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_fast_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -140,7 +140,7 @@ mod tests { prompt: Some("The dog walks from the lake to the forest.".to_string()), start_frame: Some(ImageRef::MediaFileToken(MediaFileToken::new(JUNO_AT_LAKE_PRODUCTION_MEDIA_TOKEN.to_string()))), end_frame: Some(ImageRef::MediaFileToken(MediaFileToken::new(FOREST_BACKDROP_PRODUCTION_MEDIA_TOKEN.to_string()))), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_fast_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -157,7 +157,7 @@ mod tests { MediaFileToken::new(TALL_MOCHI_WITH_GLASSES_PRODUCTION_MEDIA_TOKEN.to_string()), MediaFileToken::new(WHITE_HOUSE_SUNSET_PRODUCTION_MEDIA_TOKEN.to_string()), ])), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_fast_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -173,7 +173,7 @@ mod tests { CharacterToken::new(JIM.token.to_string()), CharacterToken::new(KNIGHT.token.to_string()), ])), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..artcraft_fast_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Artcraft(_))); @@ -185,8 +185,8 @@ mod tests { fn artcraft_fast_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0UltraFast, - provider: Provider::Artcraft, + model: RouterVideoModel::Seedance2p0UltraFast, + provider: RouterProvider::Artcraft, duration_seconds: Some(4), video_batch_count: Some(1), ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/sora_2/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/sora_2/cost.rs index 6caa6d5323..ffe3ccef2c 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/sora_2/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/sora_2/cost.rs @@ -32,14 +32,14 @@ impl ArtcraftSora2CostState { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; fn cost_cents(duration_seconds: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Sora2, - provider: Provider::Artcraft, + model: RouterVideoModel::Sora2, + provider: RouterProvider::Artcraft, prompt: Some("test".to_string()), duration_seconds, ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/sora_2_pro/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/sora_2_pro/cost.rs index 4eee6d2d16..9dd040ad26 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/sora_2_pro/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/sora_2_pro/cost.rs @@ -47,21 +47,21 @@ fn is_ten_eighty_p_for_cost(resolution: Option, has_start_ #[cfg(test)] mod tests { - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use tokens::tokens::media_files::MediaFileToken; fn cost_cents( duration_seconds: Option, - resolution: Option, + resolution: Option, has_start_frame: bool, ) -> u64 { let mut b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Sora2Pro, - provider: Provider::Artcraft, + model: RouterVideoModel::Sora2Pro, + provider: RouterProvider::Artcraft, prompt: Some("test".to_string()), duration_seconds, resolution, @@ -77,19 +77,19 @@ mod tests { use super::*; #[test] - fn p720_4s_is_120() { assert_eq!(cost_cents(Some(4), Some(CommonResolution::SevenTwentyP), false), 120); } + fn p720_4s_is_120() { assert_eq!(cost_cents(Some(4), Some(RouterResolution::SevenTwentyP), false), 120); } #[test] - fn p720_8s_is_240() { assert_eq!(cost_cents(Some(8), Some(CommonResolution::SevenTwentyP), false), 240); } + fn p720_8s_is_240() { assert_eq!(cost_cents(Some(8), Some(RouterResolution::SevenTwentyP), false), 240); } #[test] - fn p720_12s_is_360() { assert_eq!(cost_cents(Some(12), Some(CommonResolution::SevenTwentyP), false), 360); } + fn p720_12s_is_360() { assert_eq!(cost_cents(Some(12), Some(RouterResolution::SevenTwentyP), false), 360); } #[test] - fn p1080_4s_is_200() { assert_eq!(cost_cents(Some(4), Some(CommonResolution::TenEightyP), false), 200); } + fn p1080_4s_is_200() { assert_eq!(cost_cents(Some(4), Some(RouterResolution::TenEightyP), false), 200); } #[test] - fn p1080_12s_is_600() { assert_eq!(cost_cents(Some(12), Some(CommonResolution::TenEightyP), false), 600); } + fn p1080_12s_is_600() { assert_eq!(cost_cents(Some(12), Some(RouterResolution::TenEightyP), false), 600); } #[test] fn t2v_default_resolution_priced_as_1080p() { @@ -106,8 +106,8 @@ mod tests { #[test] fn higher_resolution_costs_more() { - let c720 = cost_cents(Some(8), Some(CommonResolution::SevenTwentyP), false); - let c1080 = cost_cents(Some(8), Some(CommonResolution::TenEightyP), false); + let c720 = cost_cents(Some(8), Some(RouterResolution::SevenTwentyP), false); + let c1080 = cost_cents(Some(8), Some(RouterResolution::TenEightyP), false); assert!(c720 < c1080); } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/veo_2/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/veo_2/cost.rs index f9f6de8645..068b437795 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/veo_2/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/veo_2/cost.rs @@ -33,14 +33,14 @@ impl ArtcraftVeo2CostState { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; fn cost_cents(duration_seconds: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Veo2, - provider: Provider::Artcraft, + model: RouterVideoModel::Veo2, + provider: RouterProvider::Artcraft, prompt: Some("test".to_string()), duration_seconds, ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/veo_3/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/veo_3/cost.rs index 5b4b3257c5..a001b60234 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/veo_3/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/veo_3/cost.rs @@ -44,14 +44,14 @@ fn duration_seconds_for_cost(d: Option) -> u64 { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; fn cost_cents(duration_seconds: Option, generate_audio: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Veo3, - provider: Provider::Artcraft, + model: RouterVideoModel::Veo3, + provider: RouterProvider::Artcraft, prompt: Some("test".to_string()), duration_seconds, generate_audio, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/veo_3_fast/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/veo_3_fast/cost.rs index c3d02df8f1..9617350ee5 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/veo_3_fast/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/veo_3_fast/cost.rs @@ -34,14 +34,14 @@ impl ArtcraftVeo3FastCostState { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; fn cost_cents(duration_seconds: Option, generate_audio: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Veo3Fast, - provider: Provider::Artcraft, + model: RouterVideoModel::Veo3Fast, + provider: RouterProvider::Artcraft, prompt: Some("test".to_string()), duration_seconds, generate_audio, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/veo_3p1/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/veo_3p1/cost.rs index 23cb796ed8..7a8c3ef6b4 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/veo_3p1/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/veo_3p1/cost.rs @@ -36,14 +36,14 @@ impl ArtcraftVeo3p1CostState { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; fn cost_cents(duration_seconds: Option, generate_audio: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Veo3p1, - provider: Provider::Artcraft, + model: RouterVideoModel::Veo3p1, + provider: RouterProvider::Artcraft, prompt: Some("test".to_string()), duration_seconds, generate_audio, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/veo_3p1_fast/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/veo_3p1_fast/cost.rs index 9bb6e4a9f4..91e2ae3e6a 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/veo_3p1_fast/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/artcraft/veo_3p1_fast/cost.rs @@ -36,14 +36,14 @@ impl ArtcraftVeo3p1FastCostState { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; fn cost_cents(duration_seconds: Option, generate_audio: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Veo3p1Fast, - provider: Provider::Artcraft, + model: RouterVideoModel::Veo3p1Fast, + provider: RouterProvider::Artcraft, prompt: Some("test".to_string()), duration_seconds, generate_audio, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_1_6_pro/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_1_6_pro/build.rs index d86c40494a..9ceba11012 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_1_6_pro/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_1_6_pro/build.rs @@ -2,7 +2,7 @@ use fal_client::requests::webhook::video::image::enqueue_kling_v1p6_pro_image_to Kling1p6ProAspectRatio, Kling1p6ProDuration, Kling1p6ProRequest, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; +use crate::api::router_aspect_ratio::RouterAspectRatio; use crate::api::image_ref::ImageRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -63,20 +63,20 @@ pub(crate) fn optional_url(image_ref: Option) -> Result } fn plan_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result { use Kling1p6ProAspectRatio as Ar; match aspect_ratio { None => Ok(Ar::WideSixteenNine), - Some(CommonAspectRatio::Square) | Some(CommonAspectRatio::SquareHd) => Ok(Ar::Square), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Ar::WideSixteenNine), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Ar::TallNineSixteen), + Some(RouterAspectRatio::Square) | Some(RouterAspectRatio::SquareHd) => Ok(Ar::Square), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Ar::WideSixteenNine), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Ar::TallNineSixteen), - Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto4k) => Ok(Ar::WideSixteenNine), + Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto4k) => Ok(Ar::WideSixteenNine), Some(other) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -113,15 +113,15 @@ fn plan_duration( #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use super::*; fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Kling16Pro, - provider: Provider::Fal, + model: RouterVideoModel::Kling16Pro, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), start_frame: Some(ImageRef::Url("https://example.com/a.png".to_string())), ..Default::default() @@ -144,7 +144,7 @@ mod tests { #[test] fn full_combinatorial_pass() { - let aspect_ratios = [None, Some(CommonAspectRatio::Square), Some(CommonAspectRatio::WideSixteenByNine), Some(CommonAspectRatio::TallNineBySixteen), Some(CommonAspectRatio::Auto)]; + let aspect_ratios = [None, Some(RouterAspectRatio::Square), Some(RouterAspectRatio::WideSixteenByNine), Some(RouterAspectRatio::TallNineBySixteen), Some(RouterAspectRatio::Auto)]; let durations = [None, Some(5u16), Some(10)]; let mut combos = 0; for &aspect_ratio in &aspect_ratios { diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_1_6_pro/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_1_6_pro/cost.rs index 630e7e3216..f666fae1f5 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_1_6_pro/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_1_6_pro/cost.rs @@ -33,15 +33,15 @@ impl FalKling16ProCostState { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; fn cost_cents(duration_seconds: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Kling16Pro, - provider: Provider::Fal, + model: RouterVideoModel::Kling16Pro, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), start_frame: Some(ImageRef::Url("https://example.com/a.png".to_string())), duration_seconds, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_1_master/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_1_master/build.rs index 054de622ec..8724af8499 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_1_master/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_1_master/build.rs @@ -2,7 +2,7 @@ use fal_client::requests::webhook::video::image::enqueue_kling_v2p1_master_image Kling2p1MasterAspectRatio, Kling2p1MasterDuration, Kling2p1MasterRequest, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; +use crate::api::router_aspect_ratio::RouterAspectRatio; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; use crate::errors::client_error::ClientError; @@ -41,20 +41,20 @@ pub fn build_fal_kling_2_1_master( } fn plan_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result { use Kling2p1MasterAspectRatio as Ar; match aspect_ratio { None => Ok(Ar::WideSixteenNine), - Some(CommonAspectRatio::Square) | Some(CommonAspectRatio::SquareHd) => Ok(Ar::Square), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Ar::WideSixteenNine), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Ar::TallNineSixteen), + Some(RouterAspectRatio::Square) | Some(RouterAspectRatio::SquareHd) => Ok(Ar::Square), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Ar::WideSixteenNine), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Ar::TallNineSixteen), - Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto4k) => Ok(Ar::WideSixteenNine), + Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto4k) => Ok(Ar::WideSixteenNine), Some(other) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -91,16 +91,16 @@ fn plan_duration( #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use super::*; fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Kling21Master, - provider: Provider::Fal, + model: RouterVideoModel::Kling21Master, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), start_frame: Some(ImageRef::Url("https://example.com/a.png".to_string())), ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_1_master/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_1_master/cost.rs index f13a25258f..a13d4420bc 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_1_master/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_1_master/cost.rs @@ -33,15 +33,15 @@ impl FalKling21MasterCostState { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; fn cost_cents(duration_seconds: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Kling21Master, - provider: Provider::Fal, + model: RouterVideoModel::Kling21Master, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), start_frame: Some(ImageRef::Url("https://example.com/a.png".to_string())), duration_seconds, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_1_pro/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_1_pro/build.rs index 628b51bbf0..ee1490190d 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_1_pro/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_1_pro/build.rs @@ -2,7 +2,7 @@ use fal_client::requests::webhook::video::image::enqueue_kling_v2p1_pro_image_to Kling2p1ProAspectRatio, Kling2p1ProDuration, Kling2p1ProRequest, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; +use crate::api::router_aspect_ratio::RouterAspectRatio; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; use crate::errors::client_error::ClientError; @@ -36,20 +36,20 @@ pub fn build_fal_kling_2_1_pro( } fn plan_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result { use Kling2p1ProAspectRatio as Ar; match aspect_ratio { None => Ok(Ar::WideSixteenNine), - Some(CommonAspectRatio::Square) | Some(CommonAspectRatio::SquareHd) => Ok(Ar::Square), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Ar::WideSixteenNine), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Ar::TallNineSixteen), + Some(RouterAspectRatio::Square) | Some(RouterAspectRatio::SquareHd) => Ok(Ar::Square), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Ar::WideSixteenNine), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Ar::TallNineSixteen), - Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto4k) => Ok(Ar::WideSixteenNine), + Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto4k) => Ok(Ar::WideSixteenNine), Some(other) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_1_pro/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_1_pro/cost.rs index 79ae780d46..2edaedf756 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_1_pro/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_1_pro/cost.rs @@ -33,15 +33,15 @@ impl FalKling21ProCostState { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; fn cost_cents(duration_seconds: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Kling21Pro, - provider: Provider::Fal, + model: RouterVideoModel::Kling21Pro, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), start_frame: Some(ImageRef::Url("https://example.com/a.png".to_string())), duration_seconds, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_5_turbo_pro/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_5_turbo_pro/build.rs index aea28873e7..148f08b72e 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_5_turbo_pro/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_5_turbo_pro/build.rs @@ -6,7 +6,7 @@ use fal_client::requests::webhook::video::text::enqueue_kling_v2p5_turbo_pro_tex EnqueueKlingV2p5TurboProTextToVideoRequest, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; +use crate::api::router_aspect_ratio::RouterAspectRatio; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; use crate::errors::client_error::ClientError; @@ -71,20 +71,20 @@ pub fn build_fal_kling_2_5_turbo_pro( } fn plan_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { use PlanAspectRatio as Ar; match aspect_ratio { None => Ok(None), - Some(CommonAspectRatio::Square) | Some(CommonAspectRatio::SquareHd) => Ok(Some(Ar::Square)), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Some(Ar::SixteenByNine)), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Some(Ar::NineBySixteen)), + Some(RouterAspectRatio::Square) | Some(RouterAspectRatio::SquareHd) => Ok(Some(Ar::Square)), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Some(Ar::SixteenByNine)), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Some(Ar::NineBySixteen)), - Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto4k) => Ok(Some(Ar::SixteenByNine)), + Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto4k) => Ok(Some(Ar::SixteenByNine)), Some(other) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -143,16 +143,16 @@ fn to_i2v_duration(d: PlanDuration) -> EnqueueKlingV2p5TurboProImageToVideoDurat #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use super::*; fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Kling2p5TurboPro, - provider: Provider::Fal, + model: RouterVideoModel::Kling2p5TurboPro, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), ..Default::default() } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_5_turbo_pro/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_5_turbo_pro/cost.rs index c4a70ffcdf..7c1aaf1d96 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_5_turbo_pro/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_5_turbo_pro/cost.rs @@ -42,15 +42,15 @@ impl FalKling2p5TurboProCostState { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; fn cost_cents(duration_seconds: Option, has_start: bool) -> u64 { let mut b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Kling2p5TurboPro, - provider: Provider::Fal, + model: RouterVideoModel::Kling2p5TurboPro, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), duration_seconds, ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_6_pro/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_6_pro/build.rs index bbeb56c800..e9b43d624f 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_6_pro/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_6_pro/build.rs @@ -6,7 +6,7 @@ use fal_client::requests::webhook::video::text::enqueue_kling_v2p6_pro_text_to_v EnqueueKlingV2p6ProTextToVideoRequest, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; +use crate::api::router_aspect_ratio::RouterAspectRatio; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; use crate::errors::client_error::ClientError; @@ -72,20 +72,20 @@ pub fn build_fal_kling_2_6_pro( } fn plan_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { use PlanAspectRatio as Ar; match aspect_ratio { None => Ok(None), - Some(CommonAspectRatio::Square) | Some(CommonAspectRatio::SquareHd) => Ok(Some(Ar::Square)), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Some(Ar::SixteenByNine)), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Some(Ar::NineBySixteen)), + Some(RouterAspectRatio::Square) | Some(RouterAspectRatio::SquareHd) => Ok(Some(Ar::Square)), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Some(Ar::SixteenByNine)), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Some(Ar::NineBySixteen)), - Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto4k) => Ok(Some(Ar::SixteenByNine)), + Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto4k) => Ok(Some(Ar::SixteenByNine)), Some(other) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -144,16 +144,16 @@ fn to_i2v_duration(d: PlanDuration) -> EnqueueKlingV2p6ProImageToVideoDurationSe #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use super::*; fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Kling2p6Pro, - provider: Provider::Fal, + model: RouterVideoModel::Kling2p6Pro, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), ..Default::default() } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_6_pro/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_6_pro/cost.rs index 1b7cc46354..f5a9d45592 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_6_pro/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_2_6_pro/cost.rs @@ -52,14 +52,14 @@ impl FalKling2p6ProCostState { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; fn cost_cents(duration_seconds: Option, generate_audio: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Kling2p6Pro, - provider: Provider::Fal, + model: RouterVideoModel::Kling2p6Pro, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), duration_seconds, generate_audio, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_3p0_pro/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_3p0_pro/build.rs index 466f05364a..3ecc1cb71c 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_3p0_pro/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_3p0_pro/build.rs @@ -7,7 +7,7 @@ use fal_client::requests::webhook::video::text::enqueue_kling_3p0_pro_text_to_vi EnqueueKling3p0ProTextToVideoRequest, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; +use crate::api::router_aspect_ratio::RouterAspectRatio; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; use crate::errors::client_error::ClientError; @@ -86,20 +86,20 @@ fn build_kling_3p0_pro_state( } pub(crate) fn plan_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { use PlanAspectRatio as Ar; match aspect_ratio { None => Ok(None), - Some(CommonAspectRatio::Square) | Some(CommonAspectRatio::SquareHd) => Ok(Some(Ar::Square)), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Some(Ar::SixteenByNine)), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Some(Ar::NineBySixteen)), + Some(RouterAspectRatio::Square) | Some(RouterAspectRatio::SquareHd) => Ok(Some(Ar::Square)), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Some(Ar::SixteenByNine)), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Some(Ar::NineBySixteen)), - Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto4k) => Ok(Some(Ar::SixteenByNine)), + Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto4k) => Ok(Some(Ar::SixteenByNine)), Some(other) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -188,17 +188,17 @@ fn to_i2v_aspect_ratio(a: PlanAspectRatio) -> EnqueueKling3p0ProImageToVideoAspe #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use super::*; fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Kling3p0Pro, - provider: Provider::Fal, + model: RouterVideoModel::Kling3p0Pro, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), ..Default::default() } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_3p0_pro/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_3p0_pro/cost.rs index cf6d68e1dc..96b79ebaa6 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_3p0_pro/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_3p0_pro/cost.rs @@ -90,14 +90,14 @@ fn i2v_duration_seconds(d: Option) -> u6 #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; fn cost_cents(duration_seconds: Option, generate_audio: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Kling3p0Pro, - provider: Provider::Fal, + model: RouterVideoModel::Kling3p0Pro, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), duration_seconds, generate_audio, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_3p0_standard/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_3p0_standard/build.rs index f4acfafa47..13434f2ffe 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_3p0_standard/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_3p0_standard/build.rs @@ -121,16 +121,16 @@ fn to_i2v_aspect_ratio(a: PlanAspectRatio) -> EnqueueKling3p0StandardImageToVide #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use super::*; fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Kling3p0Standard, - provider: Provider::Fal, + model: RouterVideoModel::Kling3p0Standard, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), ..Default::default() } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_3p0_standard/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_3p0_standard/cost.rs index 4b1e4bfe29..6f8a23f628 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_3p0_standard/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/kling_3p0_standard/cost.rs @@ -89,14 +89,14 @@ fn i2v_duration_seconds(d: Option) #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; fn cost_cents(duration_seconds: Option, generate_audio: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Kling3p0Standard, - provider: Provider::Fal, + model: RouterVideoModel::Kling3p0Standard, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), duration_seconds, generate_audio, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p0_lite/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p0_lite/build.rs index 5f91eadba8..fd610c53ed 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p0_lite/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p0_lite/build.rs @@ -2,8 +2,8 @@ use fal_client::requests::webhook::video::image::enqueue_seedance_1_lite_image_t Seedance1LiteAspectRatio, Seedance1LiteDuration, Seedance1LiteRequest, Seedance1LiteResolution, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_resolution::CommonResolution; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_resolution::RouterResolution; use crate::api::image_ref::ImageRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -80,23 +80,23 @@ fn optional_url(image_ref: Option) -> Result, ArtcraftR } fn plan_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { use Seedance1LiteAspectRatio as Ar; match aspect_ratio { None => Ok(None), - Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto4k) => Ok(Some(Ar::Auto)), + Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto4k) => Ok(Some(Ar::Auto)), - Some(CommonAspectRatio::Square) | Some(CommonAspectRatio::SquareHd) => Ok(Some(Ar::Square)), - Some(CommonAspectRatio::WideFourByThree) => Ok(Some(Ar::FourByThree)), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Some(Ar::SixteenByNine)), - Some(CommonAspectRatio::WideTwentyOneByNine) => Ok(Some(Ar::TwentyOneByNine)), - Some(CommonAspectRatio::TallThreeByFour) => Ok(Some(Ar::ThreeByFour)), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Some(Ar::NineBySixteen)), + Some(RouterAspectRatio::Square) | Some(RouterAspectRatio::SquareHd) => Ok(Some(Ar::Square)), + Some(RouterAspectRatio::WideFourByThree) => Ok(Some(Ar::FourByThree)), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Some(Ar::SixteenByNine)), + Some(RouterAspectRatio::WideTwentyOneByNine) => Ok(Some(Ar::TwentyOneByNine)), + Some(RouterAspectRatio::TallThreeByFour) => Ok(Some(Ar::ThreeByFour)), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Some(Ar::NineBySixteen)), Some(unsupported) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -111,15 +111,15 @@ fn plan_aspect_ratio( } fn plan_resolution( - resolution: Option, + resolution: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result { use Seedance1LiteResolution as R; match resolution { None => Ok(R::SevenTwentyP), - Some(CommonResolution::FourEightyP) => Ok(R::FourEightyP), - Some(CommonResolution::SevenTwentyP) => Ok(R::SevenTwentyP), - Some(CommonResolution::TenEightyP) => Ok(R::TenEightyP), + Some(RouterResolution::FourEightyP) => Ok(R::FourEightyP), + Some(RouterResolution::SevenTwentyP) => Ok(R::SevenTwentyP), + Some(RouterResolution::TenEightyP) => Ok(R::TenEightyP), Some(other) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { Err(ArtcraftRouterError::Client(ClientError::ModelDoesNotSupportOption { @@ -158,8 +158,8 @@ fn plan_duration( mod tests { use tokens::tokens::media_files::MediaFileToken; - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video_v2::video_generation_request::VideoGenerationRequest; use super::*; @@ -168,8 +168,8 @@ mod tests { fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance10Lite, - provider: Provider::Fal, + model: RouterVideoModel::Seedance10Lite, + provider: RouterProvider::Fal, prompt: Some("a corgi running".to_string()), start_frame: Some(ImageRef::Url("https://example.com/start.png".to_string())), ..Default::default() @@ -288,7 +288,7 @@ mod tests { #[test] fn resolution_480p() { let req = unwrap_request(build_fal_seedance_1p0_lite(make_builder(|b| { - b.resolution = Some(CommonResolution::FourEightyP); + b.resolution = Some(RouterResolution::FourEightyP); }))); assert_eq!(req.resolution, Seedance1LiteResolution::FourEightyP); } @@ -296,7 +296,7 @@ mod tests { #[test] fn resolution_720p() { let req = unwrap_request(build_fal_seedance_1p0_lite(make_builder(|b| { - b.resolution = Some(CommonResolution::SevenTwentyP); + b.resolution = Some(RouterResolution::SevenTwentyP); }))); assert_eq!(req.resolution, Seedance1LiteResolution::SevenTwentyP); } @@ -304,7 +304,7 @@ mod tests { #[test] fn resolution_1080p() { let req = unwrap_request(build_fal_seedance_1p0_lite(make_builder(|b| { - b.resolution = Some(CommonResolution::TenEightyP); + b.resolution = Some(RouterResolution::TenEightyP); }))); assert_eq!(req.resolution, Seedance1LiteResolution::TenEightyP); } @@ -318,7 +318,7 @@ mod tests { #[test] fn unsupported_resolution_errors_with_error_out() { let result = build_fal_seedance_1p0_lite(make_builder(|b| { - b.resolution = Some(CommonResolution::FourK); + b.resolution = Some(RouterResolution::FourK); b.request_mismatch_mitigation_strategy = RequestMismatchMitigationStrategy::ErrorOut; })); assert!(result.is_err()); @@ -327,7 +327,7 @@ mod tests { #[test] fn unsupported_resolution_upgrades_with_pay_more() { let req = unwrap_request(build_fal_seedance_1p0_lite(make_builder(|b| { - b.resolution = Some(CommonResolution::FourK); + b.resolution = Some(RouterResolution::FourK); b.request_mismatch_mitigation_strategy = RequestMismatchMitigationStrategy::PayMoreUpgrade; }))); assert_eq!(req.resolution, Seedance1LiteResolution::TenEightyP); @@ -336,7 +336,7 @@ mod tests { #[test] fn unsupported_resolution_downgrades_with_pay_less() { let req = unwrap_request(build_fal_seedance_1p0_lite(make_builder(|b| { - b.resolution = Some(CommonResolution::FourK); + b.resolution = Some(RouterResolution::FourK); b.request_mismatch_mitigation_strategy = RequestMismatchMitigationStrategy::PayLessDowngrade; }))); assert_eq!(req.resolution, Seedance1LiteResolution::FourEightyP); @@ -402,7 +402,7 @@ mod tests { #[test] fn auto() { let req = unwrap_request(build_fal_seedance_1p0_lite(make_builder(|b| { - b.aspect_ratio = Some(CommonAspectRatio::Auto); + b.aspect_ratio = Some(RouterAspectRatio::Auto); }))); assert!(matches!(req.aspect_ratio, Some(Seedance1LiteAspectRatio::Auto))); } @@ -410,7 +410,7 @@ mod tests { #[test] fn square() { let req = unwrap_request(build_fal_seedance_1p0_lite(make_builder(|b| { - b.aspect_ratio = Some(CommonAspectRatio::Square); + b.aspect_ratio = Some(RouterAspectRatio::Square); }))); assert!(matches!(req.aspect_ratio, Some(Seedance1LiteAspectRatio::Square))); } @@ -418,7 +418,7 @@ mod tests { #[test] fn sixteen_by_nine() { let req = unwrap_request(build_fal_seedance_1p0_lite(make_builder(|b| { - b.aspect_ratio = Some(CommonAspectRatio::WideSixteenByNine); + b.aspect_ratio = Some(RouterAspectRatio::WideSixteenByNine); }))); assert!(matches!(req.aspect_ratio, Some(Seedance1LiteAspectRatio::SixteenByNine))); } @@ -426,7 +426,7 @@ mod tests { #[test] fn nine_by_sixteen() { let req = unwrap_request(build_fal_seedance_1p0_lite(make_builder(|b| { - b.aspect_ratio = Some(CommonAspectRatio::TallNineBySixteen); + b.aspect_ratio = Some(RouterAspectRatio::TallNineBySixteen); }))); assert!(matches!(req.aspect_ratio, Some(Seedance1LiteAspectRatio::NineBySixteen))); } @@ -434,7 +434,7 @@ mod tests { #[test] fn twenty_one_by_nine() { let req = unwrap_request(build_fal_seedance_1p0_lite(make_builder(|b| { - b.aspect_ratio = Some(CommonAspectRatio::WideTwentyOneByNine); + b.aspect_ratio = Some(RouterAspectRatio::WideTwentyOneByNine); }))); assert!(matches!(req.aspect_ratio, Some(Seedance1LiteAspectRatio::TwentyOneByNine))); } @@ -442,7 +442,7 @@ mod tests { #[test] fn four_by_three() { let req = unwrap_request(build_fal_seedance_1p0_lite(make_builder(|b| { - b.aspect_ratio = Some(CommonAspectRatio::WideFourByThree); + b.aspect_ratio = Some(RouterAspectRatio::WideFourByThree); }))); assert!(matches!(req.aspect_ratio, Some(Seedance1LiteAspectRatio::FourByThree))); } @@ -450,7 +450,7 @@ mod tests { #[test] fn three_by_four() { let req = unwrap_request(build_fal_seedance_1p0_lite(make_builder(|b| { - b.aspect_ratio = Some(CommonAspectRatio::TallThreeByFour); + b.aspect_ratio = Some(RouterAspectRatio::TallThreeByFour); }))); assert!(matches!(req.aspect_ratio, Some(Seedance1LiteAspectRatio::ThreeByFour))); } @@ -464,7 +464,7 @@ mod tests { #[test] fn unsupported_aspect_ratio_errors_with_error_out() { let result = build_fal_seedance_1p0_lite(make_builder(|b| { - b.aspect_ratio = Some(CommonAspectRatio::WideFiveByFour); + b.aspect_ratio = Some(RouterAspectRatio::WideFiveByFour); b.request_mismatch_mitigation_strategy = RequestMismatchMitigationStrategy::ErrorOut; })); assert!(result.is_err()); @@ -473,7 +473,7 @@ mod tests { #[test] fn unsupported_aspect_ratio_falls_back_to_auto_with_pay_more() { let req = unwrap_request(build_fal_seedance_1p0_lite(make_builder(|b| { - b.aspect_ratio = Some(CommonAspectRatio::WideFiveByFour); + b.aspect_ratio = Some(RouterAspectRatio::WideFiveByFour); b.request_mismatch_mitigation_strategy = RequestMismatchMitigationStrategy::PayMoreUpgrade; }))); assert!(matches!(req.aspect_ratio, Some(Seedance1LiteAspectRatio::Auto))); @@ -486,20 +486,20 @@ mod tests { fn full_combinatorial_pass() { let resolutions = [ None, - Some(CommonResolution::FourEightyP), - Some(CommonResolution::SevenTwentyP), - Some(CommonResolution::TenEightyP), + Some(RouterResolution::FourEightyP), + Some(RouterResolution::SevenTwentyP), + Some(RouterResolution::TenEightyP), ]; let durations = [None, Some(5u16), Some(10u16)]; let aspect_ratios = [ None, - Some(CommonAspectRatio::Auto), - Some(CommonAspectRatio::Square), - Some(CommonAspectRatio::WideFourByThree), - Some(CommonAspectRatio::WideSixteenByNine), - Some(CommonAspectRatio::WideTwentyOneByNine), - Some(CommonAspectRatio::TallThreeByFour), - Some(CommonAspectRatio::TallNineBySixteen), + Some(RouterAspectRatio::Auto), + Some(RouterAspectRatio::Square), + Some(RouterAspectRatio::WideFourByThree), + Some(RouterAspectRatio::WideSixteenByNine), + Some(RouterAspectRatio::WideTwentyOneByNine), + Some(RouterAspectRatio::TallThreeByFour), + Some(RouterAspectRatio::TallNineBySixteen), ]; let mut combos = 0; diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p0_lite/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p0_lite/cost.rs index dd470fe995..7fbde09074 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p0_lite/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p0_lite/cost.rs @@ -30,26 +30,26 @@ impl FalSeedance10LiteCostState { #[cfg(test)] mod tests { - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; // ── Helpers ── fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance10Lite, - provider: Provider::Fal, + model: RouterVideoModel::Seedance10Lite, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), start_frame: Some(ImageRef::Url("https://example.com/start.png".to_string())), ..Default::default() } } - fn cost_cents(resolution: Option, duration_seconds: Option) -> u64 { + fn cost_cents(resolution: Option, duration_seconds: Option) -> u64 { let mut b = base_builder(); b.resolution = resolution; b.duration_seconds = duration_seconds; @@ -69,18 +69,18 @@ mod tests { #[test] fn p720_5s_special_case() { // Per the Fal cost calculator: 720p + 5s short-circuits to 18¢. - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), Some(5)), 18); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), Some(5)), 18); } #[test] fn p720_10s() { // 1280×720×30 fps × 10s / 1024 = 270000 tokens × $1.8/M = $0.486 → ceil = 49¢. - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), Some(10)), 49); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), Some(10)), 49); } #[test] fn p720_default_duration_matches_5s() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), None), 18); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), None), 18); } #[test] @@ -95,13 +95,13 @@ mod tests { #[test] fn p480_5s() { // 640×480×30×5/1024 = 45000 × $1.8/M = $0.081 → ceil = 9¢. - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), Some(5)), 9); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), Some(5)), 9); } #[test] fn p480_10s() { // 640×480×30×10/1024 = 90000 × $1.8/M = $0.162 → ceil = 17¢. - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), Some(10)), 17); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), Some(10)), 17); } } @@ -111,13 +111,13 @@ mod tests { #[test] fn p1080_5s() { // 1920×1080×30×5/1024 = 303750 × $1.8/M = $0.54675 → ceil = 55¢. - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), Some(5)), 55); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), Some(5)), 55); } #[test] fn p1080_10s() { // 1920×1080×30×10/1024 = 607500 × $1.8/M = $1.0935 → ceil = 110¢. - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), Some(10)), 110); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), Some(10)), 110); } } @@ -128,17 +128,17 @@ mod tests { #[test] fn higher_resolution_costs_more() { - let p480 = cost_cents(Some(CommonResolution::FourEightyP), Some(10)); - let p720 = cost_cents(Some(CommonResolution::SevenTwentyP), Some(10)); - let p1080 = cost_cents(Some(CommonResolution::TenEightyP), Some(10)); + let p480 = cost_cents(Some(RouterResolution::FourEightyP), Some(10)); + let p720 = cost_cents(Some(RouterResolution::SevenTwentyP), Some(10)); + let p1080 = cost_cents(Some(RouterResolution::TenEightyP), Some(10)); assert!(p480 < p720, "480p ({p480}) should be < 720p ({p720})"); assert!(p720 < p1080, "720p ({p720}) should be < 1080p ({p1080})"); } #[test] fn longer_duration_costs_more() { - let d5 = cost_cents(Some(CommonResolution::TenEightyP), Some(5)); - let d10 = cost_cents(Some(CommonResolution::TenEightyP), Some(10)); + let d5 = cost_cents(Some(RouterResolution::TenEightyP), Some(5)); + let d10 = cost_cents(Some(RouterResolution::TenEightyP), Some(10)); assert!(d5 < d10, "5s ({d5}) should be < 10s ({d10})"); } } @@ -148,17 +148,17 @@ mod tests { #[test] fn combinatorial_positive_cost() { let resolutions = [ - Some(CommonResolution::FourEightyP), - Some(CommonResolution::SevenTwentyP), - Some(CommonResolution::TenEightyP), + Some(RouterResolution::FourEightyP), + Some(RouterResolution::SevenTwentyP), + Some(RouterResolution::TenEightyP), ]; let durations = [Some(5u16), Some(10u16)]; let aspect_ratios = [ None, - Some(CommonAspectRatio::Auto), - Some(CommonAspectRatio::Square), - Some(CommonAspectRatio::WideSixteenByNine), - Some(CommonAspectRatio::TallNineBySixteen), + Some(RouterAspectRatio::Auto), + Some(RouterAspectRatio::Square), + Some(RouterAspectRatio::WideSixteenByNine), + Some(RouterAspectRatio::TallNineBySixteen), ]; let mut combos = 0; @@ -181,11 +181,11 @@ mod tests { // Aspect ratio doesn't influence cost (calculator only uses resolution and duration). #[test] fn aspect_ratio_does_not_affect_cost() { - let with_wide = cost_cents(Some(CommonResolution::SevenTwentyP), Some(10)); + let with_wide = cost_cents(Some(RouterResolution::SevenTwentyP), Some(10)); let mut b = base_builder(); - b.resolution = Some(CommonResolution::SevenTwentyP); + b.resolution = Some(RouterResolution::SevenTwentyP); b.duration_seconds = Some(10); - b.aspect_ratio = Some(CommonAspectRatio::Square); + b.aspect_ratio = Some(RouterAspectRatio::Square); let with_square = b.build2().unwrap().estimate_cost().unwrap().cost_in_usd_cents.unwrap(); assert_eq!(with_wide, with_square); } @@ -193,9 +193,9 @@ mod tests { // End frame doesn't influence cost. #[test] fn end_frame_does_not_affect_cost() { - let without = cost_cents(Some(CommonResolution::TenEightyP), Some(5)); + let without = cost_cents(Some(RouterResolution::TenEightyP), Some(5)); let mut b = base_builder(); - b.resolution = Some(CommonResolution::TenEightyP); + b.resolution = Some(RouterResolution::TenEightyP); b.duration_seconds = Some(5); b.end_frame = Some(ImageRef::Url("https://example.com/end.png".to_string())); let with_end = b.build2().unwrap().estimate_cost().unwrap().cost_in_usd_cents.unwrap(); diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p0_lite/request.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p0_lite/request.rs index ca8d03cb72..19f8791ffd 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p0_lite/request.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p0_lite/request.rs @@ -46,11 +46,11 @@ impl FalSeedance10LiteRequestState { mod tests { use test_data::web::image_urls::JUNO_AT_LAKE_IMAGE_URL; - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use crate::generate::generate_video::generate_video_response::GenerateVideoResponse; use crate::generate::generate_video_v2::video_generation_draft_or_request::VideoGenerationDraftOrRequest; @@ -64,8 +64,8 @@ mod tests { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("the dog leaps into the lake and splashes around.".to_string()), start_frame: Some(ImageRef::Url(JUNO_AT_LAKE_IMAGE_URL.to_string())), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), - resolution: Some(CommonResolution::SevenTwentyP), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), + resolution: Some(RouterResolution::SevenTwentyP), duration_seconds: Some(5), ..fal_seedance_1p0_lite_builder() }).await; @@ -79,7 +79,7 @@ mod tests { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("a vivid splash of color filling the frame".to_string()), start_frame: Some(ImageRef::Url(JUNO_AT_LAKE_IMAGE_URL.to_string())), - resolution: Some(CommonResolution::FourEightyP), + resolution: Some(RouterResolution::FourEightyP), duration_seconds: Some(10), ..fal_seedance_1p0_lite_builder() }).await; @@ -103,8 +103,8 @@ mod tests { fn fal_seedance_1p0_lite_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance10Lite, - provider: Provider::Fal, + model: RouterVideoModel::Seedance10Lite, + provider: RouterProvider::Fal, video_batch_count: Some(1), ..Default::default() } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p5_pro/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p5_pro/build.rs index d6ba33fb5d..de59475387 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p5_pro/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p5_pro/build.rs @@ -7,8 +7,8 @@ use fal_client::requests::webhook::video::text::enqueue_seedance_1p5_pro_text_to EnqueueSeedance1p5ProTextToVideoRequest, EnqueueSeedance1p5ProTextToVideoResolution, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_resolution::CommonResolution; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_resolution::RouterResolution; use crate::api::image_ref::ImageRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -114,23 +114,23 @@ fn optional_url(image_ref: Option) -> Result, ArtcraftR } fn plan_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { use PlanAspectRatio as Ar; match aspect_ratio { None => Ok(None), - Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto4k) => Ok(Some(Ar::Auto)), + Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto4k) => Ok(Some(Ar::Auto)), - Some(CommonAspectRatio::Square) | Some(CommonAspectRatio::SquareHd) => Ok(Some(Ar::Square)), - Some(CommonAspectRatio::WideFourByThree) => Ok(Some(Ar::FourByThree)), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Some(Ar::SixteenByNine)), - Some(CommonAspectRatio::WideTwentyOneByNine) => Ok(Some(Ar::TwentyOneByNine)), - Some(CommonAspectRatio::TallThreeByFour) => Ok(Some(Ar::ThreeByFour)), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Some(Ar::NineBySixteen)), + Some(RouterAspectRatio::Square) | Some(RouterAspectRatio::SquareHd) => Ok(Some(Ar::Square)), + Some(RouterAspectRatio::WideFourByThree) => Ok(Some(Ar::FourByThree)), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Some(Ar::SixteenByNine)), + Some(RouterAspectRatio::WideTwentyOneByNine) => Ok(Some(Ar::TwentyOneByNine)), + Some(RouterAspectRatio::TallThreeByFour) => Ok(Some(Ar::ThreeByFour)), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Some(Ar::NineBySixteen)), Some(unsupported) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -145,28 +145,28 @@ fn plan_aspect_ratio( } /// Pick the nearest supported aspect ratio for unsupported inputs. -fn nearest_aspect_ratio(aspect_ratio: CommonAspectRatio) -> PlanAspectRatio { +fn nearest_aspect_ratio(aspect_ratio: RouterAspectRatio) -> PlanAspectRatio { use PlanAspectRatio as Ar; match aspect_ratio { - CommonAspectRatio::WideFiveByFour => Ar::FourByThree, - CommonAspectRatio::WideThreeByTwo => Ar::FourByThree, - CommonAspectRatio::TallFourByFive => Ar::ThreeByFour, - CommonAspectRatio::TallTwoByThree => Ar::ThreeByFour, - CommonAspectRatio::TallNineByTwentyOne => Ar::NineBySixteen, + RouterAspectRatio::WideFiveByFour => Ar::FourByThree, + RouterAspectRatio::WideThreeByTwo => Ar::FourByThree, + RouterAspectRatio::TallFourByFive => Ar::ThreeByFour, + RouterAspectRatio::TallTwoByThree => Ar::ThreeByFour, + RouterAspectRatio::TallNineByTwentyOne => Ar::NineBySixteen, _ => Ar::Square, } } fn plan_resolution( - resolution: Option, + resolution: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { use PlanResolution as R; match resolution { None => Ok(None), - Some(CommonResolution::FourEightyP) => Ok(Some(R::FourEightyP)), - Some(CommonResolution::SevenTwentyP) => Ok(Some(R::SevenTwentyP)), - Some(CommonResolution::TenEightyP) => Ok(Some(R::TenEightyP)), + Some(RouterResolution::FourEightyP) => Ok(Some(R::FourEightyP)), + Some(RouterResolution::SevenTwentyP) => Ok(Some(R::SevenTwentyP)), + Some(RouterResolution::TenEightyP) => Ok(Some(R::TenEightyP)), Some(other) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { Err(ArtcraftRouterError::Client(ClientError::ModelDoesNotSupportOption { @@ -289,8 +289,8 @@ fn to_i2v_aspect_ratio(a: PlanAspectRatio) -> EnqueueSeedance1p5ProImageToVideoA mod tests { use tokens::tokens::media_files::MediaFileToken; - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video_v2::video_generation_request::VideoGenerationRequest; use super::*; @@ -299,8 +299,8 @@ mod tests { fn base_t2v_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance1p5Pro, - provider: Provider::Fal, + model: RouterVideoModel::Seedance1p5Pro, + provider: RouterProvider::Fal, prompt: Some("a corgi running".to_string()), // No start_frame → text-to-video. ..Default::default() @@ -309,8 +309,8 @@ mod tests { fn base_i2v_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance1p5Pro, - provider: Provider::Fal, + model: RouterVideoModel::Seedance1p5Pro, + provider: RouterProvider::Fal, prompt: Some("a corgi running".to_string()), start_frame: Some(ImageRef::Url("https://example.com/start.png".to_string())), ..Default::default() @@ -473,7 +473,7 @@ mod tests { #[test] fn t2v_resolution_480p() { let req = unwrap_t2v(build_fal_seedance_1p5_pro(make_t2v(|b| { - b.resolution = Some(CommonResolution::FourEightyP); + b.resolution = Some(RouterResolution::FourEightyP); }))); assert!(matches!(req.resolution, Some(EnqueueSeedance1p5ProTextToVideoResolution::FourEightyP))); } @@ -481,7 +481,7 @@ mod tests { #[test] fn t2v_resolution_720p() { let req = unwrap_t2v(build_fal_seedance_1p5_pro(make_t2v(|b| { - b.resolution = Some(CommonResolution::SevenTwentyP); + b.resolution = Some(RouterResolution::SevenTwentyP); }))); assert!(matches!(req.resolution, Some(EnqueueSeedance1p5ProTextToVideoResolution::SevenTwentyP))); } @@ -489,7 +489,7 @@ mod tests { #[test] fn t2v_resolution_1080p() { let req = unwrap_t2v(build_fal_seedance_1p5_pro(make_t2v(|b| { - b.resolution = Some(CommonResolution::TenEightyP); + b.resolution = Some(RouterResolution::TenEightyP); }))); assert!(matches!(req.resolution, Some(EnqueueSeedance1p5ProTextToVideoResolution::TenEightyP))); } @@ -503,7 +503,7 @@ mod tests { #[test] fn unsupported_resolution_errors_with_error_out() { let result = build_fal_seedance_1p5_pro(make_t2v(|b| { - b.resolution = Some(CommonResolution::FourK); + b.resolution = Some(RouterResolution::FourK); b.request_mismatch_mitigation_strategy = RequestMismatchMitigationStrategy::ErrorOut; })); assert!(result.is_err()); @@ -512,7 +512,7 @@ mod tests { #[test] fn unsupported_resolution_upgrades_with_pay_more() { let req = unwrap_t2v(build_fal_seedance_1p5_pro(make_t2v(|b| { - b.resolution = Some(CommonResolution::FourK); + b.resolution = Some(RouterResolution::FourK); b.request_mismatch_mitigation_strategy = RequestMismatchMitigationStrategy::PayMoreUpgrade; }))); assert!(matches!(req.resolution, Some(EnqueueSeedance1p5ProTextToVideoResolution::TenEightyP))); @@ -521,7 +521,7 @@ mod tests { #[test] fn unsupported_resolution_downgrades_with_pay_less() { let req = unwrap_t2v(build_fal_seedance_1p5_pro(make_t2v(|b| { - b.resolution = Some(CommonResolution::FourK); + b.resolution = Some(RouterResolution::FourK); b.request_mismatch_mitigation_strategy = RequestMismatchMitigationStrategy::PayLessDowngrade; }))); assert!(matches!(req.resolution, Some(EnqueueSeedance1p5ProTextToVideoResolution::FourEightyP))); @@ -587,7 +587,7 @@ mod tests { #[test] fn auto() { let req = unwrap_t2v(build_fal_seedance_1p5_pro(make_t2v(|b| { - b.aspect_ratio = Some(CommonAspectRatio::Auto); + b.aspect_ratio = Some(RouterAspectRatio::Auto); }))); assert!(matches!(req.aspect_ratio, Some(EnqueueSeedance1p5ProTextToVideoAspectRatio::Auto))); } @@ -595,7 +595,7 @@ mod tests { #[test] fn sixteen_by_nine() { let req = unwrap_t2v(build_fal_seedance_1p5_pro(make_t2v(|b| { - b.aspect_ratio = Some(CommonAspectRatio::WideSixteenByNine); + b.aspect_ratio = Some(RouterAspectRatio::WideSixteenByNine); }))); assert!(matches!(req.aspect_ratio, Some(EnqueueSeedance1p5ProTextToVideoAspectRatio::SixteenByNine))); } @@ -603,7 +603,7 @@ mod tests { #[test] fn square() { let req = unwrap_t2v(build_fal_seedance_1p5_pro(make_t2v(|b| { - b.aspect_ratio = Some(CommonAspectRatio::Square); + b.aspect_ratio = Some(RouterAspectRatio::Square); }))); assert!(matches!(req.aspect_ratio, Some(EnqueueSeedance1p5ProTextToVideoAspectRatio::Square))); } @@ -612,7 +612,7 @@ mod tests { fn unsupported_aspect_ratio_falls_back_to_nearest_with_pay_more() { // WideFiveByFour → nearest wide → FourByThree (per nearest_aspect_ratio). let req = unwrap_t2v(build_fal_seedance_1p5_pro(make_t2v(|b| { - b.aspect_ratio = Some(CommonAspectRatio::WideFiveByFour); + b.aspect_ratio = Some(RouterAspectRatio::WideFiveByFour); b.request_mismatch_mitigation_strategy = RequestMismatchMitigationStrategy::PayMoreUpgrade; }))); assert!(matches!(req.aspect_ratio, Some(EnqueueSeedance1p5ProTextToVideoAspectRatio::FourByThree))); @@ -621,7 +621,7 @@ mod tests { #[test] fn unsupported_aspect_ratio_errors_with_error_out() { let result = build_fal_seedance_1p5_pro(make_t2v(|b| { - b.aspect_ratio = Some(CommonAspectRatio::WideFiveByFour); + b.aspect_ratio = Some(RouterAspectRatio::WideFiveByFour); b.request_mismatch_mitigation_strategy = RequestMismatchMitigationStrategy::ErrorOut; })); assert!(result.is_err()); @@ -634,17 +634,17 @@ mod tests { fn t2v_combinatorial_pass() { let resolutions = [ None, - Some(CommonResolution::FourEightyP), - Some(CommonResolution::SevenTwentyP), - Some(CommonResolution::TenEightyP), + Some(RouterResolution::FourEightyP), + Some(RouterResolution::SevenTwentyP), + Some(RouterResolution::TenEightyP), ]; let durations = [None, Some(4u16), Some(8u16), Some(12u16)]; let aspect_ratios = [ None, - Some(CommonAspectRatio::Auto), - Some(CommonAspectRatio::Square), - Some(CommonAspectRatio::WideSixteenByNine), - Some(CommonAspectRatio::TallNineBySixteen), + Some(RouterAspectRatio::Auto), + Some(RouterAspectRatio::Square), + Some(RouterAspectRatio::WideSixteenByNine), + Some(RouterAspectRatio::TallNineBySixteen), ]; let audios = [None, Some(true), Some(false)]; @@ -671,11 +671,11 @@ mod tests { fn i2v_combinatorial_pass() { let resolutions = [ None, - Some(CommonResolution::SevenTwentyP), - Some(CommonResolution::TenEightyP), + Some(RouterResolution::SevenTwentyP), + Some(RouterResolution::TenEightyP), ]; let durations = [None, Some(5u16), Some(12u16)]; - let aspect_ratios = [None, Some(CommonAspectRatio::WideSixteenByNine), Some(CommonAspectRatio::Square)]; + let aspect_ratios = [None, Some(RouterAspectRatio::WideSixteenByNine), Some(RouterAspectRatio::Square)]; let audios = [None, Some(true), Some(false)]; let mut combos = 0; diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p5_pro/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p5_pro/cost.rs index 7f51a07316..64809be2a4 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p5_pro/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p5_pro/cost.rs @@ -77,19 +77,19 @@ fn i2v_to_t2v_duration(d: EnqueueSeedance1p5ProImageToVideoDuration) -> EnqueueS #[cfg(test)] mod tests { - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; // ── Helpers ── fn t2v_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance1p5Pro, - provider: Provider::Fal, + model: RouterVideoModel::Seedance1p5Pro, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), ..Default::default() } @@ -97,8 +97,8 @@ mod tests { fn i2v_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance1p5Pro, - provider: Provider::Fal, + model: RouterVideoModel::Seedance1p5Pro, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), start_frame: Some(ImageRef::Url("https://example.com/start.png".to_string())), ..Default::default() @@ -107,7 +107,7 @@ mod tests { fn cost_cents( builder_factory: fn() -> GenerateVideoRequestBuilder, - resolution: Option, + resolution: Option, duration_seconds: Option, generate_audio: Option, ) -> u64 { @@ -131,37 +131,37 @@ mod tests { #[test] fn p720_5s_audio_special_case() { // Special-case: 720p + 5s + audio short-circuits to 26¢. - assert_eq!(cost_cents(t2v_builder, Some(CommonResolution::SevenTwentyP), Some(5), Some(true)), 26); + assert_eq!(cost_cents(t2v_builder, Some(RouterResolution::SevenTwentyP), Some(5), Some(true)), 26); } #[test] fn p720_5s_no_audio_special_case() { // Special-case: 720p + 5s without audio → 13¢. - assert_eq!(cost_cents(t2v_builder, Some(CommonResolution::SevenTwentyP), Some(5), Some(false)), 13); + assert_eq!(cost_cents(t2v_builder, Some(RouterResolution::SevenTwentyP), Some(5), Some(false)), 13); } #[test] fn p720_5s_default_audio_is_with_audio() { // generate_audio = None defaults to true in the cost calculator. - assert_eq!(cost_cents(t2v_builder, Some(CommonResolution::SevenTwentyP), Some(5), None), 26); + assert_eq!(cost_cents(t2v_builder, Some(RouterResolution::SevenTwentyP), Some(5), None), 26); } #[test] fn p720_10s_with_audio() { // 1280×720×30×10/1024 = 270000 × $2.4/M = $0.648 → ceil = 65¢. - assert_eq!(cost_cents(t2v_builder, Some(CommonResolution::SevenTwentyP), Some(10), Some(true)), 65); + assert_eq!(cost_cents(t2v_builder, Some(RouterResolution::SevenTwentyP), Some(10), Some(true)), 65); } #[test] fn p720_10s_no_audio() { // 270000 × $1.2/M = $0.324 → ceil = 33¢. - assert_eq!(cost_cents(t2v_builder, Some(CommonResolution::SevenTwentyP), Some(10), Some(false)), 33); + assert_eq!(cost_cents(t2v_builder, Some(RouterResolution::SevenTwentyP), Some(10), Some(false)), 33); } #[test] fn p720_12s_with_audio() { // 1280×720×30×12/1024 = 324000 × $2.4/M = $0.7776 → ceil = 78¢. - assert_eq!(cost_cents(t2v_builder, Some(CommonResolution::SevenTwentyP), Some(12), Some(true)), 78); + assert_eq!(cost_cents(t2v_builder, Some(RouterResolution::SevenTwentyP), Some(12), Some(true)), 78); } } @@ -171,19 +171,19 @@ mod tests { #[test] fn p480_5s_audio() { // 640×480×30×5/1024 = 45000 × $2.4/M = $0.108 → ceil = 11¢. - assert_eq!(cost_cents(t2v_builder, Some(CommonResolution::FourEightyP), Some(5), Some(true)), 11); + assert_eq!(cost_cents(t2v_builder, Some(RouterResolution::FourEightyP), Some(5), Some(true)), 11); } #[test] fn p480_5s_no_audio() { // 45000 × $1.2/M = $0.054 → ceil = 6¢. - assert_eq!(cost_cents(t2v_builder, Some(CommonResolution::FourEightyP), Some(5), Some(false)), 6); + assert_eq!(cost_cents(t2v_builder, Some(RouterResolution::FourEightyP), Some(5), Some(false)), 6); } #[test] fn p480_10s_audio() { // 90000 × $2.4/M = $0.216 → ceil = 22¢. - assert_eq!(cost_cents(t2v_builder, Some(CommonResolution::FourEightyP), Some(10), Some(true)), 22); + assert_eq!(cost_cents(t2v_builder, Some(RouterResolution::FourEightyP), Some(10), Some(true)), 22); } } @@ -193,19 +193,19 @@ mod tests { #[test] fn p1080_5s_audio() { // 1920×1080×30×5/1024 = 303750 × $2.4/M = $0.729 → ceil = 73¢. - assert_eq!(cost_cents(t2v_builder, Some(CommonResolution::TenEightyP), Some(5), Some(true)), 73); + assert_eq!(cost_cents(t2v_builder, Some(RouterResolution::TenEightyP), Some(5), Some(true)), 73); } #[test] fn p1080_5s_no_audio() { // 303750 × $1.2/M = $0.36450 → ceil = 37¢. - assert_eq!(cost_cents(t2v_builder, Some(CommonResolution::TenEightyP), Some(5), Some(false)), 37); + assert_eq!(cost_cents(t2v_builder, Some(RouterResolution::TenEightyP), Some(5), Some(false)), 37); } #[test] fn p1080_10s_audio() { // 607500 × $2.4/M = $1.458 → ceil = 146¢. - assert_eq!(cost_cents(t2v_builder, Some(CommonResolution::TenEightyP), Some(10), Some(true)), 146); + assert_eq!(cost_cents(t2v_builder, Some(RouterResolution::TenEightyP), Some(10), Some(true)), 146); } } @@ -217,24 +217,24 @@ mod tests { #[test] fn p720_5s_audio() { assert_eq!( - cost_cents(i2v_builder, Some(CommonResolution::SevenTwentyP), Some(5), Some(true)), - cost_cents(t2v_builder, Some(CommonResolution::SevenTwentyP), Some(5), Some(true)), + cost_cents(i2v_builder, Some(RouterResolution::SevenTwentyP), Some(5), Some(true)), + cost_cents(t2v_builder, Some(RouterResolution::SevenTwentyP), Some(5), Some(true)), ); } #[test] fn p1080_10s_no_audio() { assert_eq!( - cost_cents(i2v_builder, Some(CommonResolution::TenEightyP), Some(10), Some(false)), - cost_cents(t2v_builder, Some(CommonResolution::TenEightyP), Some(10), Some(false)), + cost_cents(i2v_builder, Some(RouterResolution::TenEightyP), Some(10), Some(false)), + cost_cents(t2v_builder, Some(RouterResolution::TenEightyP), Some(10), Some(false)), ); } #[test] fn p480_12s_audio() { assert_eq!( - cost_cents(i2v_builder, Some(CommonResolution::FourEightyP), Some(12), Some(true)), - cost_cents(t2v_builder, Some(CommonResolution::FourEightyP), Some(12), Some(true)), + cost_cents(i2v_builder, Some(RouterResolution::FourEightyP), Some(12), Some(true)), + cost_cents(t2v_builder, Some(RouterResolution::FourEightyP), Some(12), Some(true)), ); } } @@ -246,26 +246,26 @@ mod tests { #[test] fn higher_resolution_costs_more() { - let p480 = cost_cents(t2v_builder, Some(CommonResolution::FourEightyP), Some(5), Some(true)); - let p720 = cost_cents(t2v_builder, Some(CommonResolution::SevenTwentyP), Some(5), Some(true)); - let p1080 = cost_cents(t2v_builder, Some(CommonResolution::TenEightyP), Some(5), Some(true)); + let p480 = cost_cents(t2v_builder, Some(RouterResolution::FourEightyP), Some(5), Some(true)); + let p720 = cost_cents(t2v_builder, Some(RouterResolution::SevenTwentyP), Some(5), Some(true)); + let p1080 = cost_cents(t2v_builder, Some(RouterResolution::TenEightyP), Some(5), Some(true)); assert!(p480 < p720, "480p ({p480}) < 720p ({p720})"); assert!(p720 < p1080, "720p ({p720}) < 1080p ({p1080})"); } #[test] fn longer_duration_costs_more() { - let d4 = cost_cents(t2v_builder, Some(CommonResolution::TenEightyP), Some(4), Some(true)); - let d8 = cost_cents(t2v_builder, Some(CommonResolution::TenEightyP), Some(8), Some(true)); - let d12 = cost_cents(t2v_builder, Some(CommonResolution::TenEightyP), Some(12), Some(true)); + let d4 = cost_cents(t2v_builder, Some(RouterResolution::TenEightyP), Some(4), Some(true)); + let d8 = cost_cents(t2v_builder, Some(RouterResolution::TenEightyP), Some(8), Some(true)); + let d12 = cost_cents(t2v_builder, Some(RouterResolution::TenEightyP), Some(12), Some(true)); assert!(d4 < d8); assert!(d8 < d12); } #[test] fn audio_costs_more_than_no_audio() { - let with_audio = cost_cents(t2v_builder, Some(CommonResolution::TenEightyP), Some(10), Some(true)); - let no_audio = cost_cents(t2v_builder, Some(CommonResolution::TenEightyP), Some(10), Some(false)); + let with_audio = cost_cents(t2v_builder, Some(RouterResolution::TenEightyP), Some(10), Some(true)); + let no_audio = cost_cents(t2v_builder, Some(RouterResolution::TenEightyP), Some(10), Some(false)); assert!(no_audio < with_audio, "no-audio ({no_audio}) < audio ({with_audio})"); } } @@ -275,17 +275,17 @@ mod tests { #[test] fn aspect_ratio_does_not_affect_cost() { let mut b = t2v_builder(); - b.resolution = Some(CommonResolution::SevenTwentyP); + b.resolution = Some(RouterResolution::SevenTwentyP); b.duration_seconds = Some(10); b.generate_audio = Some(true); let baseline = b.clone().build2().unwrap().estimate_cost().unwrap().cost_in_usd_cents.unwrap(); for ar in [ - Some(CommonAspectRatio::Auto), - Some(CommonAspectRatio::Square), - Some(CommonAspectRatio::WideSixteenByNine), - Some(CommonAspectRatio::TallNineBySixteen), - Some(CommonAspectRatio::WideTwentyOneByNine), + Some(RouterAspectRatio::Auto), + Some(RouterAspectRatio::Square), + Some(RouterAspectRatio::WideSixteenByNine), + Some(RouterAspectRatio::TallNineBySixteen), + Some(RouterAspectRatio::WideTwentyOneByNine), ] { let mut variant = b.clone(); variant.aspect_ratio = ar; @@ -299,9 +299,9 @@ mod tests { #[test] fn combinatorial_positive_cost() { let resolutions = [ - Some(CommonResolution::FourEightyP), - Some(CommonResolution::SevenTwentyP), - Some(CommonResolution::TenEightyP), + Some(RouterResolution::FourEightyP), + Some(RouterResolution::SevenTwentyP), + Some(RouterResolution::TenEightyP), ]; let durations = [Some(4u16), Some(5), Some(8), Some(12)]; let audios = [Some(true), Some(false), None]; diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p5_pro/request.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p5_pro/request.rs index ebc2b37ac2..4716d9e99c 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p5_pro/request.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/seedance_1p5_pro/request.rs @@ -69,11 +69,11 @@ impl FalSeedance1p5ProRequestState { mod tests { use test_data::web::image_urls::JUNO_AT_LAKE_IMAGE_URL; - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use crate::generate::generate_video::generate_video_response::GenerateVideoResponse; use crate::generate::generate_video_v2::video_generation_draft_or_request::VideoGenerationDraftOrRequest; @@ -86,8 +86,8 @@ mod tests { async fn live_text_to_video_720p_5s() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("a serene mountain landscape at sunrise.".to_string()), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), - resolution: Some(CommonResolution::SevenTwentyP), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), + resolution: Some(RouterResolution::SevenTwentyP), duration_seconds: Some(5), generate_audio: Some(true), ..fal_seedance_1p5_pro_builder() @@ -101,7 +101,7 @@ mod tests { async fn live_text_to_video_1080p_no_audio() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("a city street bustling with people".to_string()), - resolution: Some(CommonResolution::TenEightyP), + resolution: Some(RouterResolution::TenEightyP), duration_seconds: Some(5), generate_audio: Some(false), ..fal_seedance_1p5_pro_builder() @@ -116,8 +116,8 @@ mod tests { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("the dog leaps into the lake and splashes around.".to_string()), start_frame: Some(ImageRef::Url(JUNO_AT_LAKE_IMAGE_URL.to_string())), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), - resolution: Some(CommonResolution::SevenTwentyP), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), + resolution: Some(RouterResolution::SevenTwentyP), duration_seconds: Some(5), ..fal_seedance_1p5_pro_builder() }).await; @@ -141,8 +141,8 @@ mod tests { fn fal_seedance_1p5_pro_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance1p5Pro, - provider: Provider::Fal, + model: RouterVideoModel::Seedance1p5Pro, + provider: RouterProvider::Fal, video_batch_count: Some(1), ..Default::default() } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/sora_2/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/sora_2/build.rs index 0c250b847b..8c8c42ce57 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/sora_2/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/sora_2/build.rs @@ -1,5 +1,5 @@ -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_resolution::CommonResolution; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_resolution::RouterResolution; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; use crate::errors::client_error::ClientError; @@ -44,19 +44,19 @@ pub fn build_fal_sora_2( } fn plan_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { use FalSora2AspectRatio as Ar; match aspect_ratio { None => Ok(None), - Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto4k) => Ok(Some(Ar::Auto)), + Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto4k) => Ok(Some(Ar::Auto)), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Some(Ar::SixteenByNine)), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Some(Ar::NineBySixteen)), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Some(Ar::SixteenByNine)), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Some(Ar::NineBySixteen)), Some(unsupported) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -71,13 +71,13 @@ fn plan_aspect_ratio( } fn plan_resolution( - resolution: Option, + resolution: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { use FalSora2Resolution as R; match resolution { None => Ok(None), - Some(CommonResolution::SevenTwentyP) => Ok(Some(R::SevenTwentyP)), + Some(RouterResolution::SevenTwentyP) => Ok(Some(R::SevenTwentyP)), // Only 720p is supported; everything else falls back or errors. Some(other) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -116,16 +116,16 @@ fn plan_duration( #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use super::*; fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Sora2, - provider: Provider::Fal, + model: RouterVideoModel::Sora2, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), ..Default::default() } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/sora_2/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/sora_2/cost.rs index ac645407ab..3b704d40f3 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/sora_2/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/sora_2/cost.rs @@ -41,14 +41,14 @@ fn duration_seconds_for_cost(d: Option) -> u64 { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; fn cost_cents(duration_seconds: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Sora2, - provider: Provider::Fal, + model: RouterVideoModel::Sora2, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), duration_seconds, ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/sora_2_pro/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/sora_2_pro/build.rs index 5649c8a113..a1f03bf942 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/sora_2_pro/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/sora_2_pro/build.rs @@ -1,5 +1,5 @@ -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_resolution::CommonResolution; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_resolution::RouterResolution; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; use crate::errors::client_error::ClientError; @@ -45,19 +45,19 @@ pub fn build_fal_sora_2_pro( } fn plan_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { use FalSora2ProAspectRatio as Ar; match aspect_ratio { None => Ok(None), - Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto4k) => Ok(Some(Ar::Auto)), + Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto4k) => Ok(Some(Ar::Auto)), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Some(Ar::SixteenByNine)), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Some(Ar::NineBySixteen)), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Some(Ar::SixteenByNine)), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Some(Ar::NineBySixteen)), Some(unsupported) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -72,14 +72,14 @@ fn plan_aspect_ratio( } fn plan_resolution( - resolution: Option, + resolution: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { use FalSora2ProResolution as R; match resolution { None => Ok(None), - Some(CommonResolution::SevenTwentyP) => Ok(Some(R::SevenTwentyP)), - Some(CommonResolution::TenEightyP) => Ok(Some(R::TenEightyP)), + Some(RouterResolution::SevenTwentyP) => Ok(Some(R::SevenTwentyP)), + Some(RouterResolution::TenEightyP) => Ok(Some(R::TenEightyP)), Some(other) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { Err(ArtcraftRouterError::Client(ClientError::ModelDoesNotSupportOption { @@ -118,16 +118,16 @@ fn plan_duration( #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use super::*; fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Sora2Pro, - provider: Provider::Fal, + model: RouterVideoModel::Sora2Pro, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), ..Default::default() } @@ -161,7 +161,7 @@ mod tests { #[test] fn resolution_1080p_supported() { let mut b = base_builder(); - b.resolution = Some(CommonResolution::TenEightyP); + b.resolution = Some(RouterResolution::TenEightyP); assert!(build_fal_sora_2_pro(b).is_ok()); } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/sora_2_pro/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/sora_2_pro/cost.rs index 677269b5ba..4eb2a8fb28 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/sora_2_pro/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/sora_2_pro/cost.rs @@ -55,16 +55,16 @@ fn is_ten_eighty_p_for_cost(mode: &FalSora2ProMode, resolution: Option, resolution: Option, has_start: bool) -> u64 { + fn cost_cents(duration_seconds: Option, resolution: Option, has_start: bool) -> u64 { let mut b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Sora2Pro, - provider: Provider::Fal, + model: RouterVideoModel::Sora2Pro, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), duration_seconds, resolution, @@ -82,26 +82,26 @@ mod tests { #[test] fn p720_4s_is_120() { // $0.30/sec × 4s = 120¢. - assert_eq!(cost_cents(Some(4), Some(CommonResolution::SevenTwentyP), false), 120); + assert_eq!(cost_cents(Some(4), Some(RouterResolution::SevenTwentyP), false), 120); } #[test] - fn p720_8s_is_240() { assert_eq!(cost_cents(Some(8), Some(CommonResolution::SevenTwentyP), false), 240); } + fn p720_8s_is_240() { assert_eq!(cost_cents(Some(8), Some(RouterResolution::SevenTwentyP), false), 240); } #[test] - fn p720_12s_is_360() { assert_eq!(cost_cents(Some(12), Some(CommonResolution::SevenTwentyP), false), 360); } + fn p720_12s_is_360() { assert_eq!(cost_cents(Some(12), Some(RouterResolution::SevenTwentyP), false), 360); } #[test] fn p1080_4s_is_200() { // $0.50/sec × 4s = 200¢. - assert_eq!(cost_cents(Some(4), Some(CommonResolution::TenEightyP), false), 200); + assert_eq!(cost_cents(Some(4), Some(RouterResolution::TenEightyP), false), 200); } #[test] - fn p1080_8s_is_400() { assert_eq!(cost_cents(Some(8), Some(CommonResolution::TenEightyP), false), 400); } + fn p1080_8s_is_400() { assert_eq!(cost_cents(Some(8), Some(RouterResolution::TenEightyP), false), 400); } #[test] - fn p1080_12s_is_600() { assert_eq!(cost_cents(Some(12), Some(CommonResolution::TenEightyP), false), 600); } + fn p1080_12s_is_600() { assert_eq!(cost_cents(Some(12), Some(RouterResolution::TenEightyP), false), 600); } #[test] fn t2v_default_resolution_priced_as_1080p() { @@ -119,14 +119,14 @@ mod tests { #[test] fn higher_resolution_costs_more() { assert!( - cost_cents(Some(8), Some(CommonResolution::SevenTwentyP), false) - < cost_cents(Some(8), Some(CommonResolution::TenEightyP), false) + cost_cents(Some(8), Some(RouterResolution::SevenTwentyP), false) + < cost_cents(Some(8), Some(RouterResolution::TenEightyP), false) ); } #[test] fn longer_duration_costs_more() { - let r = Some(CommonResolution::TenEightyP); + let r = Some(RouterResolution::TenEightyP); assert!(cost_cents(Some(4), r, false) < cost_cents(Some(8), r, false)); assert!(cost_cents(Some(8), r, false) < cost_cents(Some(12), r, false)); } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_2/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_2/build.rs index 289d732d17..8030e0cba6 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_2/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_2/build.rs @@ -3,7 +3,7 @@ use fal_client::requests::webhook::video::image::enqueue_veo_2_image_to_video_we }; use fal_client::requests::webhook::video::text::enqueue_veo_2_text_to_video_webhook::Veo2TextToVideoRequest; -use crate::api::common_aspect_ratio::CommonAspectRatio; +use crate::api::router_aspect_ratio::RouterAspectRatio; use crate::api::image_ref::ImageRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -52,19 +52,19 @@ pub fn build_fal_veo_2( } fn plan_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result { use Veo2AspectRatio as Ar; match aspect_ratio { None - | Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto3k) - | Some(CommonAspectRatio::Auto4k) => Ok(Ar::Auto), + | Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto3k) + | Some(RouterAspectRatio::Auto4k) => Ok(Ar::Auto), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Ar::WideSixteenNine), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Ar::TallNineSixteen), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Ar::WideSixteenNine), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Ar::TallNineSixteen), Some(unsupported_ar) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -106,16 +106,16 @@ fn unsupported(field: &'static str, value: &str) -> ArtcraftRouterError { mod tests { use tokens::tokens::media_files::MediaFileToken; - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video_v2::video_generation_request::VideoGenerationRequest; use super::*; fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Veo2, - provider: Provider::Fal, + model: RouterVideoModel::Veo2, + provider: RouterProvider::Fal, prompt: Some("a corgi running".to_string()), ..Default::default() } @@ -246,26 +246,26 @@ mod tests { mod aspect_ratio_conversions { use super::*; - use crate::api::common_aspect_ratio::CommonAspectRatio; + use crate::api::router_aspect_ratio::RouterAspectRatio; #[test] fn t2v_auto() { let mut b = base_builder(); - b.aspect_ratio = Some(CommonAspectRatio::Auto); + b.aspect_ratio = Some(RouterAspectRatio::Auto); assert!(matches!(t2v_request(b).aspect_ratio, Veo2AspectRatio::Auto)); } #[test] fn t2v_sixteen_nine() { let mut b = base_builder(); - b.aspect_ratio = Some(CommonAspectRatio::WideSixteenByNine); + b.aspect_ratio = Some(RouterAspectRatio::WideSixteenByNine); assert!(matches!(t2v_request(b).aspect_ratio, Veo2AspectRatio::WideSixteenNine)); } #[test] fn t2v_unsupported_aspect_ratio_falls_back_with_pay_more() { let mut b = base_builder(); - b.aspect_ratio = Some(CommonAspectRatio::Square); + b.aspect_ratio = Some(RouterAspectRatio::Square); b.request_mismatch_mitigation_strategy = RequestMismatchMitigationStrategy::PayMoreUpgrade; assert!(matches!(t2v_request(b).aspect_ratio, Veo2AspectRatio::Auto)); } @@ -273,7 +273,7 @@ mod tests { #[test] fn t2v_unsupported_aspect_ratio_errors_with_error_out() { let mut b = base_builder(); - b.aspect_ratio = Some(CommonAspectRatio::Square); + b.aspect_ratio = Some(RouterAspectRatio::Square); b.request_mismatch_mitigation_strategy = RequestMismatchMitigationStrategy::ErrorOut; assert!(build_fal_veo_2(b).is_err()); } @@ -281,8 +281,8 @@ mod tests { #[test] fn full_combinatorial_pass() { - use crate::api::common_aspect_ratio::CommonAspectRatio; - let aspect_ratios = [None, Some(CommonAspectRatio::Auto), Some(CommonAspectRatio::WideSixteenByNine), Some(CommonAspectRatio::TallNineBySixteen)]; + use crate::api::router_aspect_ratio::RouterAspectRatio; + let aspect_ratios = [None, Some(RouterAspectRatio::Auto), Some(RouterAspectRatio::WideSixteenByNine), Some(RouterAspectRatio::TallNineBySixteen)]; let durations = [None, Some(5u16), Some(6), Some(7), Some(8)]; let mut combos = 0; diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_2/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_2/cost.rs index 0d8b5711e3..40afd35574 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_2/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_2/cost.rs @@ -46,15 +46,15 @@ fn duration_seconds_for_cost(d: Veo2Duration) -> u64 { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; fn cost_cents(duration_seconds: Option, has_start_frame: bool) -> u64 { let mut b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Veo2, - provider: Provider::Fal, + model: RouterVideoModel::Veo2, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), duration_seconds, ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_2/request.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_2/request.rs index 2b3e44e1ca..cac39d8c6d 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_2/request.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_2/request.rs @@ -67,10 +67,10 @@ impl FalVeo2RequestState { mod tests { use test_data::web::image_urls::JUNO_AT_LAKE_IMAGE_URL; - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use crate::generate::generate_video::generate_video_response::GenerateVideoResponse; use crate::generate::generate_video_v2::video_generation_draft_or_request::VideoGenerationDraftOrRequest; @@ -81,7 +81,7 @@ mod tests { async fn live_text_to_video_5s() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("a peaceful lake at dawn".to_string()), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), duration_seconds: Some(5), ..fal_veo_2_builder() }).await; @@ -104,8 +104,8 @@ mod tests { fn fal_veo_2_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Veo2, - provider: Provider::Fal, + model: RouterVideoModel::Veo2, + provider: RouterProvider::Fal, ..Default::default() } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3/build.rs index 3870c89027..873a28e681 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3/build.rs @@ -5,8 +5,8 @@ use fal_client::requests::webhook::video::text::enqueue_veo_3_text_to_video_webh Veo3T2vAspectRatio, Veo3T2vDuration, Veo3T2vResolution, Veo3TextToVideoRequest, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_resolution::CommonResolution; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_resolution::RouterResolution; use crate::api::image_ref::ImageRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -83,14 +83,14 @@ pub fn build_fal_veo_3( /// Text-to-video: only 16:9 and 9:16 (no Auto, no Square). fn plan_t2v_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result { use Veo3T2vAspectRatio as Ar; match aspect_ratio { None => Ok(Ar::Default), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Ar::WideSixteenNine), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Ar::TallNineSixteen), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Ar::WideSixteenNine), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Ar::TallNineSixteen), Some(other) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { Err(unsupported("aspect_ratio", &format!("{:?}", other))) @@ -102,19 +102,19 @@ fn plan_t2v_aspect_ratio( /// Image-to-video: Auto, 16:9, 9:16 (no Square). fn plan_i2v_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result { use Veo3I2vAspectRatio as Ar; match aspect_ratio { None - | Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto3k) - | Some(CommonAspectRatio::Auto4k) => Ok(Ar::Auto), + | Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto3k) + | Some(RouterAspectRatio::Auto4k) => Ok(Ar::Auto), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Ar::WideSixteenNine), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Ar::TallNineSixteen), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Ar::WideSixteenNine), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Ar::TallNineSixteen), Some(other) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -126,13 +126,13 @@ fn plan_i2v_aspect_ratio( } fn plan_resolution( - resolution: Option, + resolution: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result { match resolution { None => Ok(PlanResolution::Default), - Some(CommonResolution::SevenTwentyP) => Ok(PlanResolution::SevenTwentyP), - Some(CommonResolution::TenEightyP) => Ok(PlanResolution::TenEightyP), + Some(RouterResolution::SevenTwentyP) => Ok(PlanResolution::SevenTwentyP), + Some(RouterResolution::TenEightyP) => Ok(PlanResolution::TenEightyP), Some(other) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { Err(unsupported("resolution", &format!("{:?}", other))) @@ -205,16 +205,16 @@ fn to_i2v_resolution(r: PlanResolution) -> Veo3I2vResolution { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video_v2::video_generation_request::VideoGenerationRequest; use super::*; fn base_t2v_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Veo3, - provider: Provider::Fal, + model: RouterVideoModel::Veo3, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), ..Default::default() } @@ -272,21 +272,21 @@ mod tests { #[test] fn t2v_720p() { let mut b = base_t2v_builder(); - b.resolution = Some(CommonResolution::SevenTwentyP); + b.resolution = Some(RouterResolution::SevenTwentyP); assert!(matches!(t2v_request(b).resolution, Veo3T2vResolution::SevenTwentyP)); } #[test] fn t2v_1080p() { let mut b = base_t2v_builder(); - b.resolution = Some(CommonResolution::TenEightyP); + b.resolution = Some(RouterResolution::TenEightyP); assert!(matches!(t2v_request(b).resolution, Veo3T2vResolution::TenEightyP)); } #[test] fn t2v_unsupported_upgrades_with_pay_more() { let mut b = base_t2v_builder(); - b.resolution = Some(CommonResolution::FourK); + b.resolution = Some(RouterResolution::FourK); b.request_mismatch_mitigation_strategy = RequestMismatchMitigationStrategy::PayMoreUpgrade; assert!(matches!(t2v_request(b).resolution, Veo3T2vResolution::TenEightyP)); } @@ -315,7 +315,7 @@ mod tests { #[test] fn t2v_sixteen_nine() { let mut b = base_t2v_builder(); - b.aspect_ratio = Some(CommonAspectRatio::WideSixteenByNine); + b.aspect_ratio = Some(RouterAspectRatio::WideSixteenByNine); assert!(matches!(t2v_request(b).aspect_ratio, Veo3T2vAspectRatio::WideSixteenNine)); } @@ -343,9 +343,9 @@ mod tests { #[test] fn full_combinatorial_pass() { - let resolutions = [None, Some(CommonResolution::SevenTwentyP), Some(CommonResolution::TenEightyP)]; + let resolutions = [None, Some(RouterResolution::SevenTwentyP), Some(RouterResolution::TenEightyP)]; let durations = [None, Some(4u16), Some(6), Some(8)]; - let aspect_ratios = [None, Some(CommonAspectRatio::Auto), Some(CommonAspectRatio::WideSixteenByNine), Some(CommonAspectRatio::TallNineBySixteen)]; + let aspect_ratios = [None, Some(RouterAspectRatio::Auto), Some(RouterAspectRatio::WideSixteenByNine), Some(RouterAspectRatio::TallNineBySixteen)]; let audios = [None, Some(true), Some(false)]; let mut combos = 0; diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3/cost.rs index d220b73371..c7a30e8201 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3/cost.rs @@ -54,15 +54,15 @@ fn i2v_duration_seconds(d: Veo3I2vDuration) -> u64 { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; fn cost_cents(duration_seconds: Option, generate_audio: Option, has_start_frame: bool) -> u64 { let mut b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Veo3, - provider: Provider::Fal, + model: RouterVideoModel::Veo3, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), duration_seconds, generate_audio, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3/request.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3/request.rs index 23f076be95..d6ac287f11 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3/request.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3/request.rs @@ -67,10 +67,10 @@ impl FalVeo3RequestState { mod tests { use test_data::web::image_urls::JUNO_AT_LAKE_IMAGE_URL; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use crate::generate::generate_video::generate_video_response::GenerateVideoResponse; use crate::generate::generate_video_v2::video_generation_draft_or_request::VideoGenerationDraftOrRequest; @@ -81,7 +81,7 @@ mod tests { async fn live_text_to_video_720p_4s_audio_on() { let r = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("a serene mountain landscape".to_string()), - resolution: Some(CommonResolution::SevenTwentyP), + resolution: Some(RouterResolution::SevenTwentyP), duration_seconds: Some(4), generate_audio: Some(true), ..builder() @@ -95,7 +95,7 @@ mod tests { let r = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("the dog leaps into the lake.".to_string()), start_frame: Some(ImageRef::Url(JUNO_AT_LAKE_IMAGE_URL.to_string())), - resolution: Some(CommonResolution::TenEightyP), + resolution: Some(RouterResolution::TenEightyP), duration_seconds: Some(8), generate_audio: Some(false), ..builder() @@ -105,8 +105,8 @@ mod tests { fn builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Veo3, - provider: Provider::Fal, + model: RouterVideoModel::Veo3, + provider: RouterProvider::Fal, ..Default::default() } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3_fast/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3_fast/build.rs index fd0424105c..5bc02b1868 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3_fast/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3_fast/build.rs @@ -2,8 +2,8 @@ use fal_client::requests::webhook::video::image::enqueue_veo_3_fast_image_to_vid Veo3FastAspectRatio, Veo3FastDuration, Veo3FastRequest, Veo3FastResolution, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_resolution::CommonResolution; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_resolution::RouterResolution; use crate::api::image_ref::ImageRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -53,19 +53,19 @@ fn require_url(image_ref: Option) -> Result, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result { use Veo3FastAspectRatio as Ar; match aspect_ratio { None - | Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto3k) - | Some(CommonAspectRatio::Auto4k) => Ok(Ar::Auto), + | Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto3k) + | Some(RouterAspectRatio::Auto4k) => Ok(Ar::Auto), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Ar::WideSixteenNine), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Ar::TallNineSixteen), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Ar::WideSixteenNine), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Ar::TallNineSixteen), Some(unsupported_ar) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -77,14 +77,14 @@ fn plan_aspect_ratio( } fn plan_resolution( - resolution: Option, + resolution: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result { use Veo3FastResolution as R; match resolution { None => Ok(R::Default), - Some(CommonResolution::SevenTwentyP) => Ok(R::SevenTwentyP), - Some(CommonResolution::TenEightyP) => Ok(R::TenEightyP), + Some(RouterResolution::SevenTwentyP) => Ok(R::SevenTwentyP), + Some(RouterResolution::TenEightyP) => Ok(R::TenEightyP), Some(other) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { Err(unsupported("resolution", &format!("{:?}", other))) @@ -123,16 +123,16 @@ fn unsupported(field: &'static str, value: &str) -> ArtcraftRouterError { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video_v2::video_generation_request::VideoGenerationRequest; use super::*; fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Veo3Fast, - provider: Provider::Fal, + model: RouterVideoModel::Veo3Fast, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), start_frame: Some(ImageRef::Url("https://example.com/a.png".to_string())), ..Default::default() @@ -181,9 +181,9 @@ mod tests { #[test] fn full_combinatorial_pass() { - let resolutions = [None, Some(CommonResolution::SevenTwentyP), Some(CommonResolution::TenEightyP)]; + let resolutions = [None, Some(RouterResolution::SevenTwentyP), Some(RouterResolution::TenEightyP)]; let durations = [None, Some(4u16), Some(6), Some(8)]; - let aspect_ratios = [None, Some(CommonAspectRatio::Auto), Some(CommonAspectRatio::WideSixteenByNine), Some(CommonAspectRatio::TallNineBySixteen)]; + let aspect_ratios = [None, Some(RouterAspectRatio::Auto), Some(RouterAspectRatio::WideSixteenByNine), Some(RouterAspectRatio::TallNineBySixteen)]; let audios = [None, Some(true), Some(false)]; let mut combos = 0; diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3_fast/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3_fast/cost.rs index a8848527a5..a764450311 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3_fast/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3_fast/cost.rs @@ -44,15 +44,15 @@ fn duration_seconds_for_cost(d: Veo3FastDuration) -> u64 { #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; fn cost_cents(duration_seconds: Option, generate_audio: Option) -> u64 { let b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Veo3Fast, - provider: Provider::Fal, + model: RouterVideoModel::Veo3Fast, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), start_frame: Some(ImageRef::Url("https://example.com/a.png".to_string())), duration_seconds, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3_fast/request.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3_fast/request.rs index f7b166b82f..4e7d4a7785 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3_fast/request.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3_fast/request.rs @@ -46,10 +46,10 @@ impl FalVeo3FastRequestState { mod tests { use test_data::web::image_urls::JUNO_AT_LAKE_IMAGE_URL; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use crate::generate::generate_video::generate_video_response::GenerateVideoResponse; use crate::generate::generate_video_v2::video_generation_draft_or_request::VideoGenerationDraftOrRequest; @@ -61,7 +61,7 @@ mod tests { let r = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("the dog leaps into the lake.".to_string()), start_frame: Some(ImageRef::Url(JUNO_AT_LAKE_IMAGE_URL.to_string())), - resolution: Some(CommonResolution::SevenTwentyP), + resolution: Some(RouterResolution::SevenTwentyP), duration_seconds: Some(4), generate_audio: Some(true), ..builder() @@ -71,8 +71,8 @@ mod tests { fn builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Veo3Fast, - provider: Provider::Fal, + model: RouterVideoModel::Veo3Fast, + provider: RouterProvider::Fal, ..Default::default() } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1/build.rs index 394e42d4e6..5d9d7a6260 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1/build.rs @@ -11,8 +11,8 @@ use fal_client::requests::webhook::video::text::enqueue_veo_3p1_text_to_video_we EnqueueVeo3p1TextToVideoRequest, EnqueueVeo3p1TextToVideoResolution, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_resolution::CommonResolution; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_resolution::RouterResolution; use crate::api::image_ref::ImageRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -121,19 +121,19 @@ fn optional_url(image_ref: Option) -> Result, ArtcraftR } fn plan_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { use PlanAspectRatio as Ar; match aspect_ratio { None => Ok(None), - Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto4k) => Ok(Some(Ar::Auto)), + Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto4k) => Ok(Some(Ar::Auto)), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Some(Ar::SixteenByNine)), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Some(Ar::NineBySixteen)), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Some(Ar::SixteenByNine)), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Some(Ar::NineBySixteen)), Some(other) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -145,14 +145,14 @@ fn plan_aspect_ratio( } fn plan_resolution( - resolution: Option, + resolution: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { use PlanResolution as R; match resolution { None => Ok(None), - Some(CommonResolution::SevenTwentyP) => Ok(Some(R::SevenTwentyP)), - Some(CommonResolution::TenEightyP) => Ok(Some(R::TenEightyP)), + Some(RouterResolution::SevenTwentyP) => Ok(Some(R::SevenTwentyP)), + Some(RouterResolution::TenEightyP) => Ok(Some(R::TenEightyP)), Some(other) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { Err(unsupported("resolution", &format!("{:?}", other))) @@ -260,16 +260,16 @@ fn to_flf_resolution(r: PlanResolution) -> EnqueueVeo3p1FirstLastFrameImageToVid #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video_v2::video_generation_request::VideoGenerationRequest; use super::*; fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Veo3p1, - provider: Provider::Fal, + model: RouterVideoModel::Veo3p1, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), ..Default::default() } @@ -343,7 +343,7 @@ mod tests { #[test] fn t2v_720p() { let mut b = base_builder(); - b.resolution = Some(CommonResolution::SevenTwentyP); + b.resolution = Some(RouterResolution::SevenTwentyP); match unwrap_mode(b) { FalVeo3p1Mode::TextToVideo(r) => { assert!(matches!(r.resolution, Some(EnqueueVeo3p1TextToVideoResolution::SevenTwentyP))); @@ -355,9 +355,9 @@ mod tests { #[test] fn full_combinatorial_pass() { - let resolutions = [None, Some(CommonResolution::SevenTwentyP), Some(CommonResolution::TenEightyP)]; + let resolutions = [None, Some(RouterResolution::SevenTwentyP), Some(RouterResolution::TenEightyP)]; let durations = [None, Some(4u16), Some(6), Some(8)]; - let aspect_ratios = [None, Some(CommonAspectRatio::Auto), Some(CommonAspectRatio::WideSixteenByNine), Some(CommonAspectRatio::TallNineBySixteen)]; + let aspect_ratios = [None, Some(RouterAspectRatio::Auto), Some(RouterAspectRatio::WideSixteenByNine), Some(RouterAspectRatio::TallNineBySixteen)]; let audios = [None, Some(true), Some(false)]; let mut combos = 0; diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1/cost.rs index 7348bf0fc4..ec4305ea20 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1/cost.rs @@ -68,9 +68,9 @@ fn flf_duration_seconds(d: Option u64 { let mut b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Veo3p1, - provider: Provider::Fal, + model: RouterVideoModel::Veo3p1, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), duration_seconds, generate_audio, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1/request.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1/request.rs index a88814d628..e9f2d63a02 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1/request.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1/request.rs @@ -81,10 +81,10 @@ impl FalVeo3p1RequestState { mod tests { use test_data::web::image_urls::JUNO_AT_LAKE_IMAGE_URL; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use crate::generate::generate_video::generate_video_response::GenerateVideoResponse; use crate::generate::generate_video_v2::video_generation_draft_or_request::VideoGenerationDraftOrRequest; @@ -95,7 +95,7 @@ mod tests { async fn live_text_to_video_720p_4s() { let r = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("a quiet meadow with wildflowers".to_string()), - resolution: Some(CommonResolution::SevenTwentyP), + resolution: Some(RouterResolution::SevenTwentyP), duration_seconds: Some(4), ..builder() }).await; @@ -129,8 +129,8 @@ mod tests { fn builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Veo3p1, - provider: Provider::Fal, + model: RouterVideoModel::Veo3p1, + provider: RouterProvider::Fal, ..Default::default() } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1_fast/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1_fast/build.rs index 7a9c9e8802..56739c0f99 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1_fast/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1_fast/build.rs @@ -11,8 +11,8 @@ use fal_client::requests::webhook::video::text::enqueue_veo_3p1_fast_text_to_vid EnqueueVeo3p1FastTextToVideoRequest, EnqueueVeo3p1FastTextToVideoResolution, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_resolution::CommonResolution; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_resolution::RouterResolution; use crate::api::image_ref::ImageRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; @@ -114,19 +114,19 @@ fn optional_url(image_ref: Option) -> Result, ArtcraftR } fn plan_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { use PlanAspectRatio as Ar; match aspect_ratio { None => Ok(None), - Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto4k) => Ok(Some(Ar::Auto)), + Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto4k) => Ok(Some(Ar::Auto)), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Some(Ar::SixteenByNine)), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Some(Ar::NineBySixteen)), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Some(Ar::SixteenByNine)), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Some(Ar::NineBySixteen)), Some(other) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -138,14 +138,14 @@ fn plan_aspect_ratio( } fn plan_resolution( - resolution: Option, + resolution: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { use PlanResolution as R; match resolution { None => Ok(None), - Some(CommonResolution::SevenTwentyP) => Ok(Some(R::SevenTwentyP)), - Some(CommonResolution::TenEightyP) => Ok(Some(R::TenEightyP)), + Some(RouterResolution::SevenTwentyP) => Ok(Some(R::SevenTwentyP)), + Some(RouterResolution::TenEightyP) => Ok(Some(R::TenEightyP)), Some(other) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { Err(unsupported("resolution", &format!("{:?}", other))) @@ -253,16 +253,16 @@ fn to_flf_resolution(r: PlanResolution) -> EnqueueVeo3p1FastFirstLastFrameImageT #[cfg(test)] mod tests { - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video_v2::video_generation_request::VideoGenerationRequest; use super::*; fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Veo3p1Fast, - provider: Provider::Fal, + model: RouterVideoModel::Veo3p1Fast, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), ..Default::default() } @@ -304,9 +304,9 @@ mod tests { #[test] fn full_combinatorial_pass() { - let resolutions = [None, Some(CommonResolution::SevenTwentyP), Some(CommonResolution::TenEightyP)]; + let resolutions = [None, Some(RouterResolution::SevenTwentyP), Some(RouterResolution::TenEightyP)]; let durations = [None, Some(4u16), Some(6), Some(8)]; - let aspect_ratios = [None, Some(CommonAspectRatio::Auto), Some(CommonAspectRatio::WideSixteenByNine), Some(CommonAspectRatio::TallNineBySixteen)]; + let aspect_ratios = [None, Some(RouterAspectRatio::Auto), Some(RouterAspectRatio::WideSixteenByNine), Some(RouterAspectRatio::TallNineBySixteen)]; let audios = [None, Some(true), Some(false)]; let mut combos = 0; diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1_fast/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1_fast/cost.rs index 8de27406fc..eab8218518 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1_fast/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1_fast/cost.rs @@ -66,15 +66,15 @@ fn flf_duration_seconds(d: Option, generate_audio: Option, frames: u8) -> u64 { let mut b = GenerateVideoRequestBuilder { - model: CommonVideoModel::Veo3p1Fast, - provider: Provider::Fal, + model: RouterVideoModel::Veo3p1Fast, + provider: RouterProvider::Fal, prompt: Some("test".to_string()), duration_seconds, generate_audio, diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1_fast/request.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1_fast/request.rs index bea196be62..3b7aa6edaa 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1_fast/request.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/fal/veo_3p1_fast/request.rs @@ -84,9 +84,9 @@ impl FalVeo3p1FastRequestState { mod tests { use test_data::web::image_urls::JUNO_AT_LAKE_IMAGE_URL; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use crate::generate::generate_video::generate_video_response::GenerateVideoResponse; use crate::generate::generate_video_v2::video_generation_draft_or_request::VideoGenerationDraftOrRequest; @@ -117,8 +117,8 @@ mod tests { fn builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Veo3p1Fast, - provider: Provider::Fal, + model: RouterVideoModel::Veo3p1Fast, + provider: RouterProvider::Fal, ..Default::default() } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_fast_g/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_fast_g/build.rs index bb52dadf80..a91742145f 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_fast_g/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_fast_g/build.rs @@ -3,8 +3,8 @@ use gmicloud_client::requests::api::video::seedance_2_0_fast_260128::api::{ }; use crate::api::audio_list_ref::AudioListRef; -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_resolution::CommonResolution; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_resolution::RouterResolution; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; use crate::api::video_list_ref::VideoListRef; @@ -54,39 +54,39 @@ pub fn build_gmicloud_seedance_2p0_u_fast( } fn plan_ratio( - aspect_ratio: Option, + aspect_ratio: Option, _strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { match aspect_ratio { - None | Some(CommonAspectRatio::Auto) | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto3k) | Some(CommonAspectRatio::Auto4k) => Ok(None), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Some(Seedance20FastRatio::Landscape16x9)), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Some(Seedance20FastRatio::Portrait9x16)), - Some(CommonAspectRatio::Square) | Some(CommonAspectRatio::SquareHd) => Ok(Some(Seedance20FastRatio::Square)), - Some(CommonAspectRatio::WideFourByThree) => Ok(Some(Seedance20FastRatio::Standard4x3)), - Some(CommonAspectRatio::TallThreeByFour) => Ok(Some(Seedance20FastRatio::Portrait3x4)), - Some(CommonAspectRatio::WideTwentyOneByNine) | Some(CommonAspectRatio::TallNineByTwentyOne) => { + None | Some(RouterAspectRatio::Auto) | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto3k) | Some(RouterAspectRatio::Auto4k) => Ok(None), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Some(Seedance20FastRatio::Landscape16x9)), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Some(Seedance20FastRatio::Portrait9x16)), + Some(RouterAspectRatio::Square) | Some(RouterAspectRatio::SquareHd) => Ok(Some(Seedance20FastRatio::Square)), + Some(RouterAspectRatio::WideFourByThree) => Ok(Some(Seedance20FastRatio::Standard4x3)), + Some(RouterAspectRatio::TallThreeByFour) => Ok(Some(Seedance20FastRatio::Portrait3x4)), + Some(RouterAspectRatio::WideTwentyOneByNine) | Some(RouterAspectRatio::TallNineByTwentyOne) => { Ok(Some(Seedance20FastRatio::UltraWide21x9)) } - Some(CommonAspectRatio::WideThreeByTwo) | Some(CommonAspectRatio::WideFiveByFour) - | Some(CommonAspectRatio::TallFourByFive) | Some(CommonAspectRatio::TallTwoByThree) => { + Some(RouterAspectRatio::WideThreeByTwo) | Some(RouterAspectRatio::WideFiveByFour) + | Some(RouterAspectRatio::TallFourByFive) | Some(RouterAspectRatio::TallTwoByThree) => { Ok(Some(Seedance20FastRatio::Adaptive)) } } } fn plan_resolution( - resolution: Option, + resolution: Option, _strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { match resolution { None => Ok(None), - Some(CommonResolution::FourEightyP) => Ok(Some(Seedance20FastResolution::FourEightyP)), - Some(CommonResolution::SevenTwentyP) => Ok(Some(Seedance20FastResolution::SevenTwentyP)), + Some(RouterResolution::FourEightyP) => Ok(Some(Seedance20FastResolution::FourEightyP)), + Some(RouterResolution::SevenTwentyP) => Ok(Some(Seedance20FastResolution::SevenTwentyP)), // Fast model doesn't support 1080p — fall back to 720p - Some(CommonResolution::TenEightyP) => Ok(Some(Seedance20FastResolution::SevenTwentyP)), - Some(CommonResolution::HalfK) | Some(CommonResolution::OneK) => Ok(Some(Seedance20FastResolution::FourEightyP)), - Some(CommonResolution::TwoK) | Some(CommonResolution::ThreeK) | Some(CommonResolution::FourK) => { + Some(RouterResolution::TenEightyP) => Ok(Some(Seedance20FastResolution::SevenTwentyP)), + Some(RouterResolution::HalfK) | Some(RouterResolution::OneK) => Ok(Some(Seedance20FastResolution::FourEightyP)), + Some(RouterResolution::TwoK) | Some(RouterResolution::ThreeK) | Some(RouterResolution::FourK) => { Ok(Some(Seedance20FastResolution::SevenTwentyP)) } } @@ -142,12 +142,12 @@ mod tests { }; use tokens::tokens::media_files::MediaFileToken; - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::api::video_list_ref::VideoListRef; use crate::api::audio_list_ref::AudioListRef; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; @@ -189,19 +189,19 @@ mod tests { #[test] fn res_480p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::FourEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::FourEightyP); })); assert_eq!(req.request.resolution, Some(Seedance20FastResolution::FourEightyP)); } #[test] fn res_720p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::SevenTwentyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::SevenTwentyP); })); assert_eq!(req.request.resolution, Some(Seedance20FastResolution::SevenTwentyP)); } #[test] fn res_1080p_falls_back_to_720p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::TenEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::TenEightyP); })); assert_eq!(req.request.resolution, Some(Seedance20FastResolution::SevenTwentyP)); } @@ -217,19 +217,19 @@ mod tests { #[test] fn landscape_16x9() { - let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(CommonAspectRatio::WideSixteenByNine); })); + let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(RouterAspectRatio::WideSixteenByNine); })); assert_eq!(req.request.ratio, Some(Seedance20FastRatio::Landscape16x9)); } #[test] fn square() { - let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(CommonAspectRatio::Square); })); + let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(RouterAspectRatio::Square); })); assert_eq!(req.request.ratio, Some(Seedance20FastRatio::Square)); } #[test] fn auto_maps_to_none() { - let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(CommonAspectRatio::Auto); })); + let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(RouterAspectRatio::Auto); })); assert_eq!(req.request.ratio, None); } } @@ -284,8 +284,8 @@ mod tests { fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0UltraFast, - provider: Provider::GmiCloud, + model: RouterVideoModel::Seedance2p0UltraFast, + provider: RouterProvider::GmiCloud, duration_seconds: Some(5), video_batch_count: Some(1), ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_fast_g/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_fast_g/cost.rs index efd4d706f1..79eb63cf6d 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_fast_g/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_fast_g/cost.rs @@ -29,9 +29,9 @@ impl GmiCloudSeedance2p0UltraFastCostState { #[cfg(test)] mod tests { - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; mod pricing_720p { @@ -62,19 +62,19 @@ mod tests { #[test] fn p480_5s() { // 1.0 * 5 = 5¢ - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5), 5); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5), 5); } #[test] fn p480_10s() { // 1.0 * 10 = 10¢ - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 10), 10); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 10), 10); } #[test] fn p480_15s() { // 1.0 * 15 = 15¢ - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 15), 15); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 15), 15); } } @@ -83,19 +83,19 @@ mod tests { #[test] fn higher_resolution_costs_more() { - let c480 = cost_cents(Some(CommonResolution::FourEightyP), 10); - let c720 = cost_cents(Some(CommonResolution::SevenTwentyP), 10); + let c480 = cost_cents(Some(RouterResolution::FourEightyP), 10); + let c720 = cost_cents(Some(RouterResolution::SevenTwentyP), 10); assert!(c480 < c720, "480p ({c480}) should be < 720p ({c720})"); } #[test] fn fast_cheaper_than_standard() { - let fast = cost_cents(Some(CommonResolution::SevenTwentyP), 10); + let fast = cost_cents(Some(RouterResolution::SevenTwentyP), 10); let standard = { let builder = GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0Ultra, - provider: Provider::GmiCloud, - resolution: Some(CommonResolution::SevenTwentyP), + model: RouterVideoModel::Seedance2p0Ultra, + provider: RouterProvider::GmiCloud, + resolution: Some(RouterResolution::SevenTwentyP), duration_seconds: Some(10), video_batch_count: Some(1), ..Default::default() @@ -106,10 +106,10 @@ mod tests { } } - fn cost_cents(resolution: Option, duration_seconds: u16) -> u64 { + fn cost_cents(resolution: Option, duration_seconds: u16) -> u64 { let builder = GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0UltraFast, - provider: Provider::GmiCloud, + model: RouterVideoModel::Seedance2p0UltraFast, + provider: RouterProvider::GmiCloud, resolution, duration_seconds: Some(duration_seconds), video_batch_count: Some(1), diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_fast_g/request.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_fast_g/request.rs index fc62c4a306..2bdf55543b 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_fast_g/request.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_fast_g/request.rs @@ -26,11 +26,11 @@ impl GmiCloudSeedance2p0UltraFastRequestState { #[cfg(test)] mod tests { - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::client::router_client::RouterClient; use crate::client::router_gmicloud_client::RouterGmiCloudClient; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; @@ -44,8 +44,8 @@ mod tests { async fn test_text_to_video_720p() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A shiba inu playing in autumn leaves.".to_string()), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), - resolution: Some(CommonResolution::SevenTwentyP), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), + resolution: Some(RouterResolution::SevenTwentyP), duration_seconds: Some(5), ..gmicloud_fast_builder() }).await; @@ -59,7 +59,7 @@ mod tests { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("The dog starts running and splashing in the lake.".to_string()), start_frame: Some(ImageRef::Url(JUNO_AT_LAKE_IMAGE_URL.to_string())), - resolution: Some(CommonResolution::FourEightyP), + resolution: Some(RouterResolution::FourEightyP), duration_seconds: Some(5), ..gmicloud_fast_builder() }).await; @@ -69,8 +69,8 @@ mod tests { fn gmicloud_fast_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0UltraFast, - provider: Provider::GmiCloud, + model: RouterVideoModel::Seedance2p0UltraFast, + provider: RouterProvider::GmiCloud, video_batch_count: Some(1), ..Default::default() } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_g/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_g/build.rs index 7092535711..95f6e508cc 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_g/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_g/build.rs @@ -3,8 +3,8 @@ use gmicloud_client::requests::api::video::seedance_2_0_260128::api::{ }; use crate::api::audio_list_ref::AudioListRef; -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_resolution::CommonResolution; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_resolution::RouterResolution; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; use crate::api::video_list_ref::VideoListRef; @@ -54,38 +54,38 @@ pub fn build_gmicloud_seedance_2p0_u( } fn plan_ratio( - aspect_ratio: Option, + aspect_ratio: Option, _strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { match aspect_ratio { - None | Some(CommonAspectRatio::Auto) | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto3k) | Some(CommonAspectRatio::Auto4k) => Ok(None), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => Ok(Some(Seedance20Ratio::Landscape16x9)), - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => Ok(Some(Seedance20Ratio::Portrait9x16)), - Some(CommonAspectRatio::Square) | Some(CommonAspectRatio::SquareHd) => Ok(Some(Seedance20Ratio::Square)), - Some(CommonAspectRatio::WideFourByThree) => Ok(Some(Seedance20Ratio::Standard4x3)), - Some(CommonAspectRatio::TallThreeByFour) => Ok(Some(Seedance20Ratio::Portrait3x4)), - Some(CommonAspectRatio::WideTwentyOneByNine) | Some(CommonAspectRatio::TallNineByTwentyOne) => { + None | Some(RouterAspectRatio::Auto) | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto3k) | Some(RouterAspectRatio::Auto4k) => Ok(None), + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => Ok(Some(Seedance20Ratio::Landscape16x9)), + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => Ok(Some(Seedance20Ratio::Portrait9x16)), + Some(RouterAspectRatio::Square) | Some(RouterAspectRatio::SquareHd) => Ok(Some(Seedance20Ratio::Square)), + Some(RouterAspectRatio::WideFourByThree) => Ok(Some(Seedance20Ratio::Standard4x3)), + Some(RouterAspectRatio::TallThreeByFour) => Ok(Some(Seedance20Ratio::Portrait3x4)), + Some(RouterAspectRatio::WideTwentyOneByNine) | Some(RouterAspectRatio::TallNineByTwentyOne) => { Ok(Some(Seedance20Ratio::UltraWide21x9)) } - Some(CommonAspectRatio::WideThreeByTwo) | Some(CommonAspectRatio::WideFiveByFour) - | Some(CommonAspectRatio::TallFourByFive) | Some(CommonAspectRatio::TallTwoByThree) => { + Some(RouterAspectRatio::WideThreeByTwo) | Some(RouterAspectRatio::WideFiveByFour) + | Some(RouterAspectRatio::TallFourByFive) | Some(RouterAspectRatio::TallTwoByThree) => { Ok(Some(Seedance20Ratio::Adaptive)) } } } fn plan_resolution( - resolution: Option, + resolution: Option, _strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { match resolution { None => Ok(None), - Some(CommonResolution::FourEightyP) => Ok(Some(Seedance20Resolution::FourEightyP)), - Some(CommonResolution::SevenTwentyP) => Ok(Some(Seedance20Resolution::SevenTwentyP)), - Some(CommonResolution::TenEightyP) => Ok(Some(Seedance20Resolution::TenEightyP)), - Some(CommonResolution::HalfK) | Some(CommonResolution::OneK) => Ok(Some(Seedance20Resolution::FourEightyP)), - Some(CommonResolution::TwoK) | Some(CommonResolution::ThreeK) | Some(CommonResolution::FourK) => { + Some(RouterResolution::FourEightyP) => Ok(Some(Seedance20Resolution::FourEightyP)), + Some(RouterResolution::SevenTwentyP) => Ok(Some(Seedance20Resolution::SevenTwentyP)), + Some(RouterResolution::TenEightyP) => Ok(Some(Seedance20Resolution::TenEightyP)), + Some(RouterResolution::HalfK) | Some(RouterResolution::OneK) => Ok(Some(Seedance20Resolution::FourEightyP)), + Some(RouterResolution::TwoK) | Some(RouterResolution::ThreeK) | Some(RouterResolution::FourK) => { Ok(Some(Seedance20Resolution::TenEightyP)) } } @@ -141,12 +141,12 @@ mod tests { }; use tokens::tokens::media_files::MediaFileToken; - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::api::video_list_ref::VideoListRef; use crate::api::audio_list_ref::AudioListRef; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; @@ -194,37 +194,37 @@ mod tests { #[test] fn landscape_16x9() { - let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(CommonAspectRatio::WideSixteenByNine); })); + let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(RouterAspectRatio::WideSixteenByNine); })); assert_eq!(req.request.ratio, Some(Seedance20Ratio::Landscape16x9)); } #[test] fn portrait_9x16() { - let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(CommonAspectRatio::TallNineBySixteen); })); + let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(RouterAspectRatio::TallNineBySixteen); })); assert_eq!(req.request.ratio, Some(Seedance20Ratio::Portrait9x16)); } #[test] fn square() { - let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(CommonAspectRatio::Square); })); + let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(RouterAspectRatio::Square); })); assert_eq!(req.request.ratio, Some(Seedance20Ratio::Square)); } #[test] fn four_by_three() { - let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(CommonAspectRatio::WideFourByThree); })); + let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(RouterAspectRatio::WideFourByThree); })); assert_eq!(req.request.ratio, Some(Seedance20Ratio::Standard4x3)); } #[test] fn unsupported_maps_to_adaptive() { - let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(CommonAspectRatio::WideThreeByTwo); })); + let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(RouterAspectRatio::WideThreeByTwo); })); assert_eq!(req.request.ratio, Some(Seedance20Ratio::Adaptive)); } #[test] fn auto_maps_to_none() { - let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(CommonAspectRatio::Auto); })); + let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(RouterAspectRatio::Auto); })); assert_eq!(req.request.ratio, None); } } @@ -234,19 +234,19 @@ mod tests { #[test] fn res_480p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::FourEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::FourEightyP); })); assert_eq!(req.request.resolution, Some(Seedance20Resolution::FourEightyP)); } #[test] fn res_720p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::SevenTwentyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::SevenTwentyP); })); assert_eq!(req.request.resolution, Some(Seedance20Resolution::SevenTwentyP)); } #[test] fn res_1080p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::TenEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::TenEightyP); })); assert_eq!(req.request.resolution, Some(Seedance20Resolution::TenEightyP)); } @@ -316,8 +316,8 @@ mod tests { fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0Ultra, - provider: Provider::GmiCloud, + model: RouterVideoModel::Seedance2p0Ultra, + provider: RouterProvider::GmiCloud, duration_seconds: Some(5), video_batch_count: Some(1), ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_g/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_g/cost.rs index 3da990c5a7..768dfd51ca 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_g/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_g/cost.rs @@ -29,9 +29,9 @@ impl GmiCloudSeedance2p0UltraCostState { #[cfg(test)] mod tests { - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; mod pricing_720p { @@ -50,7 +50,7 @@ mod tests { #[test] fn explicit_720p_5s() { - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5), 26); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5), 26); } } @@ -59,17 +59,17 @@ mod tests { #[test] fn p480_5s() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5), 12); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5), 12); } #[test] fn p480_10s() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 10), 24); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 10), 24); } #[test] fn p480_15s() { - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 15), 36); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 15), 36); } } @@ -78,17 +78,17 @@ mod tests { #[test] fn p1080_5s() { - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 5), 58); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 5), 58); } #[test] fn p1080_10s() { - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 10), 116); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 10), 116); } #[test] fn p1080_15s() { - assert_eq!(cost_cents(Some(CommonResolution::TenEightyP), 15), 174); + assert_eq!(cost_cents(Some(RouterResolution::TenEightyP), 15), 174); } } @@ -97,9 +97,9 @@ mod tests { #[test] fn higher_resolution_costs_more() { - let c480 = cost_cents(Some(CommonResolution::FourEightyP), 10); - let c720 = cost_cents(Some(CommonResolution::SevenTwentyP), 10); - let c1080 = cost_cents(Some(CommonResolution::TenEightyP), 10); + let c480 = cost_cents(Some(RouterResolution::FourEightyP), 10); + let c720 = cost_cents(Some(RouterResolution::SevenTwentyP), 10); + let c1080 = cost_cents(Some(RouterResolution::TenEightyP), 10); assert!(c480 < c720, "480p ({c480}) should be < 720p ({c720})"); assert!(c720 < c1080, "720p ({c720}) should be < 1080p ({c1080})"); } @@ -114,10 +114,10 @@ mod tests { } } - fn cost_cents(resolution: Option, duration_seconds: u16) -> u64 { + fn cost_cents(resolution: Option, duration_seconds: u16) -> u64 { let builder = GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0Ultra, - provider: Provider::GmiCloud, + model: RouterVideoModel::Seedance2p0Ultra, + provider: RouterProvider::GmiCloud, resolution, duration_seconds: Some(duration_seconds), video_batch_count: Some(1), diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_g/request.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_g/request.rs index 4dbdfedbbb..cce5a41dbc 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_g/request.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/gmicloud/seedance_2p0_g/request.rs @@ -26,11 +26,11 @@ impl GmiCloudSeedance2p0UltraRequestState { #[cfg(test)] mod tests { - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::client::router_client::RouterClient; use crate::client::router_gmicloud_client::RouterGmiCloudClient; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; @@ -44,8 +44,8 @@ mod tests { async fn test_text_to_video_720p() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A corgi running through a field of wildflowers at sunset.".to_string()), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), - resolution: Some(CommonResolution::SevenTwentyP), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), + resolution: Some(RouterResolution::SevenTwentyP), duration_seconds: Some(5), ..gmicloud_builder() }).await; @@ -58,7 +58,7 @@ mod tests { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("The dog starts running and splashing in the lake.".to_string()), start_frame: Some(ImageRef::Url(JUNO_AT_LAKE_IMAGE_URL.to_string())), - resolution: Some(CommonResolution::FourEightyP), + resolution: Some(RouterResolution::FourEightyP), duration_seconds: Some(5), ..gmicloud_builder() }).await; @@ -67,8 +67,8 @@ mod tests { fn gmicloud_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0Ultra, - provider: Provider::GmiCloud, + model: RouterVideoModel::Seedance2p0Ultra, + provider: RouterProvider::GmiCloud, video_batch_count: Some(1), ..Default::default() } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/grok_api/grok_imagine_video/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/grok_api/grok_imagine_video/build.rs index 6bfc1cf425..af36b91080 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/grok_api/grok_imagine_video/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/grok_api/grok_imagine_video/build.rs @@ -8,8 +8,8 @@ use grok_api_client::api::types::video_types::video_aspect_ratio::VideoAspectRat use grok_api_client::api::types::video_types::video_resolution::VideoResolution as GrokResolution; use crate::api::audio_list_ref::AudioListRef; -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_resolution::CommonResolution; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_resolution::RouterResolution; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; use crate::api::video_list_ref::VideoListRef; @@ -89,59 +89,59 @@ pub fn build_grok_api_grok_imagine_video( // ── Field planners ── fn plan_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, _strategy: RequestMismatchMitigationStrategy, ) -> Option { // xAI supports exactly: 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3. // Auto / unsupported ratios fall back to the closest match (or None → xAI default 16:9). match aspect_ratio { None - | Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto3k) - | Some(CommonAspectRatio::Auto4k) => None, + | Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto3k) + | Some(RouterAspectRatio::Auto4k) => None, - Some(CommonAspectRatio::Square) | Some(CommonAspectRatio::SquareHd) => { + Some(RouterAspectRatio::Square) | Some(RouterAspectRatio::SquareHd) => { Some(GrokAspectRatio::Square) } - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => { + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => { Some(GrokAspectRatio::Landscape16x9) } - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => { + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => { Some(GrokAspectRatio::Portrait9x16) } - Some(CommonAspectRatio::WideFourByThree) => Some(GrokAspectRatio::Landscape4x3), - Some(CommonAspectRatio::TallThreeByFour) => Some(GrokAspectRatio::Portrait3x4), + Some(RouterAspectRatio::WideFourByThree) => Some(GrokAspectRatio::Landscape4x3), + Some(RouterAspectRatio::TallThreeByFour) => Some(GrokAspectRatio::Portrait3x4), - Some(CommonAspectRatio::WideThreeByTwo) => Some(GrokAspectRatio::Landscape3x2), - Some(CommonAspectRatio::TallTwoByThree) => Some(GrokAspectRatio::Portrait2x3), + Some(RouterAspectRatio::WideThreeByTwo) => Some(GrokAspectRatio::Landscape3x2), + Some(RouterAspectRatio::TallTwoByThree) => Some(GrokAspectRatio::Portrait2x3), // No exact xAI match — pick the closest cardinal direction. - Some(CommonAspectRatio::WideFiveByFour) - | Some(CommonAspectRatio::WideTwentyOneByNine) => Some(GrokAspectRatio::Landscape16x9), - Some(CommonAspectRatio::TallFourByFive) - | Some(CommonAspectRatio::TallNineByTwentyOne) => Some(GrokAspectRatio::Portrait9x16), + Some(RouterAspectRatio::WideFiveByFour) + | Some(RouterAspectRatio::WideTwentyOneByNine) => Some(GrokAspectRatio::Landscape16x9), + Some(RouterAspectRatio::TallFourByFive) + | Some(RouterAspectRatio::TallNineByTwentyOne) => Some(GrokAspectRatio::Portrait9x16), } } fn plan_resolution( - resolution: Option, + resolution: Option, _strategy: RequestMismatchMitigationStrategy, ) -> Option { // Grok supports 480p and 720p only (1080p is downsized to 720p per xAI docs). match resolution { None => None, - Some(CommonResolution::FourEightyP) => Some(GrokResolution::FourEightyP), - Some(CommonResolution::SevenTwentyP) => Some(GrokResolution::SevenTwentyP), + Some(RouterResolution::FourEightyP) => Some(GrokResolution::FourEightyP), + Some(RouterResolution::SevenTwentyP) => Some(GrokResolution::SevenTwentyP), // Higher-than-720p requests get clamped to 720p (Grok's cap). - Some(CommonResolution::TenEightyP) - | Some(CommonResolution::TwoK) - | Some(CommonResolution::ThreeK) - | Some(CommonResolution::FourK) => Some(GrokResolution::SevenTwentyP), + Some(RouterResolution::TenEightyP) + | Some(RouterResolution::TwoK) + | Some(RouterResolution::ThreeK) + | Some(RouterResolution::FourK) => Some(GrokResolution::SevenTwentyP), // Lower-than-480p requests get bumped to 480p (Grok's floor). - Some(CommonResolution::HalfK) | Some(CommonResolution::OneK) => { + Some(RouterResolution::HalfK) | Some(RouterResolution::OneK) => { Some(GrokResolution::FourEightyP) } } @@ -225,12 +225,12 @@ mod tests { use super::*; use tokens::tokens::media_files::MediaFileToken; - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::api::video_list_ref::VideoListRef; use crate::api::audio_list_ref::AudioListRef; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; @@ -280,56 +280,56 @@ mod tests { #[test] fn square() { - let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(CommonAspectRatio::Square); })); + let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(RouterAspectRatio::Square); })); assert_eq!(req.request.aspect_ratio, Some(GrokAspectRatio::Square)); } #[test] fn landscape_16x9() { - let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(CommonAspectRatio::WideSixteenByNine); })); + let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(RouterAspectRatio::WideSixteenByNine); })); assert_eq!(req.request.aspect_ratio, Some(GrokAspectRatio::Landscape16x9)); } #[test] fn portrait_9x16() { - let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(CommonAspectRatio::TallNineBySixteen); })); + let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(RouterAspectRatio::TallNineBySixteen); })); assert_eq!(req.request.aspect_ratio, Some(GrokAspectRatio::Portrait9x16)); } #[test] fn landscape_4x3() { - let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(CommonAspectRatio::WideFourByThree); })); + let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(RouterAspectRatio::WideFourByThree); })); assert_eq!(req.request.aspect_ratio, Some(GrokAspectRatio::Landscape4x3)); } #[test] fn portrait_3x4() { - let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(CommonAspectRatio::TallThreeByFour); })); + let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(RouterAspectRatio::TallThreeByFour); })); assert_eq!(req.request.aspect_ratio, Some(GrokAspectRatio::Portrait3x4)); } #[test] fn landscape_3x2() { - let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(CommonAspectRatio::WideThreeByTwo); })); + let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(RouterAspectRatio::WideThreeByTwo); })); assert_eq!(req.request.aspect_ratio, Some(GrokAspectRatio::Landscape3x2)); } #[test] fn portrait_2x3() { - let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(CommonAspectRatio::TallTwoByThree); })); + let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(RouterAspectRatio::TallTwoByThree); })); assert_eq!(req.request.aspect_ratio, Some(GrokAspectRatio::Portrait2x3)); } #[test] fn auto_maps_to_none() { - let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(CommonAspectRatio::Auto); })); + let req = unwrap_request(make_builder(|b| { b.aspect_ratio = Some(RouterAspectRatio::Auto); })); assert_eq!(req.request.aspect_ratio, None); } #[test] fn unsupported_wide_falls_back_to_16x9() { let req = unwrap_request(make_builder(|b| { - b.aspect_ratio = Some(CommonAspectRatio::WideTwentyOneByNine); + b.aspect_ratio = Some(RouterAspectRatio::WideTwentyOneByNine); })); assert_eq!(req.request.aspect_ratio, Some(GrokAspectRatio::Landscape16x9)); } @@ -337,7 +337,7 @@ mod tests { #[test] fn unsupported_tall_falls_back_to_9x16() { let req = unwrap_request(make_builder(|b| { - b.aspect_ratio = Some(CommonAspectRatio::TallNineByTwentyOne); + b.aspect_ratio = Some(RouterAspectRatio::TallNineByTwentyOne); })); assert_eq!(req.request.aspect_ratio, Some(GrokAspectRatio::Portrait9x16)); } @@ -350,31 +350,31 @@ mod tests { #[test] fn res_480p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::FourEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::FourEightyP); })); assert_eq!(req.request.resolution, Some(GrokResolution::FourEightyP)); } #[test] fn res_720p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::SevenTwentyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::SevenTwentyP); })); assert_eq!(req.request.resolution, Some(GrokResolution::SevenTwentyP)); } #[test] fn res_1080p_clamps_to_720p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::TenEightyP); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::TenEightyP); })); assert_eq!(req.request.resolution, Some(GrokResolution::SevenTwentyP)); } #[test] fn res_4k_clamps_to_720p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::FourK); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::FourK); })); assert_eq!(req.request.resolution, Some(GrokResolution::SevenTwentyP)); } #[test] fn res_1k_bumps_to_480p() { - let req = unwrap_request(make_builder(|b| { b.resolution = Some(CommonResolution::OneK); })); + let req = unwrap_request(make_builder(|b| { b.resolution = Some(RouterResolution::OneK); })); assert_eq!(req.request.resolution, Some(GrokResolution::FourEightyP)); } @@ -507,8 +507,8 @@ mod tests { ])); b.reference_videos = Some(VideoListRef::Urls(vec!["https://example.com/v.mp4".to_string()])); b.reference_audio = Some(AudioListRef::Urls(vec!["https://example.com/a.wav".to_string()])); - b.resolution = Some(CommonResolution::SevenTwentyP); - b.aspect_ratio = Some(CommonAspectRatio::WideSixteenByNine); + b.resolution = Some(RouterResolution::SevenTwentyP); + b.aspect_ratio = Some(RouterAspectRatio::WideSixteenByNine); b.duration_seconds = Some(8); })); // Kept: prompt + start_frame + resolution + aspect_ratio + duration. @@ -529,8 +529,8 @@ mod tests { fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::GrokImagineVideo, - provider: Provider::GrokApi, + model: RouterVideoModel::GrokImagineVideo, + provider: RouterProvider::GrokApi, duration_seconds: Some(5), video_batch_count: Some(1), ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/grok_api/grok_imagine_video/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/grok_api/grok_imagine_video/cost.rs index e6252276b7..2089acbf5f 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/grok_api/grok_imagine_video/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/grok_api/grok_imagine_video/cost.rs @@ -34,12 +34,12 @@ impl GrokApiGrokImagineVideoCostState { #[cfg(test)] mod tests { - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; // Pricing reference (from grok_api_client/cost.rs, mirrors xAI's table): @@ -55,19 +55,19 @@ mod tests { #[test] fn five_s_no_image_ref() { // 70 × 5 = 350 mills → 35¢ - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 5, None, None), 35); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 5, None, None), 35); } #[test] fn ten_s_no_image_ref() { // 70 × 10 = 700 mills → 70¢ - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 10, None, None), 70); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 10, None, None), 70); } #[test] fn fifteen_s_no_image_ref() { // 70 × 15 = 1050 mills → 105¢ - assert_eq!(cost_cents(Some(CommonResolution::SevenTwentyP), 15, None, None), 105); + assert_eq!(cost_cents(Some(RouterResolution::SevenTwentyP), 15, None, None), 105); } } @@ -77,19 +77,19 @@ mod tests { #[test] fn five_s_no_image_ref() { // 50 × 5 = 250 mills → 25¢ - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 5, None, None), 25); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 5, None, None), 25); } #[test] fn ten_s_no_image_ref() { // 50 × 10 = 500 mills → 50¢ - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 10, None, None), 50); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 10, None, None), 50); } #[test] fn fifteen_s_no_image_ref() { // 50 × 15 = 750 mills → 75¢ - assert_eq!(cost_cents(Some(CommonResolution::FourEightyP), 15, None, None), 75); + assert_eq!(cost_cents(Some(RouterResolution::FourEightyP), 15, None, None), 75); } } @@ -100,7 +100,7 @@ mod tests { fn single_start_frame_image_adds_2_mills() { // 5s @ 720p output 350 mills + 1 input image 2 mills = 352 mills → 36¢ (ceil) let cents = cost_cents( - Some(CommonResolution::SevenTwentyP), + Some(RouterResolution::SevenTwentyP), 5, Some(ImageRef::Url("https://example.com/a.png".to_string())), None, @@ -112,7 +112,7 @@ mod tests { fn three_reference_images_adds_6_mills() { // 5s @ 720p output 350 mills + 3 input images 6 mills = 356 mills → 36¢ (ceil) let cents = cost_cents( - Some(CommonResolution::SevenTwentyP), + Some(RouterResolution::SevenTwentyP), 5, None, Some(ImageListRef::Urls(vec![ @@ -130,16 +130,16 @@ mod tests { #[test] fn higher_resolution_costs_more() { - let p480 = cost_cents(Some(CommonResolution::FourEightyP), 10, None, None); - let p720 = cost_cents(Some(CommonResolution::SevenTwentyP), 10, None, None); + let p480 = cost_cents(Some(RouterResolution::FourEightyP), 10, None, None); + let p720 = cost_cents(Some(RouterResolution::SevenTwentyP), 10, None, None); assert!(p480 < p720, "480p ({p480}) should be < 720p ({p720})"); } #[test] fn longer_duration_costs_more() { - let c5 = cost_cents(Some(CommonResolution::SevenTwentyP), 5, None, None); - let c10 = cost_cents(Some(CommonResolution::SevenTwentyP), 10, None, None); - let c15 = cost_cents(Some(CommonResolution::SevenTwentyP), 15, None, None); + let c5 = cost_cents(Some(RouterResolution::SevenTwentyP), 5, None, None); + let c10 = cost_cents(Some(RouterResolution::SevenTwentyP), 10, None, None); + let c15 = cost_cents(Some(RouterResolution::SevenTwentyP), 15, None, None); assert!(c5 < c10); assert!(c10 < c15); } @@ -147,30 +147,30 @@ mod tests { #[test] fn one_k_request_clamps_to_480p_pricing() { // OneK gets bumped to 480p in plan_resolution, so cost equals 480p cost. - let one_k = cost_cents(Some(CommonResolution::OneK), 10, None, None); - let p480 = cost_cents(Some(CommonResolution::FourEightyP), 10, None, None); + let one_k = cost_cents(Some(RouterResolution::OneK), 10, None, None); + let p480 = cost_cents(Some(RouterResolution::FourEightyP), 10, None, None); assert_eq!(one_k, p480); } #[test] fn ten_eighty_p_request_clamps_to_720p_pricing() { // TenEightyP gets clamped to 720p in plan_resolution. - let p1080 = cost_cents(Some(CommonResolution::TenEightyP), 10, None, None); - let p720 = cost_cents(Some(CommonResolution::SevenTwentyP), 10, None, None); + let p1080 = cost_cents(Some(RouterResolution::TenEightyP), 10, None, None); + let p720 = cost_cents(Some(RouterResolution::SevenTwentyP), 10, None, None); assert_eq!(p1080, p720); } } fn cost_cents( - resolution: Option, + resolution: Option, duration_seconds: u16, start_frame: Option, reference_images: Option, ) -> u64 { let builder = GenerateVideoRequestBuilder { - model: CommonVideoModel::GrokImagineVideo, - provider: Provider::GrokApi, - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + model: RouterVideoModel::GrokImagineVideo, + provider: RouterProvider::GrokApi, + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), resolution, duration_seconds: Some(duration_seconds), video_batch_count: Some(1), diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/grok_api/grok_imagine_video/request.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/grok_api/grok_imagine_video/request.rs index 5bfa903092..44ab7b8c85 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/grok_api/grok_imagine_video/request.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/grok_api/grok_imagine_video/request.rs @@ -41,11 +41,11 @@ mod tests { use grok_api_client::creds::grok_api_key::GrokApiKey; use test_data::web::image_urls::JUNO_AT_LAKE_IMAGE_URL; - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::client::router_client::RouterClient; use crate::client::router_grok_api_client::RouterGrokApiClient; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; @@ -57,8 +57,8 @@ mod tests { async fn test_text_to_video_720p() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A glowing crystal rocket launching from Mars.".to_string()), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), - resolution: Some(CommonResolution::SevenTwentyP), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), + resolution: Some(RouterResolution::SevenTwentyP), duration_seconds: Some(5), ..grok_builder() }).await; @@ -71,7 +71,7 @@ mod tests { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("The dog leaps into the lake and splashes around.".to_string()), start_frame: Some(ImageRef::Url(JUNO_AT_LAKE_IMAGE_URL.to_string())), - resolution: Some(CommonResolution::FourEightyP), + resolution: Some(RouterResolution::FourEightyP), duration_seconds: Some(5), ..grok_builder() }).await; @@ -80,8 +80,8 @@ mod tests { fn grok_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::GrokImagineVideo, - provider: Provider::GrokApi, + model: RouterVideoModel::GrokImagineVideo, + provider: RouterProvider::GrokApi, video_batch_count: Some(1), ..Default::default() } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/happy_horse_1p0/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/happy_horse_1p0/build.rs index 5021f0656b..11cee8ab02 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/happy_horse_1p0/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/happy_horse_1p0/build.rs @@ -3,8 +3,8 @@ use seedance2pro_client::generate::video::generate_happy_horse_1p0::{ KinoviHappyHorse1p0OutputResolution, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_resolution::CommonResolution; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_resolution::RouterResolution; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; use crate::errors::client_error::ClientError; @@ -46,26 +46,26 @@ fn do_build(mut builder: GenerateVideoRequestBuilder) -> Result, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { match aspect_ratio { None - | Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto4k) => Ok(None), + | Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto4k) => Ok(None), - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => { + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => { Ok(Some(KinoviHappyHorse1p0AspectRatio::Landscape16x9)) } - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => { + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => { Ok(Some(KinoviHappyHorse1p0AspectRatio::Portrait9x16)) } - Some(CommonAspectRatio::Square) | Some(CommonAspectRatio::SquareHd) => { + Some(RouterAspectRatio::Square) | Some(RouterAspectRatio::SquareHd) => { Ok(Some(KinoviHappyHorse1p0AspectRatio::Square1x1)) } - Some(CommonAspectRatio::WideFourByThree) => Ok(Some(KinoviHappyHorse1p0AspectRatio::Landscape4x3)), - Some(CommonAspectRatio::TallThreeByFour) => Ok(Some(KinoviHappyHorse1p0AspectRatio::Portrait3x4)), + Some(RouterAspectRatio::WideFourByThree) => Ok(Some(KinoviHappyHorse1p0AspectRatio::Landscape4x3)), + Some(RouterAspectRatio::TallThreeByFour) => Ok(Some(KinoviHappyHorse1p0AspectRatio::Portrait3x4)), Some(unsupported) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -82,28 +82,28 @@ fn plan_aspect_ratio( } } -fn nearest_aspect_ratio(aspect_ratio: CommonAspectRatio) -> KinoviHappyHorse1p0AspectRatio { +fn nearest_aspect_ratio(aspect_ratio: RouterAspectRatio) -> KinoviHappyHorse1p0AspectRatio { match aspect_ratio { - CommonAspectRatio::WideFiveByFour => KinoviHappyHorse1p0AspectRatio::Landscape4x3, - CommonAspectRatio::WideThreeByTwo => KinoviHappyHorse1p0AspectRatio::Landscape4x3, - CommonAspectRatio::WideTwentyOneByNine => KinoviHappyHorse1p0AspectRatio::Landscape16x9, - CommonAspectRatio::TallFourByFive => KinoviHappyHorse1p0AspectRatio::Portrait3x4, - CommonAspectRatio::TallTwoByThree => KinoviHappyHorse1p0AspectRatio::Portrait3x4, - CommonAspectRatio::TallNineByTwentyOne => KinoviHappyHorse1p0AspectRatio::Portrait9x16, + RouterAspectRatio::WideFiveByFour => KinoviHappyHorse1p0AspectRatio::Landscape4x3, + RouterAspectRatio::WideThreeByTwo => KinoviHappyHorse1p0AspectRatio::Landscape4x3, + RouterAspectRatio::WideTwentyOneByNine => KinoviHappyHorse1p0AspectRatio::Landscape16x9, + RouterAspectRatio::TallFourByFive => KinoviHappyHorse1p0AspectRatio::Portrait3x4, + RouterAspectRatio::TallTwoByThree => KinoviHappyHorse1p0AspectRatio::Portrait3x4, + RouterAspectRatio::TallNineByTwentyOne => KinoviHappyHorse1p0AspectRatio::Portrait9x16, _ => KinoviHappyHorse1p0AspectRatio::Square1x1, } } // Happy Horse supports 720p and 1080p only (no 480p). fn plan_output_resolution( - resolution: Option, + resolution: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { match resolution { None => Ok(None), - Some(CommonResolution::SevenTwentyP) => Ok(Some(KinoviHappyHorse1p0OutputResolution::SevenTwentyP)), - Some(CommonResolution::TenEightyP) => Ok(Some(KinoviHappyHorse1p0OutputResolution::TenEightyP)), + Some(RouterResolution::SevenTwentyP) => Ok(Some(KinoviHappyHorse1p0OutputResolution::SevenTwentyP)), + Some(RouterResolution::TenEightyP) => Ok(Some(KinoviHappyHorse1p0OutputResolution::TenEightyP)), Some(unsupported) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { @@ -163,7 +163,7 @@ mod tests { use tokens::tokens::media_files::MediaFileToken; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; @@ -241,7 +241,7 @@ mod tests { #[test] fn aspect_ratio_wide() { let builder = GenerateVideoRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..happy_horse_builder() }; let draft = unwrap_draft(build_kinovi_happy_horse_1p0(builder)); @@ -251,7 +251,7 @@ mod tests { #[test] fn aspect_ratio_tall() { let builder = GenerateVideoRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::TallNineBySixteen), + aspect_ratio: Some(RouterAspectRatio::TallNineBySixteen), ..happy_horse_builder() }; let draft = unwrap_draft(build_kinovi_happy_horse_1p0(builder)); @@ -261,7 +261,7 @@ mod tests { #[test] fn aspect_ratio_square() { let builder = GenerateVideoRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Square), + aspect_ratio: Some(RouterAspectRatio::Square), ..happy_horse_builder() }; let draft = unwrap_draft(build_kinovi_happy_horse_1p0(builder)); @@ -278,7 +278,7 @@ mod tests { #[test] fn aspect_ratio_auto_defaults_to_none() { let builder = GenerateVideoRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Auto), + aspect_ratio: Some(RouterAspectRatio::Auto), ..happy_horse_builder() }; let draft = unwrap_draft(build_kinovi_happy_horse_1p0(builder)); @@ -288,7 +288,7 @@ mod tests { #[test] fn unsupported_aspect_ratio_falls_back() { let builder = GenerateVideoRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::WideFiveByFour), + aspect_ratio: Some(RouterAspectRatio::WideFiveByFour), ..happy_horse_builder() }; let draft = unwrap_draft(build_kinovi_happy_horse_1p0(builder)); @@ -298,7 +298,7 @@ mod tests { #[test] fn unsupported_aspect_ratio_errors_out() { let builder = GenerateVideoRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::WideFiveByFour), + aspect_ratio: Some(RouterAspectRatio::WideFiveByFour), request_mismatch_mitigation_strategy: RequestMismatchMitigationStrategy::ErrorOut, ..happy_horse_builder() }; @@ -314,7 +314,7 @@ mod tests { #[test] fn resolution_720p() { let builder = GenerateVideoRequestBuilder { - resolution: Some(CommonResolution::SevenTwentyP), + resolution: Some(RouterResolution::SevenTwentyP), ..happy_horse_builder() }; let draft = unwrap_draft(build_kinovi_happy_horse_1p0(builder)); @@ -324,7 +324,7 @@ mod tests { #[test] fn resolution_1080p() { let builder = GenerateVideoRequestBuilder { - resolution: Some(CommonResolution::TenEightyP), + resolution: Some(RouterResolution::TenEightyP), ..happy_horse_builder() }; let draft = unwrap_draft(build_kinovi_happy_horse_1p0(builder)); @@ -341,7 +341,7 @@ mod tests { #[test] fn unsupported_resolution_error_out() { let builder = GenerateVideoRequestBuilder { - resolution: Some(CommonResolution::FourEightyP), + resolution: Some(RouterResolution::FourEightyP), request_mismatch_mitigation_strategy: RequestMismatchMitigationStrategy::ErrorOut, ..happy_horse_builder() }; @@ -351,7 +351,7 @@ mod tests { #[test] fn unsupported_resolution_upgrades() { let builder = GenerateVideoRequestBuilder { - resolution: Some(CommonResolution::FourK), + resolution: Some(RouterResolution::FourK), request_mismatch_mitigation_strategy: RequestMismatchMitigationStrategy::PayMoreUpgrade, ..happy_horse_builder() }; @@ -362,7 +362,7 @@ mod tests { #[test] fn unsupported_resolution_downgrades() { let builder = GenerateVideoRequestBuilder { - resolution: Some(CommonResolution::FourK), + resolution: Some(RouterResolution::FourK), request_mismatch_mitigation_strategy: RequestMismatchMitigationStrategy::PayLessDowngrade, ..happy_horse_builder() }; @@ -418,8 +418,8 @@ mod tests { fn full_request_all_fields() { let builder = GenerateVideoRequestBuilder { prompt: Some("full test".to_string()), - aspect_ratio: Some(CommonAspectRatio::TallNineBySixteen), - resolution: Some(CommonResolution::TenEightyP), + aspect_ratio: Some(RouterAspectRatio::TallNineBySixteen), + resolution: Some(RouterResolution::TenEightyP), duration_seconds: Some(10), video_batch_count: Some(4), start_frame: Some(ImageRef::Url("https://example.com/start.jpg".to_string())), @@ -441,7 +441,7 @@ mod tests { fn happy_horse_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - provider: Provider::Seedance2Pro, + provider: RouterProvider::Seedance2Pro, prompt: Some("a cat dancing".to_string()), duration_seconds: Some(5), video_batch_count: Some(1), diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/happy_horse_1p0/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/happy_horse_1p0/cost.rs index a983d56421..5ee3c7f2fb 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/happy_horse_1p0/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/happy_horse_1p0/cost.rs @@ -60,8 +60,8 @@ impl KinoviHappyHorse1p0CostState { #[cfg(test)] mod tests { use super::*; - use crate::api::common_resolution::CommonResolution; - use crate::api::provider::Provider; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_provider::RouterProvider; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use crate::generate::generate_video_v2::video_generation_draft::VideoGenerationDraftRequest; use crate::generate::generate_video_v2::video_generation_draft_or_request::VideoGenerationDraftOrRequest; @@ -212,7 +212,7 @@ mod tests { #[test] fn from_draft_1080p_batch_4() { - let draft = make_draft(5, 4, Some(CommonResolution::TenEightyP)); + let draft = make_draft(5, 4, Some(RouterResolution::TenEightyP)); let cost = KinoviHappyHorse1p0CostState::from_draft(&draft); assert_eq!(cost.estimate_cost().cost_in_credits, Some(330 * 4)); } @@ -248,7 +248,7 @@ mod tests { #[test] fn draft_and_request_produce_same_cost() { - let draft = make_draft(5, 1, Some(CommonResolution::SevenTwentyP)); + let draft = make_draft(5, 1, Some(RouterResolution::SevenTwentyP)); let req = make_request_state( Some(KinoviHappyHorse1p0OutputResolution::SevenTwentyP), 5, None, ); @@ -260,7 +260,7 @@ mod tests { #[test] fn draft_and_request_produce_same_cost_1080p_batch_2() { - let draft = make_draft(10, 2, Some(CommonResolution::TenEightyP)); + let draft = make_draft(10, 2, Some(RouterResolution::TenEightyP)); let req = make_request_state( Some(KinoviHappyHorse1p0OutputResolution::TenEightyP), 10, Some(KinoviHappyHorse1p0BatchCount::Two), @@ -306,12 +306,12 @@ mod tests { fn make_draft( duration_seconds: u16, video_batch_count: u16, - resolution: Option, + resolution: Option, ) -> KinoviHappyHorse1p0DraftState { - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_video_model::RouterVideoModel; let builder = GenerateVideoRequestBuilder { - model: CommonVideoModel::HappyHorse1p0, - provider: Provider::Seedance2Pro, + model: RouterVideoModel::HappyHorse1p0, + provider: RouterProvider::Seedance2Pro, resolution, duration_seconds: Some(duration_seconds), video_batch_count: Some(video_batch_count), diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/happy_horse_1p0/request.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/happy_horse_1p0/request.rs index 88d847bac8..186d5a25fe 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/happy_horse_1p0/request.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/happy_horse_1p0/request.rs @@ -41,11 +41,11 @@ mod tests { use tokens::tokens::media_files::MediaFileToken; - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::client::router_client::RouterClient; use crate::client::router_seedance2pro_client::RouterSeedance2ProClient; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; @@ -63,7 +63,7 @@ mod tests { async fn landscape() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A corgi running through a field of wildflowers at sunset.".to_string()), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..happy_horse_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Seedance2Pro(_))); @@ -75,7 +75,7 @@ mod tests { async fn portrait() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A cat sitting on a windowsill watching rain.".to_string()), - aspect_ratio: Some(CommonAspectRatio::TallNineBySixteen), + aspect_ratio: Some(RouterAspectRatio::TallNineBySixteen), ..happy_horse_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Seedance2Pro(_))); @@ -87,7 +87,7 @@ mod tests { async fn square() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A hummingbird hovering near a flower.".to_string()), - aspect_ratio: Some(CommonAspectRatio::Square), + aspect_ratio: Some(RouterAspectRatio::Square), ..happy_horse_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Seedance2Pro(_))); @@ -103,7 +103,7 @@ mod tests { async fn res_720p() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A golden retriever catching a frisbee on the beach.".to_string()), - resolution: Some(CommonResolution::SevenTwentyP), + resolution: Some(RouterResolution::SevenTwentyP), ..happy_horse_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Seedance2Pro(_))); @@ -115,7 +115,7 @@ mod tests { async fn res_1080p() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A fox walking through a snowy forest.".to_string()), - resolution: Some(CommonResolution::TenEightyP), + resolution: Some(RouterResolution::TenEightyP), ..happy_horse_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Seedance2Pro(_))); @@ -131,7 +131,7 @@ mod tests { async fn text_to_video() { let response = run_pipeline(GenerateVideoRequestBuilder { prompt: Some("A whale breaching in the open ocean at dawn, cinematic.".to_string()), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..happy_horse_builder() }).await; assert!(matches!(response, GenerateVideoResponse::Seedance2Pro(_))); @@ -149,7 +149,7 @@ mod tests { let response = run_pipeline_with_media_map(GenerateVideoRequestBuilder { prompt: Some("The dog watches the sunset over the lake.".to_string()), start_frame: Some(ImageRef::MediaFileToken(start_token)), - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..happy_horse_builder() }, media_map).await; assert!(matches!(response, GenerateVideoResponse::Seedance2Pro(_))); @@ -167,8 +167,8 @@ mod tests { let response = run_pipeline_with_media_map(GenerateVideoRequestBuilder { prompt: Some("A dragon soaring over the mountains.".to_string()), start_frame: Some(ImageRef::MediaFileToken(start_token)), - aspect_ratio: Some(CommonAspectRatio::Square), - resolution: Some(CommonResolution::TenEightyP), + aspect_ratio: Some(RouterAspectRatio::Square), + resolution: Some(RouterResolution::TenEightyP), duration_seconds: Some(15), ..happy_horse_builder() }, media_map).await; @@ -181,8 +181,8 @@ mod tests { fn happy_horse_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::HappyHorse1p0, - provider: Provider::Seedance2Pro, + model: RouterVideoModel::HappyHorse1p0, + provider: RouterProvider::Seedance2Pro, duration_seconds: Some(4), video_batch_count: Some(1), ..Default::default() diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/seedance_2p0/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/seedance_2p0/build.rs index 1c79ecee76..ebbe7556b8 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/seedance_2p0/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/seedance_2p0/build.rs @@ -4,8 +4,8 @@ use seedance2pro_client::generate::video::generate_seedance_2p0::{ KinoviSeedance2p0OutputResolution as KinoviOutputResolution, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_resolution::CommonResolution; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_resolution::RouterResolution; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; use crate::errors::client_error::ClientError; @@ -55,29 +55,29 @@ fn do_build_kinovi_seedance_2p0(mut builder: GenerateVideoRequestBuilder) -> Res // All supported ratios cost the same, so PayMoreUpgrade and PayLessDowngrade both // select the nearest match rather than rounding in a specific direction. fn plan_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result { match aspect_ratio { // No preference or auto — default to landscape None - | Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto4k) => Ok(KinoviAspectRatio::Landscape16x9), + | Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto4k) => Ok(KinoviAspectRatio::Landscape16x9), // Direct mappings - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => { + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => { Ok(KinoviAspectRatio::Landscape16x9) } - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => { + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => { Ok(KinoviAspectRatio::Portrait9x16) } - Some(CommonAspectRatio::Square) | Some(CommonAspectRatio::SquareHd) => { + Some(RouterAspectRatio::Square) | Some(RouterAspectRatio::SquareHd) => { Ok(KinoviAspectRatio::Square1x1) } - Some(CommonAspectRatio::WideFourByThree) => Ok(KinoviAspectRatio::Standard4x3), - Some(CommonAspectRatio::TallThreeByFour) => Ok(KinoviAspectRatio::Portrait3x4), - Some(CommonAspectRatio::WideTwentyOneByNine) => Ok(KinoviAspectRatio::UltraWide21x9), + Some(RouterAspectRatio::WideFourByThree) => Ok(KinoviAspectRatio::Standard4x3), + Some(RouterAspectRatio::TallThreeByFour) => Ok(KinoviAspectRatio::Portrait3x4), + Some(RouterAspectRatio::WideTwentyOneByNine) => Ok(KinoviAspectRatio::UltraWide21x9), // Mismatches — apply strategy Some(unsupported) => match strategy { @@ -96,29 +96,29 @@ fn plan_aspect_ratio( } /// Pick the nearest supported aspect ratio by AR value (width / height). -fn nearest_aspect_ratio(aspect_ratio: CommonAspectRatio) -> KinoviAspectRatio { +fn nearest_aspect_ratio(aspect_ratio: RouterAspectRatio) -> KinoviAspectRatio { match aspect_ratio { - CommonAspectRatio::WideFiveByFour => KinoviAspectRatio::Standard4x3, // 1.25, nearest 1.33 - CommonAspectRatio::WideThreeByTwo => KinoviAspectRatio::Standard4x3, // 1.50, nearest 1.33 - CommonAspectRatio::TallFourByFive => KinoviAspectRatio::Portrait3x4, // 0.80, nearest 0.75 - CommonAspectRatio::TallTwoByThree => KinoviAspectRatio::Portrait3x4, // 0.67, nearest 0.75 - CommonAspectRatio::TallNineByTwentyOne => KinoviAspectRatio::Portrait9x16, // 0.43, nearest 0.56 + RouterAspectRatio::WideFiveByFour => KinoviAspectRatio::Standard4x3, // 1.25, nearest 1.33 + RouterAspectRatio::WideThreeByTwo => KinoviAspectRatio::Standard4x3, // 1.50, nearest 1.33 + RouterAspectRatio::TallFourByFive => KinoviAspectRatio::Portrait3x4, // 0.80, nearest 0.75 + RouterAspectRatio::TallTwoByThree => KinoviAspectRatio::Portrait3x4, // 0.67, nearest 0.75 + RouterAspectRatio::TallNineByTwentyOne => KinoviAspectRatio::Portrait9x16, // 0.43, nearest 0.56 _ => KinoviAspectRatio::Square1x1, } } // Seedance 2.0 Pro supports output resolutions: 480p, 720p, 1080p. fn plan_output_resolution( - resolution: Option, + resolution: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { match resolution { None => Ok(None), // Direct mappings - Some(CommonResolution::FourEightyP) => Ok(Some(KinoviOutputResolution::FourEightyP)), - Some(CommonResolution::SevenTwentyP) => Ok(Some(KinoviOutputResolution::SevenTwentyP)), - Some(CommonResolution::TenEightyP) => Ok(Some(KinoviOutputResolution::TenEightyP)), + Some(RouterResolution::FourEightyP) => Ok(Some(KinoviOutputResolution::FourEightyP)), + Some(RouterResolution::SevenTwentyP) => Ok(Some(KinoviOutputResolution::SevenTwentyP)), + Some(RouterResolution::TenEightyP) => Ok(Some(KinoviOutputResolution::TenEightyP)), // Mismatches Some(unsupported) => match strategy { @@ -130,13 +130,13 @@ fn plan_output_resolution( } RequestMismatchMitigationStrategy::PayMoreUpgrade => { Ok(Some(match unsupported { - CommonResolution::HalfK => KinoviOutputResolution::FourEightyP, + RouterResolution::HalfK => KinoviOutputResolution::FourEightyP, _ => KinoviOutputResolution::TenEightyP, })) } RequestMismatchMitigationStrategy::PayLessDowngrade => { Ok(Some(match unsupported { - CommonResolution::HalfK => KinoviOutputResolution::FourEightyP, + RouterResolution::HalfK => KinoviOutputResolution::FourEightyP, _ => KinoviOutputResolution::TenEightyP, })) } @@ -207,11 +207,11 @@ mod tests { use crate::api::audio_list_ref::AudioListRef; use crate::api::character_list_ref::CharacterListRef; - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_resolution::CommonResolution; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_resolution::RouterResolution; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::api::video_list_ref::VideoListRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; @@ -292,7 +292,7 @@ mod tests { #[test] fn aspect_ratio_wide() { let builder = GenerateVideoRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..seedance2pro_builder() }; let draft = unwrap_draft(build_kinovi_seedance_2p0(builder)); @@ -302,7 +302,7 @@ mod tests { #[test] fn aspect_ratio_tall() { let builder = GenerateVideoRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::TallNineBySixteen), + aspect_ratio: Some(RouterAspectRatio::TallNineBySixteen), ..seedance2pro_builder() }; let draft = unwrap_draft(build_kinovi_seedance_2p0(builder)); @@ -312,7 +312,7 @@ mod tests { #[test] fn aspect_ratio_square() { let builder = GenerateVideoRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Square), + aspect_ratio: Some(RouterAspectRatio::Square), ..seedance2pro_builder() }; let draft = unwrap_draft(build_kinovi_seedance_2p0(builder)); @@ -335,7 +335,7 @@ mod tests { #[test] fn resolution_480p() { let builder = GenerateVideoRequestBuilder { - resolution: Some(CommonResolution::FourEightyP), + resolution: Some(RouterResolution::FourEightyP), ..seedance2pro_builder() }; let draft = unwrap_draft(build_kinovi_seedance_2p0(builder)); @@ -345,7 +345,7 @@ mod tests { #[test] fn resolution_720p() { let builder = GenerateVideoRequestBuilder { - resolution: Some(CommonResolution::SevenTwentyP), + resolution: Some(RouterResolution::SevenTwentyP), ..seedance2pro_builder() }; let draft = unwrap_draft(build_kinovi_seedance_2p0(builder)); @@ -355,7 +355,7 @@ mod tests { #[test] fn resolution_1080p() { let builder = GenerateVideoRequestBuilder { - resolution: Some(CommonResolution::TenEightyP), + resolution: Some(RouterResolution::TenEightyP), ..seedance2pro_builder() }; let draft = unwrap_draft(build_kinovi_seedance_2p0(builder)); @@ -372,7 +372,7 @@ mod tests { #[test] fn unsupported_resolution_error_out() { let builder = GenerateVideoRequestBuilder { - resolution: Some(CommonResolution::FourK), + resolution: Some(RouterResolution::FourK), request_mismatch_mitigation_strategy: RequestMismatchMitigationStrategy::ErrorOut, ..seedance2pro_builder() }; @@ -382,7 +382,7 @@ mod tests { #[test] fn unsupported_resolution_rounds_up() { let builder = GenerateVideoRequestBuilder { - resolution: Some(CommonResolution::FourK), + resolution: Some(RouterResolution::FourK), request_mismatch_mitigation_strategy: RequestMismatchMitigationStrategy::PayMoreUpgrade, ..seedance2pro_builder() }; @@ -522,8 +522,8 @@ mod tests { fn full_request_all_fields() { let builder = GenerateVideoRequestBuilder { prompt: Some("full test".to_string()), - aspect_ratio: Some(CommonAspectRatio::TallNineBySixteen), - resolution: Some(CommonResolution::TenEightyP), + aspect_ratio: Some(RouterAspectRatio::TallNineBySixteen), + resolution: Some(RouterResolution::TenEightyP), duration_seconds: Some(10), video_batch_count: Some(4), start_frame: Some(ImageRef::Url("https://example.com/start.jpg".to_string())), @@ -557,7 +557,7 @@ mod tests { fn seedance2pro_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - provider: Provider::Seedance2Pro, + provider: RouterProvider::Seedance2Pro, prompt: Some("a cat dancing".to_string()), duration_seconds: Some(5), video_batch_count: Some(1), diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/seedance_2p0/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/seedance_2p0/cost.rs index 3807dca165..99647b045d 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/seedance_2p0/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/seedance_2p0/cost.rs @@ -81,8 +81,8 @@ mod tests { KinoviSeedance2p0BatchCount as KinoviBatchCount, }; - use crate::api::common_resolution::CommonResolution; - use crate::api::provider::Provider; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_provider::RouterProvider; use crate::api::video_list_ref::VideoListRef; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use crate::generate::generate_video_v2::video_generation_draft::VideoGenerationDraftRequest; @@ -288,7 +288,7 @@ mod tests { #[test] fn from_draft_480p() { - let draft = make_draft(5, 1, Some(CommonResolution::FourEightyP), false); + let draft = make_draft(5, 1, Some(RouterResolution::FourEightyP), false); let cost = KinoviSeedance2p0CostState::from_draft(&draft); assert!(matches!(cost.resolution, Some(KinoviOutputResolution::FourEightyP))); assert_eq!(cost.estimate_cost().cost_in_usd_cents, Some(39)); @@ -296,7 +296,7 @@ mod tests { #[test] fn from_draft_1080p_batch_4() { - let draft = make_draft(5, 4, Some(CommonResolution::TenEightyP), false); + let draft = make_draft(5, 4, Some(RouterResolution::TenEightyP), false); let cost = KinoviSeedance2p0CostState::from_draft(&draft); assert!(matches!(cost.resolution, Some(KinoviOutputResolution::TenEightyP))); assert!(matches!(cost.batch_count, Some(KinoviBatchCount::Four))); @@ -321,7 +321,7 @@ mod tests { #[test] fn from_draft_duration_15_batch_2() { - let draft = make_draft(15, 2, Some(CommonResolution::SevenTwentyP), false); + let draft = make_draft(15, 2, Some(RouterResolution::SevenTwentyP), false); let cost = KinoviSeedance2p0CostState::from_draft(&draft); assert_eq!(cost.duration_seconds, 15); assert!(matches!(cost.batch_count, Some(KinoviBatchCount::Two))); @@ -337,7 +337,7 @@ mod tests { #[test] fn draft_and_request_produce_same_cost() { // 720p, 5s, batch 1 - let draft = make_draft(5, 1, Some(CommonResolution::SevenTwentyP), false); + let draft = make_draft(5, 1, Some(RouterResolution::SevenTwentyP), false); let req = make_request_state(Some(KinoviOutputResolution::SevenTwentyP), 5, KinoviBatchCount::One, false); let draft_cost = KinoviSeedance2p0CostState::from_draft(&draft).estimate_cost(); let req_cost = KinoviSeedance2p0CostState::from_request(&req).estimate_cost(); @@ -347,7 +347,7 @@ mod tests { #[test] fn draft_and_request_produce_same_cost_1080p() { - let draft = make_draft(10, 2, Some(CommonResolution::TenEightyP), false); + let draft = make_draft(10, 2, Some(RouterResolution::TenEightyP), false); let req = make_request_state(Some(KinoviOutputResolution::TenEightyP), 10, KinoviBatchCount::Two, false); let draft_cost = KinoviSeedance2p0CostState::from_draft(&draft).estimate_cost(); let req_cost = KinoviSeedance2p0CostState::from_request(&req).estimate_cost(); @@ -411,7 +411,7 @@ mod tests { fn make_draft( duration_seconds: u16, video_batch_count: u16, - resolution: Option, + resolution: Option, with_video_ref: bool, ) -> KinoviSeedance2p0DraftState { let reference_videos = if with_video_ref { @@ -421,7 +421,7 @@ mod tests { }; let builder = GenerateVideoRequestBuilder { - provider: Provider::Seedance2Pro, + provider: RouterProvider::Seedance2Pro, resolution, reference_videos, duration_seconds: Some(duration_seconds), diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/seedance_2p0_fast/build.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/seedance_2p0_fast/build.rs index b3be756eab..21876eb27d 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/seedance_2p0_fast/build.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/seedance_2p0_fast/build.rs @@ -4,8 +4,8 @@ use seedance2pro_client::generate::video::generate_seedance_2p0_fast::{ KinoviSeedance2p0FastOutputResolution as KinoviOutputResolution, }; -use crate::api::common_aspect_ratio::CommonAspectRatio; -use crate::api::common_resolution::CommonResolution; +use crate::api::router_aspect_ratio::RouterAspectRatio; +use crate::api::router_resolution::RouterResolution; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::errors::artcraft_router_error::ArtcraftRouterError; use crate::errors::client_error::ClientError; @@ -55,29 +55,29 @@ fn do_build_kinovi_seedance_2p0_fast(mut builder: GenerateVideoRequestBuilder) - // All supported ratios cost the same, so PayMoreUpgrade and PayLessDowngrade both // select the nearest match rather than rounding in a specific direction. fn plan_aspect_ratio( - aspect_ratio: Option, + aspect_ratio: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result { match aspect_ratio { // No preference or auto — default to landscape None - | Some(CommonAspectRatio::Auto) - | Some(CommonAspectRatio::Auto2k) - | Some(CommonAspectRatio::Auto4k) => Ok(KinoviAspectRatio::Landscape16x9), + | Some(RouterAspectRatio::Auto) + | Some(RouterAspectRatio::Auto2k) + | Some(RouterAspectRatio::Auto4k) => Ok(KinoviAspectRatio::Landscape16x9), // Direct mappings - Some(CommonAspectRatio::WideSixteenByNine) | Some(CommonAspectRatio::Wide) => { + Some(RouterAspectRatio::WideSixteenByNine) | Some(RouterAspectRatio::Wide) => { Ok(KinoviAspectRatio::Landscape16x9) } - Some(CommonAspectRatio::TallNineBySixteen) | Some(CommonAspectRatio::Tall) => { + Some(RouterAspectRatio::TallNineBySixteen) | Some(RouterAspectRatio::Tall) => { Ok(KinoviAspectRatio::Portrait9x16) } - Some(CommonAspectRatio::Square) | Some(CommonAspectRatio::SquareHd) => { + Some(RouterAspectRatio::Square) | Some(RouterAspectRatio::SquareHd) => { Ok(KinoviAspectRatio::Square1x1) } - Some(CommonAspectRatio::WideFourByThree) => Ok(KinoviAspectRatio::Standard4x3), - Some(CommonAspectRatio::TallThreeByFour) => Ok(KinoviAspectRatio::Portrait3x4), - Some(CommonAspectRatio::WideTwentyOneByNine) => Ok(KinoviAspectRatio::UltraWide21x9), + Some(RouterAspectRatio::WideFourByThree) => Ok(KinoviAspectRatio::Standard4x3), + Some(RouterAspectRatio::TallThreeByFour) => Ok(KinoviAspectRatio::Portrait3x4), + Some(RouterAspectRatio::WideTwentyOneByNine) => Ok(KinoviAspectRatio::UltraWide21x9), // Mismatches — apply strategy Some(unsupported) => match strategy { @@ -96,13 +96,13 @@ fn plan_aspect_ratio( } /// Pick the nearest supported aspect ratio by AR value (width / height). -fn nearest_aspect_ratio(aspect_ratio: CommonAspectRatio) -> KinoviAspectRatio { +fn nearest_aspect_ratio(aspect_ratio: RouterAspectRatio) -> KinoviAspectRatio { match aspect_ratio { - CommonAspectRatio::WideFiveByFour => KinoviAspectRatio::Standard4x3, // 1.25, nearest 1.33 - CommonAspectRatio::WideThreeByTwo => KinoviAspectRatio::Standard4x3, // 1.50, nearest 1.33 - CommonAspectRatio::TallFourByFive => KinoviAspectRatio::Portrait3x4, // 0.80, nearest 0.75 - CommonAspectRatio::TallTwoByThree => KinoviAspectRatio::Portrait3x4, // 0.67, nearest 0.75 - CommonAspectRatio::TallNineByTwentyOne => KinoviAspectRatio::Portrait9x16, // 0.43, nearest 0.56 + RouterAspectRatio::WideFiveByFour => KinoviAspectRatio::Standard4x3, // 1.25, nearest 1.33 + RouterAspectRatio::WideThreeByTwo => KinoviAspectRatio::Standard4x3, // 1.50, nearest 1.33 + RouterAspectRatio::TallFourByFive => KinoviAspectRatio::Portrait3x4, // 0.80, nearest 0.75 + RouterAspectRatio::TallTwoByThree => KinoviAspectRatio::Portrait3x4, // 0.67, nearest 0.75 + RouterAspectRatio::TallNineByTwentyOne => KinoviAspectRatio::Portrait9x16, // 0.43, nearest 0.56 _ => KinoviAspectRatio::Square1x1, } } @@ -110,22 +110,22 @@ fn nearest_aspect_ratio(aspect_ratio: CommonAspectRatio) -> KinoviAspectRatio { // Seedance 2.0 Fast supports output resolutions: 480p and 720p only. // 1080p is NOT supported — downgrade to 720p or error based on strategy. fn plan_output_resolution( - resolution: Option, + resolution: Option, strategy: RequestMismatchMitigationStrategy, ) -> Result, ArtcraftRouterError> { match resolution { None => Ok(None), // Direct mappings - Some(CommonResolution::FourEightyP) => Ok(Some(KinoviOutputResolution::FourEightyP)), - Some(CommonResolution::SevenTwentyP) => Ok(Some(KinoviOutputResolution::SevenTwentyP)), + Some(RouterResolution::FourEightyP) => Ok(Some(KinoviOutputResolution::FourEightyP)), + Some(RouterResolution::SevenTwentyP) => Ok(Some(KinoviOutputResolution::SevenTwentyP)), // 1080p is not supported for Fast — handle via strategy - Some(CommonResolution::TenEightyP) => match strategy { + Some(RouterResolution::TenEightyP) => match strategy { RequestMismatchMitigationStrategy::ErrorOut => { Err(ArtcraftRouterError::Client(ClientError::ModelDoesNotSupportOption { field: "resolution", - value: format!("{:?}", CommonResolution::TenEightyP), + value: format!("{:?}", RouterResolution::TenEightyP), })) } RequestMismatchMitigationStrategy::PayMoreUpgrade @@ -145,13 +145,13 @@ fn plan_output_resolution( } RequestMismatchMitigationStrategy::PayMoreUpgrade => { Ok(Some(match unsupported { - CommonResolution::HalfK => KinoviOutputResolution::FourEightyP, + RouterResolution::HalfK => KinoviOutputResolution::FourEightyP, _ => KinoviOutputResolution::SevenTwentyP, })) } RequestMismatchMitigationStrategy::PayLessDowngrade => { Ok(Some(match unsupported { - CommonResolution::HalfK => KinoviOutputResolution::FourEightyP, + RouterResolution::HalfK => KinoviOutputResolution::FourEightyP, _ => KinoviOutputResolution::SevenTwentyP, })) } @@ -222,12 +222,12 @@ mod tests { use crate::api::audio_list_ref::AudioListRef; use crate::api::character_list_ref::CharacterListRef; - use crate::api::common_aspect_ratio::CommonAspectRatio; - use crate::api::common_resolution::CommonResolution; - use crate::api::common_video_model::CommonVideoModel; + use crate::api::router_aspect_ratio::RouterAspectRatio; + use crate::api::router_resolution::RouterResolution; + use crate::api::router_video_model::RouterVideoModel; use crate::api::image_list_ref::ImageListRef; use crate::api::image_ref::ImageRef; - use crate::api::provider::Provider; + use crate::api::router_provider::RouterProvider; use crate::api::video_list_ref::VideoListRef; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; @@ -309,7 +309,7 @@ mod tests { #[test] fn aspect_ratio_wide() { let builder = GenerateVideoRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::WideSixteenByNine), + aspect_ratio: Some(RouterAspectRatio::WideSixteenByNine), ..seedance2pro_fast_builder() }; let draft = unwrap_draft(build_kinovi_seedance_2p0_fast(builder)); @@ -319,7 +319,7 @@ mod tests { #[test] fn aspect_ratio_tall() { let builder = GenerateVideoRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::TallNineBySixteen), + aspect_ratio: Some(RouterAspectRatio::TallNineBySixteen), ..seedance2pro_fast_builder() }; let draft = unwrap_draft(build_kinovi_seedance_2p0_fast(builder)); @@ -329,7 +329,7 @@ mod tests { #[test] fn aspect_ratio_square() { let builder = GenerateVideoRequestBuilder { - aspect_ratio: Some(CommonAspectRatio::Square), + aspect_ratio: Some(RouterAspectRatio::Square), ..seedance2pro_fast_builder() }; let draft = unwrap_draft(build_kinovi_seedance_2p0_fast(builder)); @@ -352,7 +352,7 @@ mod tests { #[test] fn resolution_480p() { let builder = GenerateVideoRequestBuilder { - resolution: Some(CommonResolution::FourEightyP), + resolution: Some(RouterResolution::FourEightyP), ..seedance2pro_fast_builder() }; let draft = unwrap_draft(build_kinovi_seedance_2p0_fast(builder)); @@ -362,7 +362,7 @@ mod tests { #[test] fn resolution_720p() { let builder = GenerateVideoRequestBuilder { - resolution: Some(CommonResolution::SevenTwentyP), + resolution: Some(RouterResolution::SevenTwentyP), ..seedance2pro_fast_builder() }; let draft = unwrap_draft(build_kinovi_seedance_2p0_fast(builder)); @@ -372,7 +372,7 @@ mod tests { #[test] fn resolution_1080p_downgrades_to_720p() { let builder = GenerateVideoRequestBuilder { - resolution: Some(CommonResolution::TenEightyP), + resolution: Some(RouterResolution::TenEightyP), request_mismatch_mitigation_strategy: RequestMismatchMitigationStrategy::PayLessDowngrade, ..seedance2pro_fast_builder() }; @@ -383,7 +383,7 @@ mod tests { #[test] fn resolution_1080p_upgrade_also_downgrades_to_720p() { let builder = GenerateVideoRequestBuilder { - resolution: Some(CommonResolution::TenEightyP), + resolution: Some(RouterResolution::TenEightyP), request_mismatch_mitigation_strategy: RequestMismatchMitigationStrategy::PayMoreUpgrade, ..seedance2pro_fast_builder() }; @@ -394,7 +394,7 @@ mod tests { #[test] fn resolution_1080p_error_out() { let builder = GenerateVideoRequestBuilder { - resolution: Some(CommonResolution::TenEightyP), + resolution: Some(RouterResolution::TenEightyP), request_mismatch_mitigation_strategy: RequestMismatchMitigationStrategy::ErrorOut, ..seedance2pro_fast_builder() }; @@ -411,7 +411,7 @@ mod tests { #[test] fn unsupported_resolution_error_out() { let builder = GenerateVideoRequestBuilder { - resolution: Some(CommonResolution::FourK), + resolution: Some(RouterResolution::FourK), request_mismatch_mitigation_strategy: RequestMismatchMitigationStrategy::ErrorOut, ..seedance2pro_fast_builder() }; @@ -421,7 +421,7 @@ mod tests { #[test] fn unsupported_resolution_rounds_to_720p() { let builder = GenerateVideoRequestBuilder { - resolution: Some(CommonResolution::FourK), + resolution: Some(RouterResolution::FourK), request_mismatch_mitigation_strategy: RequestMismatchMitigationStrategy::PayMoreUpgrade, ..seedance2pro_fast_builder() }; @@ -561,8 +561,8 @@ mod tests { fn full_request_all_fields() { let builder = GenerateVideoRequestBuilder { prompt: Some("full test".to_string()), - aspect_ratio: Some(CommonAspectRatio::TallNineBySixteen), - resolution: Some(CommonResolution::SevenTwentyP), + aspect_ratio: Some(RouterAspectRatio::TallNineBySixteen), + resolution: Some(RouterResolution::SevenTwentyP), duration_seconds: Some(10), video_batch_count: Some(4), start_frame: Some(ImageRef::Url("https://example.com/start.jpg".to_string())), @@ -596,8 +596,8 @@ mod tests { fn seedance2pro_fast_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0Fast, - provider: Provider::Seedance2Pro, + model: RouterVideoModel::Seedance2p0Fast, + provider: RouterProvider::Seedance2Pro, prompt: Some("a cat dancing".to_string()), duration_seconds: Some(5), video_batch_count: Some(1), diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/seedance_2p0_fast/cost.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/seedance_2p0_fast/cost.rs index ceb37e5de0..eca02bdf32 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/seedance_2p0_fast/cost.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/providers/kinovi/seedance_2p0_fast/cost.rs @@ -76,14 +76,14 @@ impl KinoviSeedance2p0FastCostState { #[cfg(test)] mod tests { use super::*; - use crate::api::common_resolution::CommonResolution; + use crate::api::router_resolution::RouterResolution; use seedance2pro_client::generate::video::generate_seedance_2p0_fast::{ KinoviSeedance2p0FastOutputResolution as KinoviOutputResolution, KinoviSeedance2p0FastBatchCount as KinoviBatchCount, }; - use crate::api::common_video_model::CommonVideoModel; - use crate::api::provider::Provider; + use crate::api::router_video_model::RouterVideoModel; + use crate::api::router_provider::RouterProvider; use crate::api::video_list_ref::VideoListRef; use crate::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use crate::generate::generate_video_v2::video_generation_draft::VideoGenerationDraftRequest; @@ -253,7 +253,7 @@ mod tests { #[test] fn from_draft_480p() { - let draft = make_draft(5, 1, Some(CommonResolution::FourEightyP), false); + let draft = make_draft(5, 1, Some(RouterResolution::FourEightyP), false); let cost = KinoviSeedance2p0FastCostState::from_draft(&draft); assert!(matches!(cost.resolution, Some(KinoviOutputResolution::FourEightyP))); assert_eq!(cost.estimate_cost().cost_in_usd_cents, Some(36)); @@ -277,7 +277,7 @@ mod tests { #[test] fn from_draft_duration_15_batch_2() { - let draft = make_draft(15, 2, Some(CommonResolution::SevenTwentyP), false); + let draft = make_draft(15, 2, Some(RouterResolution::SevenTwentyP), false); let cost = KinoviSeedance2p0FastCostState::from_draft(&draft); assert_eq!(cost.duration_seconds, 15); assert!(matches!(cost.batch_count, Some(KinoviBatchCount::Two))); @@ -293,7 +293,7 @@ mod tests { #[test] fn draft_and_request_produce_same_cost() { // 720p, 5s, batch 1 - let draft = make_draft(5, 1, Some(CommonResolution::SevenTwentyP), false); + let draft = make_draft(5, 1, Some(RouterResolution::SevenTwentyP), false); let req = make_request_state(Some(KinoviOutputResolution::SevenTwentyP), 5, KinoviBatchCount::One, false); let draft_cost = KinoviSeedance2p0FastCostState::from_draft(&draft).estimate_cost(); let req_cost = KinoviSeedance2p0FastCostState::from_request(&req).estimate_cost(); @@ -303,7 +303,7 @@ mod tests { #[test] fn draft_and_request_produce_same_cost_480p() { - let draft = make_draft(10, 2, Some(CommonResolution::FourEightyP), false); + let draft = make_draft(10, 2, Some(RouterResolution::FourEightyP), false); let req = make_request_state(Some(KinoviOutputResolution::FourEightyP), 10, KinoviBatchCount::Two, false); let draft_cost = KinoviSeedance2p0FastCostState::from_draft(&draft).estimate_cost(); let req_cost = KinoviSeedance2p0FastCostState::from_request(&req).estimate_cost(); @@ -362,7 +362,7 @@ mod tests { fn make_draft( duration_seconds: u16, video_batch_count: u16, - resolution: Option, + resolution: Option, with_video_ref: bool, ) -> KinoviSeedance2p0FastDraftState { let reference_videos = if with_video_ref { @@ -372,8 +372,8 @@ mod tests { }; let builder = GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0Fast, - provider: Provider::Seedance2Pro, + model: RouterVideoModel::Seedance2p0Fast, + provider: RouterProvider::Seedance2Pro, resolution, reference_videos, duration_seconds: Some(duration_seconds), diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/video_generation_draft.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/video_generation_draft.rs index f18706576d..e5787bd2c3 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/video_generation_draft.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/video_generation_draft.rs @@ -1,4 +1,4 @@ -use crate::api::provider::Provider; +use crate::api::router_provider::RouterProvider; use crate::errors::artcraft_router_error::ArtcraftRouterError; use crate::generate::generate_video::video_generation_cost_estimate::VideoGenerationCostEstimate; use crate::generate::generate_video_v2::providers::kinovi::happy_horse_1p0::cost::KinoviHappyHorse1p0CostState; @@ -22,11 +22,11 @@ pub enum VideoGenerationDraftRequest { impl VideoGenerationDraftRequest { - pub fn get_provider(&self) -> Provider { + pub fn get_provider(&self) -> RouterProvider { match self { - Self::KinoviHappyHorse1p0(_) => Provider::Seedance2Pro, - Self::KinoviSeedance2p0(_) => Provider::Seedance2Pro, - Self::KinoviSeedance2p0Fast(_) => Provider::Seedance2Pro, + Self::KinoviHappyHorse1p0(_) => RouterProvider::Seedance2Pro, + Self::KinoviSeedance2p0(_) => RouterProvider::Seedance2Pro, + Self::KinoviSeedance2p0Fast(_) => RouterProvider::Seedance2Pro, } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/video_generation_draft_or_request.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/video_generation_draft_or_request.rs index ea38a90ab8..2b77f5b0d3 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/video_generation_draft_or_request.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/video_generation_draft_or_request.rs @@ -1,4 +1,4 @@ -use crate::api::provider::Provider; +use crate::api::router_provider::RouterProvider; use crate::errors::artcraft_router_error::ArtcraftRouterError; use crate::generate::generate_video::video_generation_cost_estimate::VideoGenerationCostEstimate; use crate::generate::generate_video_v2::video_generation_draft::VideoGenerationDraftRequest; @@ -12,7 +12,7 @@ pub enum VideoGenerationDraftOrRequest { impl VideoGenerationDraftOrRequest { - pub fn get_provider(&self) -> Provider { + pub fn get_provider(&self) -> RouterProvider { match self { Self::Draft(draft) => draft.get_provider(), Self::Request(request) => request.get_provider(), diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/video_generation_request.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/video_generation_request.rs index 63b0f30cb2..034b6f286d 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/video_generation_request.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video_v2/video_generation_request.rs @@ -1,4 +1,4 @@ -use crate::api::provider::Provider; +use crate::api::router_provider::RouterProvider; use crate::client::router_client::RouterClient; use crate::errors::artcraft_router_error::ArtcraftRouterError; use crate::generate::generate_video::generate_video_response::GenerateVideoResponse; @@ -154,56 +154,56 @@ pub enum VideoGenerationRequest { impl VideoGenerationRequest { - pub fn get_provider(&self) -> Provider { + pub fn get_provider(&self) -> RouterProvider { match self { - Self::ArtcraftGrokImagineVideo(_) => Provider::Artcraft, - Self::ArtcraftHappyHorse1p0(_) => Provider::Artcraft, - Self::ArtcraftKling16Pro(_) => Provider::Artcraft, - Self::ArtcraftKling21Master(_) => Provider::Artcraft, - Self::ArtcraftKling21Pro(_) => Provider::Artcraft, - Self::ArtcraftKling2p5TurboPro(_) => Provider::Artcraft, - Self::ArtcraftKling2p6Pro(_) => Provider::Artcraft, - Self::ArtcraftKling3p0Pro(_) => Provider::Artcraft, - Self::ArtcraftKling3p0Standard(_) => Provider::Artcraft, - Self::ArtcraftPreviewModel(_) => Provider::Artcraft, - Self::ArtcraftPreviewModelFast(_) => Provider::Artcraft, - Self::ArtcraftSeedance10Lite(_) => Provider::Artcraft, - Self::ArtcraftSeedance1p5Pro(_) => Provider::Artcraft, - Self::ArtcraftSeedance2p0(_) => Provider::Artcraft, - Self::ArtcraftSeedance2p0Fast(_) => Provider::Artcraft, - Self::ArtcraftSeedance2p0Ultra(_) => Provider::Artcraft, - Self::ArtcraftSeedance2p0UltraFast(_) => Provider::Artcraft, - Self::ArtcraftSeedance2p0BytePlus(_) => Provider::Artcraft, - Self::ArtcraftSeedance2p0BytePlusFast(_) => Provider::Artcraft, - Self::ArtcraftSora2(_) => Provider::Artcraft, - Self::ArtcraftSora2Pro(_) => Provider::Artcraft, - Self::ArtcraftVeo2(_) => Provider::Artcraft, - Self::ArtcraftVeo3(_) => Provider::Artcraft, - Self::ArtcraftVeo3Fast(_) => Provider::Artcraft, - Self::ArtcraftVeo3p1(_) => Provider::Artcraft, - Self::ArtcraftVeo3p1Fast(_) => Provider::Artcraft, - Self::FalKling16Pro(_) => Provider::Fal, - Self::FalKling21Master(_) => Provider::Fal, - Self::FalKling21Pro(_) => Provider::Fal, - Self::FalKling2p5TurboPro(_) => Provider::Fal, - Self::FalKling2p6Pro(_) => Provider::Fal, - Self::FalKling3p0Pro(_) => Provider::Fal, - Self::FalKling3p0Standard(_) => Provider::Fal, - Self::FalSeedance10Lite(_) => Provider::Fal, - Self::FalSeedance1p5Pro(_) => Provider::Fal, - Self::FalSora2(_) => Provider::Fal, - Self::FalSora2Pro(_) => Provider::Fal, - Self::FalVeo2(_) => Provider::Fal, - Self::FalVeo3(_) => Provider::Fal, - Self::FalVeo3Fast(_) => Provider::Fal, - Self::FalVeo3p1(_) => Provider::Fal, - Self::FalVeo3p1Fast(_) => Provider::Fal, - Self::GmiCloudSeedance2p0Ultra(_) => Provider::GmiCloud, - Self::GmiCloudSeedance2p0UltraFast(_) => Provider::GmiCloud, - Self::GrokApiGrokImagineVideo(_) => Provider::GrokApi, - Self::KinoviHappyHorse1p0(_) => Provider::Seedance2Pro, - Self::KinoviSeedance2p0(_) => Provider::Seedance2Pro, - Self::KinoviSeedance2p0Fast(_) => Provider::Seedance2Pro, + Self::ArtcraftGrokImagineVideo(_) => RouterProvider::Artcraft, + Self::ArtcraftHappyHorse1p0(_) => RouterProvider::Artcraft, + Self::ArtcraftKling16Pro(_) => RouterProvider::Artcraft, + Self::ArtcraftKling21Master(_) => RouterProvider::Artcraft, + Self::ArtcraftKling21Pro(_) => RouterProvider::Artcraft, + Self::ArtcraftKling2p5TurboPro(_) => RouterProvider::Artcraft, + Self::ArtcraftKling2p6Pro(_) => RouterProvider::Artcraft, + Self::ArtcraftKling3p0Pro(_) => RouterProvider::Artcraft, + Self::ArtcraftKling3p0Standard(_) => RouterProvider::Artcraft, + Self::ArtcraftPreviewModel(_) => RouterProvider::Artcraft, + Self::ArtcraftPreviewModelFast(_) => RouterProvider::Artcraft, + Self::ArtcraftSeedance10Lite(_) => RouterProvider::Artcraft, + Self::ArtcraftSeedance1p5Pro(_) => RouterProvider::Artcraft, + Self::ArtcraftSeedance2p0(_) => RouterProvider::Artcraft, + Self::ArtcraftSeedance2p0Fast(_) => RouterProvider::Artcraft, + Self::ArtcraftSeedance2p0Ultra(_) => RouterProvider::Artcraft, + Self::ArtcraftSeedance2p0UltraFast(_) => RouterProvider::Artcraft, + Self::ArtcraftSeedance2p0BytePlus(_) => RouterProvider::Artcraft, + Self::ArtcraftSeedance2p0BytePlusFast(_) => RouterProvider::Artcraft, + Self::ArtcraftSora2(_) => RouterProvider::Artcraft, + Self::ArtcraftSora2Pro(_) => RouterProvider::Artcraft, + Self::ArtcraftVeo2(_) => RouterProvider::Artcraft, + Self::ArtcraftVeo3(_) => RouterProvider::Artcraft, + Self::ArtcraftVeo3Fast(_) => RouterProvider::Artcraft, + Self::ArtcraftVeo3p1(_) => RouterProvider::Artcraft, + Self::ArtcraftVeo3p1Fast(_) => RouterProvider::Artcraft, + Self::FalKling16Pro(_) => RouterProvider::Fal, + Self::FalKling21Master(_) => RouterProvider::Fal, + Self::FalKling21Pro(_) => RouterProvider::Fal, + Self::FalKling2p5TurboPro(_) => RouterProvider::Fal, + Self::FalKling2p6Pro(_) => RouterProvider::Fal, + Self::FalKling3p0Pro(_) => RouterProvider::Fal, + Self::FalKling3p0Standard(_) => RouterProvider::Fal, + Self::FalSeedance10Lite(_) => RouterProvider::Fal, + Self::FalSeedance1p5Pro(_) => RouterProvider::Fal, + Self::FalSora2(_) => RouterProvider::Fal, + Self::FalSora2Pro(_) => RouterProvider::Fal, + Self::FalVeo2(_) => RouterProvider::Fal, + Self::FalVeo3(_) => RouterProvider::Fal, + Self::FalVeo3Fast(_) => RouterProvider::Fal, + Self::FalVeo3p1(_) => RouterProvider::Fal, + Self::FalVeo3p1Fast(_) => RouterProvider::Fal, + Self::GmiCloudSeedance2p0Ultra(_) => RouterProvider::GmiCloud, + Self::GmiCloudSeedance2p0UltraFast(_) => RouterProvider::GmiCloud, + Self::GrokApiGrokImagineVideo(_) => RouterProvider::GrokApi, + Self::KinoviHappyHorse1p0(_) => RouterProvider::Seedance2Pro, + Self::KinoviSeedance2p0(_) => RouterProvider::Seedance2Pro, + Self::KinoviSeedance2p0Fast(_) => RouterProvider::Seedance2Pro, } } diff --git a/crates/api_clients/artcraft/artcraft_router/src/test_helpers.rs b/crates/api_clients/artcraft/artcraft_router/src/test_helpers.rs index f6a2306072..e72a9b2c3e 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/test_helpers.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/test_helpers.rs @@ -1,6 +1,6 @@ -use crate::api::common_image_model::CommonImageModel; -use crate::api::common_video_model::CommonVideoModel; -use crate::api::provider::Provider; +use crate::api::router_image_model::RouterImageModel; +use crate::api::router_video_model::RouterVideoModel; +use crate::api::router_provider::RouterProvider; use crate::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use crate::client::router_artcraft_client::RouterArtcraftClient; use crate::client::router_client::RouterClient; @@ -27,8 +27,8 @@ pub fn get_artcraft_client() -> RouterClient { pub fn base_image_request() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::NanoBananaPro, - provider: Provider::Artcraft, + model: RouterImageModel::NanoBananaPro, + provider: RouterProvider::Artcraft, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -54,8 +54,8 @@ pub fn get_fal_client() -> RouterClient { pub fn base_fal_image_request() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::NanoBananaPro, - provider: Provider::Fal, + model: RouterImageModel::NanoBananaPro, + provider: RouterProvider::Fal, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -73,8 +73,8 @@ pub fn base_fal_image_request() -> GenerateImageRequestBuilder { pub fn base_seedream_4_image_request() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::Seedream4, - provider: Provider::Artcraft, + model: RouterImageModel::Seedream4, + provider: RouterProvider::Artcraft, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -92,8 +92,8 @@ pub fn base_seedream_4_image_request() -> GenerateImageRequestBuilder { pub fn base_seedream_4p5_image_request() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::Seedream4p5, - provider: Provider::Artcraft, + model: RouterImageModel::Seedream4p5, + provider: RouterProvider::Artcraft, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -111,8 +111,8 @@ pub fn base_seedream_4p5_image_request() -> GenerateImageRequestBuilder { pub fn base_seedream_5_lite_image_request() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::Seedream5Lite, - provider: Provider::Artcraft, + model: RouterImageModel::Seedream5Lite, + provider: RouterProvider::Artcraft, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -130,8 +130,8 @@ pub fn base_seedream_5_lite_image_request() -> GenerateImageRequestBuilder { pub fn base_nano_banana_2_image_request() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::NanoBanana2, - provider: Provider::Artcraft, + model: RouterImageModel::NanoBanana2, + provider: RouterProvider::Artcraft, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -149,8 +149,8 @@ pub fn base_nano_banana_2_image_request() -> GenerateImageRequestBuilder { pub fn base_nano_banana_image_request() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::NanoBanana, - provider: Provider::Artcraft, + model: RouterImageModel::NanoBanana, + provider: RouterProvider::Artcraft, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -168,8 +168,8 @@ pub fn base_nano_banana_image_request() -> GenerateImageRequestBuilder { pub fn base_gpt_image_1_image_request() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::GptImage1, - provider: Provider::Artcraft, + model: RouterImageModel::GptImage1, + provider: RouterProvider::Artcraft, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -187,8 +187,8 @@ pub fn base_gpt_image_1_image_request() -> GenerateImageRequestBuilder { pub fn base_gpt_image_2_image_request() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::GptImage2, - provider: Provider::Artcraft, + model: RouterImageModel::GptImage2, + provider: RouterProvider::Artcraft, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -206,8 +206,8 @@ pub fn base_gpt_image_2_image_request() -> GenerateImageRequestBuilder { pub fn base_gpt_image_1p5_image_request() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::GptImage1p5, - provider: Provider::Artcraft, + model: RouterImageModel::GptImage1p5, + provider: RouterProvider::Artcraft, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -225,8 +225,8 @@ pub fn base_gpt_image_1p5_image_request() -> GenerateImageRequestBuilder { pub fn base_flux_1_dev_image_request() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::Flux1Dev, - provider: Provider::Artcraft, + model: RouterImageModel::Flux1Dev, + provider: RouterProvider::Artcraft, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -244,8 +244,8 @@ pub fn base_flux_1_dev_image_request() -> GenerateImageRequestBuilder { pub fn base_flux_1_schnell_image_request() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::Flux1Schnell, - provider: Provider::Artcraft, + model: RouterImageModel::Flux1Schnell, + provider: RouterProvider::Artcraft, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -263,8 +263,8 @@ pub fn base_flux_1_schnell_image_request() -> GenerateImageRequestBuilder { pub fn base_flux_pro_1p1_image_request() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::FluxPro11, - provider: Provider::Artcraft, + model: RouterImageModel::FluxPro11, + provider: RouterProvider::Artcraft, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -282,8 +282,8 @@ pub fn base_flux_pro_1p1_image_request() -> GenerateImageRequestBuilder { pub fn base_qwen_edit_2511_angles_image_request() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::QwenEdit2511Angles, - provider: Provider::Artcraft, + model: RouterImageModel::QwenEdit2511Angles, + provider: RouterProvider::Artcraft, prompt: None, image_inputs: None, resolution: None, @@ -301,8 +301,8 @@ pub fn base_qwen_edit_2511_angles_image_request() -> GenerateImageRequestBuilder pub fn base_flux_2_lora_angles_image_request() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::Flux2LoraAngles, - provider: Provider::Artcraft, + model: RouterImageModel::Flux2LoraAngles, + provider: RouterProvider::Artcraft, prompt: None, image_inputs: None, resolution: None, @@ -320,8 +320,8 @@ pub fn base_flux_2_lora_angles_image_request() -> GenerateImageRequestBuilder { pub fn base_flux_pro_1p1_ultra_image_request() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::FluxPro11Ultra, - provider: Provider::Artcraft, + model: RouterImageModel::FluxPro11Ultra, + provider: RouterProvider::Artcraft, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -339,8 +339,8 @@ pub fn base_flux_pro_1p1_ultra_image_request() -> GenerateImageRequestBuilder { pub fn base_video_request() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Seedance2p0, - provider: Provider::Artcraft, + model: RouterVideoModel::Seedance2p0, + provider: RouterProvider::Artcraft, prompt: Some("a cat in space".to_string()), negative_prompt: None, start_frame: None, diff --git a/crates/desktop/artcraft/src/core/api_adapters/aspect_ratio/convert/router_aspect_ratio_to_enums_aspect_ratio.rs b/crates/desktop/artcraft/src/core/api_adapters/aspect_ratio/convert/router_aspect_ratio_to_enums_aspect_ratio.rs index d0b98b5926..5f72b24b85 100644 --- a/crates/desktop/artcraft/src/core/api_adapters/aspect_ratio/convert/router_aspect_ratio_to_enums_aspect_ratio.rs +++ b/crates/desktop/artcraft/src/core/api_adapters/aspect_ratio/convert/router_aspect_ratio_to_enums_aspect_ratio.rs @@ -1,26 +1,26 @@ -use artcraft_router::api::common_aspect_ratio::CommonAspectRatio as RouterCommonAspectRatio; +use artcraft_router::api::router_aspect_ratio::RouterAspectRatio; use enums::common::generation::common_aspect_ratio::CommonAspectRatio as EnumsCommonAspectRatio; /// Map from the router's CommonAspectRatio to the enums crate's CommonAspectRatio. -pub fn router_aspect_ratio_to_enums_aspect_ratio(ratio: RouterCommonAspectRatio) -> EnumsCommonAspectRatio { +pub fn router_aspect_ratio_to_enums_aspect_ratio(ratio: RouterAspectRatio) -> EnumsCommonAspectRatio { match ratio { - RouterCommonAspectRatio::Auto => EnumsCommonAspectRatio::Auto, - RouterCommonAspectRatio::Square => EnumsCommonAspectRatio::Square, - RouterCommonAspectRatio::WideThreeByTwo => EnumsCommonAspectRatio::WideThreeByTwo, - RouterCommonAspectRatio::WideFourByThree => EnumsCommonAspectRatio::WideFourByThree, - RouterCommonAspectRatio::WideFiveByFour => EnumsCommonAspectRatio::WideFiveByFour, - RouterCommonAspectRatio::WideSixteenByNine => EnumsCommonAspectRatio::WideSixteenByNine, - RouterCommonAspectRatio::WideTwentyOneByNine => EnumsCommonAspectRatio::WideTwentyOneByNine, - RouterCommonAspectRatio::TallTwoByThree => EnumsCommonAspectRatio::TallTwoByThree, - RouterCommonAspectRatio::TallThreeByFour => EnumsCommonAspectRatio::TallThreeByFour, - RouterCommonAspectRatio::TallFourByFive => EnumsCommonAspectRatio::TallFourByFive, - RouterCommonAspectRatio::TallNineBySixteen => EnumsCommonAspectRatio::TallNineBySixteen, - RouterCommonAspectRatio::TallNineByTwentyOne => EnumsCommonAspectRatio::TallNineByTwentyOne, - RouterCommonAspectRatio::Wide => EnumsCommonAspectRatio::Wide, - RouterCommonAspectRatio::Tall => EnumsCommonAspectRatio::Tall, - RouterCommonAspectRatio::Auto2k => EnumsCommonAspectRatio::Auto2k, - RouterCommonAspectRatio::Auto3k => EnumsCommonAspectRatio::Auto3k, - RouterCommonAspectRatio::Auto4k => EnumsCommonAspectRatio::Auto4k, - RouterCommonAspectRatio::SquareHd => EnumsCommonAspectRatio::SquareHd, + RouterAspectRatio::Auto => EnumsCommonAspectRatio::Auto, + RouterAspectRatio::Square => EnumsCommonAspectRatio::Square, + RouterAspectRatio::WideThreeByTwo => EnumsCommonAspectRatio::WideThreeByTwo, + RouterAspectRatio::WideFourByThree => EnumsCommonAspectRatio::WideFourByThree, + RouterAspectRatio::WideFiveByFour => EnumsCommonAspectRatio::WideFiveByFour, + RouterAspectRatio::WideSixteenByNine => EnumsCommonAspectRatio::WideSixteenByNine, + RouterAspectRatio::WideTwentyOneByNine => EnumsCommonAspectRatio::WideTwentyOneByNine, + RouterAspectRatio::TallTwoByThree => EnumsCommonAspectRatio::TallTwoByThree, + RouterAspectRatio::TallThreeByFour => EnumsCommonAspectRatio::TallThreeByFour, + RouterAspectRatio::TallFourByFive => EnumsCommonAspectRatio::TallFourByFive, + RouterAspectRatio::TallNineBySixteen => EnumsCommonAspectRatio::TallNineBySixteen, + RouterAspectRatio::TallNineByTwentyOne => EnumsCommonAspectRatio::TallNineByTwentyOne, + RouterAspectRatio::Wide => EnumsCommonAspectRatio::Wide, + RouterAspectRatio::Tall => EnumsCommonAspectRatio::Tall, + RouterAspectRatio::Auto2k => EnumsCommonAspectRatio::Auto2k, + RouterAspectRatio::Auto3k => EnumsCommonAspectRatio::Auto3k, + RouterAspectRatio::Auto4k => EnumsCommonAspectRatio::Auto4k, + RouterAspectRatio::SquareHd => EnumsCommonAspectRatio::SquareHd, } } diff --git a/crates/desktop/artcraft/src/core/api_adapters/models/image/tauri_image_model_to_router_model.rs b/crates/desktop/artcraft/src/core/api_adapters/models/image/tauri_image_model_to_router_model.rs index 71e7f4b1e9..ac2b772ea1 100644 --- a/crates/desktop/artcraft/src/core/api_adapters/models/image/tauri_image_model_to_router_model.rs +++ b/crates/desktop/artcraft/src/core/api_adapters/models/image/tauri_image_model_to_router_model.rs @@ -1,28 +1,28 @@ -use artcraft_router::api::common_image_model::CommonImageModel; +use artcraft_router::api::router_image_model::RouterImageModel; use crate::core::commands::generate::generate_image::tauri_image_model::TauriImageModel; -/// Map TauriImageModel to the artcraft_router's CommonImageModel. +/// Map TauriImageModel to the artcraft_router's RouterImageModel. /// Returns None for models not supported by the router (Grok, Midjourney, etc.). -pub fn tauri_image_model_to_router_model(model: TauriImageModel) -> Option { +pub fn tauri_image_model_to_router_model(model: TauriImageModel) -> Option { match model { - TauriImageModel::Flux1Dev => Some(CommonImageModel::Flux1Dev), // Text-to-Image - TauriImageModel::Flux1Schnell => Some(CommonImageModel::Flux1Schnell), // Text-to-Image - TauriImageModel::FluxPro1 => Some(CommonImageModel::FluxPro11), // TODO: Might be a slight mismatch - TauriImageModel::FluxPro11 => Some(CommonImageModel::FluxPro11), // Text-to-Image - TauriImageModel::FluxPro11Ultra => Some(CommonImageModel::FluxPro11Ultra), // Text-to-Image - TauriImageModel::GptImage1 => Some(CommonImageModel::GptImage1), // Text-to-Image - TauriImageModel::GptImage1p5 => Some(CommonImageModel::GptImage1p5), // Text-to-Image - TauriImageModel::GptImage2 => Some(CommonImageModel::GptImage2), // Text-to-Image - TauriImageModel::NanoBanana => Some(CommonImageModel::NanoBanana), // Text-to-Image - TauriImageModel::NanoBanana2 => Some(CommonImageModel::NanoBanana2), // Text-to-Image - TauriImageModel::NanoBananaPro => Some(CommonImageModel::NanoBananaPro), // Text-to-Image - TauriImageModel::Gemini25Flash => Some(CommonImageModel::NanoBanana), // Text-to-Image - TauriImageModel::Seedream4 => Some(CommonImageModel::Seedream4), // Text-to-Image - TauriImageModel::Seedream4p5 => Some(CommonImageModel::Seedream4p5), // Text-to-Image - TauriImageModel::Seedream5Lite => Some(CommonImageModel::Seedream5Lite), // Text-to-Image - TauriImageModel::QwenEdit2511Angles => Some(CommonImageModel::QwenEdit2511Angles), - TauriImageModel::Flux2LoraAngles => Some(CommonImageModel::Flux2LoraAngles), + TauriImageModel::Flux1Dev => Some(RouterImageModel::Flux1Dev), // Text-to-Image + TauriImageModel::Flux1Schnell => Some(RouterImageModel::Flux1Schnell), // Text-to-Image + TauriImageModel::FluxPro1 => Some(RouterImageModel::FluxPro11), // TODO: Might be a slight mismatch + TauriImageModel::FluxPro11 => Some(RouterImageModel::FluxPro11), // Text-to-Image + TauriImageModel::FluxPro11Ultra => Some(RouterImageModel::FluxPro11Ultra), // Text-to-Image + TauriImageModel::GptImage1 => Some(RouterImageModel::GptImage1), // Text-to-Image + TauriImageModel::GptImage1p5 => Some(RouterImageModel::GptImage1p5), // Text-to-Image + TauriImageModel::GptImage2 => Some(RouterImageModel::GptImage2), // Text-to-Image + TauriImageModel::NanoBanana => Some(RouterImageModel::NanoBanana), // Text-to-Image + TauriImageModel::NanoBanana2 => Some(RouterImageModel::NanoBanana2), // Text-to-Image + TauriImageModel::NanoBananaPro => Some(RouterImageModel::NanoBananaPro), // Text-to-Image + TauriImageModel::Gemini25Flash => Some(RouterImageModel::NanoBanana), // Text-to-Image + TauriImageModel::Seedream4 => Some(RouterImageModel::Seedream4), // Text-to-Image + TauriImageModel::Seedream4p5 => Some(RouterImageModel::Seedream4p5), // Text-to-Image + TauriImageModel::Seedream5Lite => Some(RouterImageModel::Seedream5Lite), // Text-to-Image + TauriImageModel::QwenEdit2511Angles => Some(RouterImageModel::QwenEdit2511Angles), + TauriImageModel::Flux2LoraAngles => Some(RouterImageModel::Flux2LoraAngles), // Not accounted for yet TauriImageModel::GrokImage => None, TauriImageModel::Recraft3 => None, diff --git a/crates/desktop/artcraft/src/core/api_adapters/quality/common_quality.rs b/crates/desktop/artcraft/src/core/api_adapters/quality/common_quality.rs index dfc83ed79b..a28d9522d6 100644 --- a/crates/desktop/artcraft/src/core/api_adapters/quality/common_quality.rs +++ b/crates/desktop/artcraft/src/core/api_adapters/quality/common_quality.rs @@ -1,5 +1,5 @@ use serde_derive::{Deserialize, Serialize}; -use artcraft_router::api::common_quality::CommonQuality as RouterCommonQuality; +use artcraft_router::api::router_quality::RouterQuality; /// Just cargo culting this. might not be necessary for standalone types anymore #[derive(Copy, Clone, Debug, Serialize, Deserialize)] @@ -11,11 +11,11 @@ pub enum CommonQuality { } impl CommonQuality { - pub fn to_artcraft_router_type(&self) -> RouterCommonQuality { + pub fn to_artcraft_router_type(&self) -> RouterQuality { match self { - CommonQuality::High => RouterCommonQuality::High, - CommonQuality::Medium => RouterCommonQuality::Medium, - CommonQuality::Low => RouterCommonQuality::Low, + CommonQuality::High => RouterQuality::High, + CommonQuality::Medium => RouterQuality::Medium, + CommonQuality::Low => RouterQuality::Low, } } } diff --git a/crates/desktop/artcraft/src/core/api_adapters/resolution/convert/router_resolution_to_enums_resolution.rs b/crates/desktop/artcraft/src/core/api_adapters/resolution/convert/router_resolution_to_enums_resolution.rs index e15af1b934..3dbbce6766 100644 --- a/crates/desktop/artcraft/src/core/api_adapters/resolution/convert/router_resolution_to_enums_resolution.rs +++ b/crates/desktop/artcraft/src/core/api_adapters/resolution/convert/router_resolution_to_enums_resolution.rs @@ -1,16 +1,16 @@ -use artcraft_router::api::common_resolution::CommonResolution as RouterCommonResolution; +use artcraft_router::api::router_resolution::RouterResolution; use enums::common::generation::common_resolution::CommonResolution as EnumsCommonResolution; /// Map from the router's CommonResolution to the enums crate's CommonResolution. -pub fn router_resolution_to_enums_resolution(res: RouterCommonResolution) -> EnumsCommonResolution { +pub fn router_resolution_to_enums_resolution(res: RouterResolution) -> EnumsCommonResolution { match res { - RouterCommonResolution::OneK => EnumsCommonResolution::OneK, - RouterCommonResolution::TwoK => EnumsCommonResolution::TwoK, - RouterCommonResolution::ThreeK => EnumsCommonResolution::ThreeK, - RouterCommonResolution::FourK => EnumsCommonResolution::FourK, - RouterCommonResolution::HalfK => EnumsCommonResolution::HalfK, - RouterCommonResolution::FourEightyP => EnumsCommonResolution::FourEightyP, - RouterCommonResolution::SevenTwentyP => EnumsCommonResolution::SevenTwentyP, - RouterCommonResolution::TenEightyP => EnumsCommonResolution::TenEightyP, + RouterResolution::OneK => EnumsCommonResolution::OneK, + RouterResolution::TwoK => EnumsCommonResolution::TwoK, + RouterResolution::ThreeK => EnumsCommonResolution::ThreeK, + RouterResolution::FourK => EnumsCommonResolution::FourK, + RouterResolution::HalfK => EnumsCommonResolution::HalfK, + RouterResolution::FourEightyP => EnumsCommonResolution::FourEightyP, + RouterResolution::SevenTwentyP => EnumsCommonResolution::SevenTwentyP, + RouterResolution::TenEightyP => EnumsCommonResolution::TenEightyP, } } diff --git a/crates/desktop/artcraft/src/core/commands/deprecated/image_edit/artcraft/handle_image_edit_artcraft.rs b/crates/desktop/artcraft/src/core/commands/deprecated/image_edit/artcraft/handle_image_edit_artcraft.rs index 68615912aa..0cf70d6d05 100644 --- a/crates/desktop/artcraft/src/core/commands/deprecated/image_edit/artcraft/handle_image_edit_artcraft.rs +++ b/crates/desktop/artcraft/src/core/commands/deprecated/image_edit/artcraft/handle_image_edit_artcraft.rs @@ -8,7 +8,7 @@ use crate::core::events::generation_events::common::GenerationModel; use crate::core::state::app_env_configs::app_env_configs::AppEnvConfigs; use crate::core::state::data_dir::app_data_root::AppDataRoot; use crate::services::storyteller::state::storyteller_credential_manager::StorytellerCredentialManager; -use artcraft_router::api::common_image_model::CommonImageModel; +use artcraft_router::api::router_image_model::RouterImageModel; use tauri::AppHandle; pub async fn handle_image_edit_artcraft( @@ -23,16 +23,16 @@ pub async fn handle_image_edit_artcraft( match model { ImageEditModel::FluxProKontextMax => handle_artcraft_flux_kontext_edit(request, app, app_data_root, app_env_configs, storyteller_creds_manager).await, ImageEditModel::Gemini25Flash | ImageEditModel::NanoBanana => { - handle_image_edit_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, CommonImageModel::NanoBanana, GenerationModel::NanoBanana).await + handle_image_edit_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, RouterImageModel::NanoBanana, GenerationModel::NanoBanana).await }, - ImageEditModel::NanoBanana2 => handle_image_edit_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, CommonImageModel::NanoBanana2, GenerationModel::NanoBanana2).await, - ImageEditModel::NanoBananaPro => handle_image_edit_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, CommonImageModel::NanoBananaPro, GenerationModel::NanoBananaPro).await, + ImageEditModel::NanoBanana2 => handle_image_edit_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, RouterImageModel::NanoBanana2, GenerationModel::NanoBanana2).await, + ImageEditModel::NanoBananaPro => handle_image_edit_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, RouterImageModel::NanoBananaPro, GenerationModel::NanoBananaPro).await, ImageEditModel::GptImage1 => handle_artcraft_gpt_image_1_edit(request, app, app_data_root, app_env_configs, storyteller_creds_manager).await, - ImageEditModel::GptImage1p5 => handle_image_edit_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, CommonImageModel::GptImage1p5, GenerationModel::GptImage1p5).await, - ImageEditModel::Seedream4 => handle_image_edit_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, CommonImageModel::Seedream4, GenerationModel::Seedream4).await, - ImageEditModel::Seedream4p5 => handle_image_edit_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, CommonImageModel::Seedream4p5, GenerationModel::Seedream4p5).await, - ImageEditModel::Seedream5Lite => handle_image_edit_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, CommonImageModel::Seedream5Lite, GenerationModel::Seedream5Lite).await, - ImageEditModel::QwenEdit2511Angles => handle_image_edit_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, CommonImageModel::QwenEdit2511Angles, GenerationModel::QwenEdit2511Angles).await, - ImageEditModel::Flux2LoraAngles => handle_image_edit_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, CommonImageModel::Flux2LoraAngles, GenerationModel::Flux2LoraAngles).await, + ImageEditModel::GptImage1p5 => handle_image_edit_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, RouterImageModel::GptImage1p5, GenerationModel::GptImage1p5).await, + ImageEditModel::Seedream4 => handle_image_edit_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, RouterImageModel::Seedream4, GenerationModel::Seedream4).await, + ImageEditModel::Seedream4p5 => handle_image_edit_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, RouterImageModel::Seedream4p5, GenerationModel::Seedream4p5).await, + ImageEditModel::Seedream5Lite => handle_image_edit_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, RouterImageModel::Seedream5Lite, GenerationModel::Seedream5Lite).await, + ImageEditModel::QwenEdit2511Angles => handle_image_edit_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, RouterImageModel::QwenEdit2511Angles, GenerationModel::QwenEdit2511Angles).await, + ImageEditModel::Flux2LoraAngles => handle_image_edit_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, RouterImageModel::Flux2LoraAngles, GenerationModel::Flux2LoraAngles).await, } } diff --git a/crates/desktop/artcraft/src/core/commands/deprecated/image_edit/artcraft/handle_image_edit_artcraft_via_router.rs b/crates/desktop/artcraft/src/core/commands/deprecated/image_edit/artcraft/handle_image_edit_artcraft_via_router.rs index a2487f8a36..1d925ba900 100644 --- a/crates/desktop/artcraft/src/core/commands/deprecated/image_edit/artcraft/handle_image_edit_artcraft_via_router.rs +++ b/crates/desktop/artcraft/src/core/commands/deprecated/image_edit/artcraft/handle_image_edit_artcraft_via_router.rs @@ -7,11 +7,11 @@ use crate::core::commands::enqueue::task_enqueue_success::TaskEnqueueSuccess; use crate::core::events::generation_events::common::GenerationModel; use crate::core::state::app_env_configs::app_env_configs::AppEnvConfigs; use crate::services::storyteller::state::storyteller_credential_manager::StorytellerCredentialManager; -use artcraft_router::api::common_aspect_ratio::CommonAspectRatio as RouterCommonAspectRatio; -use artcraft_router::api::common_image_model::CommonImageModel; -use artcraft_router::api::common_resolution::CommonResolution as RouterCommonResolution; +use artcraft_router::api::router_aspect_ratio::RouterAspectRatio; +use artcraft_router::api::router_image_model::RouterImageModel; +use artcraft_router::api::router_resolution::RouterResolution; use artcraft_router::api::image_list_ref::ImageListRef; -use artcraft_router::api::provider::Provider; +use artcraft_router::api::router_provider::RouterProvider; use artcraft_router::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use artcraft_router::client::router_artcraft_client::RouterArtcraftClient; use artcraft_router::client::router_client::RouterClient; @@ -27,7 +27,7 @@ pub(super) async fn handle_image_edit_artcraft_via_router( request: &EnqueueEditImageCommand, app_env_configs: &AppEnvConfigs, storyteller_creds_manager: &StorytellerCredentialManager, - model: CommonImageModel, + model: RouterImageModel, generation_model: GenerationModel, ) -> Result { let creds = match storyteller_creds_manager.get_credentials()? { @@ -68,7 +68,7 @@ pub(super) async fn handle_image_edit_artcraft_via_router( let router_request = GenerateImageRequestBuilder { model, - provider: Provider::Artcraft, + provider: RouterProvider::Artcraft, prompt: Some(request.prompt.clone()), image_inputs, resolution, @@ -122,47 +122,47 @@ pub(super) async fn handle_image_edit_artcraft_via_router( }) } -fn get_aspect_ratio_edit(request: &EnqueueEditImageCommand) -> Option { +fn get_aspect_ratio_edit(request: &EnqueueEditImageCommand) -> Option { if let Some(ar) = request.common_aspect_ratio { return Some(convert_desktop_aspect_ratio(ar)); } if let Some(ar) = request.aspect_ratio { return Some(match ar { - EditImageSize::Auto => RouterCommonAspectRatio::Auto, - EditImageSize::Square => RouterCommonAspectRatio::Square, - EditImageSize::Wide => RouterCommonAspectRatio::Wide, - EditImageSize::Tall => RouterCommonAspectRatio::Tall, + EditImageSize::Auto => RouterAspectRatio::Auto, + EditImageSize::Square => RouterAspectRatio::Square, + EditImageSize::Wide => RouterAspectRatio::Wide, + EditImageSize::Tall => RouterAspectRatio::Tall, }); } None } -fn get_resolution_edit(request: &EnqueueEditImageCommand) -> Option { +fn get_resolution_edit(request: &EnqueueEditImageCommand) -> Option { request.image_resolution.map(|res| match res { - EditImageResolution::OneK => RouterCommonResolution::OneK, - EditImageResolution::TwoK => RouterCommonResolution::TwoK, - EditImageResolution::FourK => RouterCommonResolution::FourK, + EditImageResolution::OneK => RouterResolution::OneK, + EditImageResolution::TwoK => RouterResolution::TwoK, + EditImageResolution::FourK => RouterResolution::FourK, }) } -fn convert_desktop_aspect_ratio(ar: DesktopCommonAspectRatio) -> RouterCommonAspectRatio { +fn convert_desktop_aspect_ratio(ar: DesktopCommonAspectRatio) -> RouterAspectRatio { match ar { - DesktopCommonAspectRatio::Auto => RouterCommonAspectRatio::Auto, - DesktopCommonAspectRatio::Square => RouterCommonAspectRatio::Square, - DesktopCommonAspectRatio::WideThreeByTwo => RouterCommonAspectRatio::WideThreeByTwo, - DesktopCommonAspectRatio::WideFourByThree => RouterCommonAspectRatio::WideFourByThree, - DesktopCommonAspectRatio::WideFiveByFour => RouterCommonAspectRatio::WideFiveByFour, - DesktopCommonAspectRatio::WideSixteenByNine => RouterCommonAspectRatio::WideSixteenByNine, - DesktopCommonAspectRatio::WideTwentyOneByNine => RouterCommonAspectRatio::WideTwentyOneByNine, - DesktopCommonAspectRatio::TallTwoByThree => RouterCommonAspectRatio::TallTwoByThree, - DesktopCommonAspectRatio::TallThreeByFour => RouterCommonAspectRatio::TallThreeByFour, - DesktopCommonAspectRatio::TallFourByFive => RouterCommonAspectRatio::TallFourByFive, - DesktopCommonAspectRatio::TallNineBySixteen => RouterCommonAspectRatio::TallNineBySixteen, - DesktopCommonAspectRatio::TallNineByTwentyOne => RouterCommonAspectRatio::TallNineByTwentyOne, - DesktopCommonAspectRatio::Wide => RouterCommonAspectRatio::Wide, - DesktopCommonAspectRatio::Tall => RouterCommonAspectRatio::Tall, - DesktopCommonAspectRatio::Auto2k => RouterCommonAspectRatio::Auto2k, - DesktopCommonAspectRatio::Auto4k => RouterCommonAspectRatio::Auto4k, - DesktopCommonAspectRatio::SquareHd => RouterCommonAspectRatio::SquareHd, + DesktopCommonAspectRatio::Auto => RouterAspectRatio::Auto, + DesktopCommonAspectRatio::Square => RouterAspectRatio::Square, + DesktopCommonAspectRatio::WideThreeByTwo => RouterAspectRatio::WideThreeByTwo, + DesktopCommonAspectRatio::WideFourByThree => RouterAspectRatio::WideFourByThree, + DesktopCommonAspectRatio::WideFiveByFour => RouterAspectRatio::WideFiveByFour, + DesktopCommonAspectRatio::WideSixteenByNine => RouterAspectRatio::WideSixteenByNine, + DesktopCommonAspectRatio::WideTwentyOneByNine => RouterAspectRatio::WideTwentyOneByNine, + DesktopCommonAspectRatio::TallTwoByThree => RouterAspectRatio::TallTwoByThree, + DesktopCommonAspectRatio::TallThreeByFour => RouterAspectRatio::TallThreeByFour, + DesktopCommonAspectRatio::TallFourByFive => RouterAspectRatio::TallFourByFive, + DesktopCommonAspectRatio::TallNineBySixteen => RouterAspectRatio::TallNineBySixteen, + DesktopCommonAspectRatio::TallNineByTwentyOne => RouterAspectRatio::TallNineByTwentyOne, + DesktopCommonAspectRatio::Wide => RouterAspectRatio::Wide, + DesktopCommonAspectRatio::Tall => RouterAspectRatio::Tall, + DesktopCommonAspectRatio::Auto2k => RouterAspectRatio::Auto2k, + DesktopCommonAspectRatio::Auto4k => RouterAspectRatio::Auto4k, + DesktopCommonAspectRatio::SquareHd => RouterAspectRatio::SquareHd, } } diff --git a/crates/desktop/artcraft/src/core/commands/deprecated/text_to_image/artcraft/handle_text_to_image_artcraft.rs b/crates/desktop/artcraft/src/core/commands/deprecated/text_to_image/artcraft/handle_text_to_image_artcraft.rs index b559e29ec0..09feb45a79 100644 --- a/crates/desktop/artcraft/src/core/commands/deprecated/text_to_image/artcraft/handle_text_to_image_artcraft.rs +++ b/crates/desktop/artcraft/src/core/commands/deprecated/text_to_image/artcraft/handle_text_to_image_artcraft.rs @@ -8,7 +8,7 @@ use crate::core::events::generation_events::common::GenerationModel; use crate::core::state::app_env_configs::app_env_configs::AppEnvConfigs; use crate::core::state::data_dir::app_data_root::AppDataRoot; use crate::services::storyteller::state::storyteller_credential_manager::StorytellerCredentialManager; -use artcraft_router::api::common_image_model::CommonImageModel; +use artcraft_router::api::router_image_model::RouterImageModel; use enums::common::generation_provider::GenerationProvider; use tauri::AppHandle; @@ -31,20 +31,20 @@ pub async fn handle_text_to_image_artcraft( TextToImageModel::Recraft3 => { Err(GenerateError::NotYetImplemented(format!("not yet implemented in Artcraft"))) } - TextToImageModel::Flux1Dev => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, CommonImageModel::Flux1Dev, GenerationModel::Flux1Dev).await, - TextToImageModel::Flux1Schnell => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, CommonImageModel::Flux1Schnell, GenerationModel::Flux1Schnell).await, - TextToImageModel::FluxPro11 => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, CommonImageModel::FluxPro11, GenerationModel::FluxPro11).await, - TextToImageModel::FluxPro11Ultra => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, CommonImageModel::FluxPro11Ultra, GenerationModel::FluxPro11Ultra).await, + TextToImageModel::Flux1Dev => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, RouterImageModel::Flux1Dev, GenerationModel::Flux1Dev).await, + TextToImageModel::Flux1Schnell => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, RouterImageModel::Flux1Schnell, GenerationModel::Flux1Schnell).await, + TextToImageModel::FluxPro11 => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, RouterImageModel::FluxPro11, GenerationModel::FluxPro11).await, + TextToImageModel::FluxPro11Ultra => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, RouterImageModel::FluxPro11Ultra, GenerationModel::FluxPro11Ultra).await, TextToImageModel::GptImage1 => handle_artcraft_gpt_image_1_text_to_image(request, app_env_configs, storyteller_creds_manager).await, - TextToImageModel::GptImage1p5 => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, CommonImageModel::GptImage1p5, GenerationModel::GptImage1p5).await, - TextToImageModel::GptImage2 => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, CommonImageModel::GptImage2, GenerationModel::GptImage2).await, + TextToImageModel::GptImage1p5 => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, RouterImageModel::GptImage1p5, GenerationModel::GptImage1p5).await, + TextToImageModel::GptImage2 => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, RouterImageModel::GptImage2, GenerationModel::GptImage2).await, TextToImageModel::Gemini25Flash | TextToImageModel::NanoBanana => { - handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, CommonImageModel::NanoBanana, GenerationModel::NanoBanana).await + handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, RouterImageModel::NanoBanana, GenerationModel::NanoBanana).await }, - TextToImageModel::NanoBanana2 => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, CommonImageModel::NanoBanana2, GenerationModel::NanoBanana2).await, - TextToImageModel::NanoBananaPro => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, CommonImageModel::NanoBananaPro, GenerationModel::NanoBananaPro).await, - TextToImageModel::Seedream4 => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, CommonImageModel::Seedream4, GenerationModel::Seedream4).await, - TextToImageModel::Seedream4p5 => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, CommonImageModel::Seedream4p5, GenerationModel::Seedream4p5).await, - TextToImageModel::Seedream5Lite => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, CommonImageModel::Seedream5Lite, GenerationModel::Seedream5Lite).await, + TextToImageModel::NanoBanana2 => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, RouterImageModel::NanoBanana2, GenerationModel::NanoBanana2).await, + TextToImageModel::NanoBananaPro => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, RouterImageModel::NanoBananaPro, GenerationModel::NanoBananaPro).await, + TextToImageModel::Seedream4 => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, RouterImageModel::Seedream4, GenerationModel::Seedream4).await, + TextToImageModel::Seedream4p5 => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, RouterImageModel::Seedream4p5, GenerationModel::Seedream4p5).await, + TextToImageModel::Seedream5Lite => handle_text_to_image_artcraft_via_router(request, app_env_configs, storyteller_creds_manager, RouterImageModel::Seedream5Lite, GenerationModel::Seedream5Lite).await, } } diff --git a/crates/desktop/artcraft/src/core/commands/deprecated/text_to_image/artcraft/handle_text_to_image_artcraft_via_router.rs b/crates/desktop/artcraft/src/core/commands/deprecated/text_to_image/artcraft/handle_text_to_image_artcraft_via_router.rs index 000876aea3..3680b8a210 100644 --- a/crates/desktop/artcraft/src/core/commands/deprecated/text_to_image/artcraft/handle_text_to_image_artcraft_via_router.rs +++ b/crates/desktop/artcraft/src/core/commands/deprecated/text_to_image/artcraft/handle_text_to_image_artcraft_via_router.rs @@ -8,12 +8,12 @@ use crate::core::commands::deprecated::text_to_image::enqueue_text_to_image_comm use crate::core::events::generation_events::common::GenerationModel; use crate::core::state::app_env_configs::app_env_configs::AppEnvConfigs; use crate::services::storyteller::state::storyteller_credential_manager::StorytellerCredentialManager; -use artcraft_router::api::common_aspect_ratio::CommonAspectRatio as RouterCommonAspectRatio; -use artcraft_router::api::common_image_model::CommonImageModel; -use artcraft_router::api::common_resolution::CommonResolution as RouterCommonResolution; -use artcraft_router::api::common_quality::CommonQuality as RouterCommonQuality; +use artcraft_router::api::router_aspect_ratio::RouterAspectRatio; +use artcraft_router::api::router_image_model::RouterImageModel; +use artcraft_router::api::router_resolution::RouterResolution; +use artcraft_router::api::router_quality::RouterQuality; use artcraft_router::api::image_list_ref::ImageListRef; -use artcraft_router::api::provider::Provider; +use artcraft_router::api::router_provider::RouterProvider; use artcraft_router::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use artcraft_router::client::router_artcraft_client::RouterArtcraftClient; use artcraft_router::client::router_client::RouterClient; @@ -27,7 +27,7 @@ pub(super) async fn handle_text_to_image_artcraft_via_router( request: &EnqueueTextToImageRequest, app_env_configs: &AppEnvConfigs, storyteller_creds_manager: &StorytellerCredentialManager, - model: CommonImageModel, + model: RouterImageModel, generation_model: GenerationModel, ) -> Result { let creds = match storyteller_creds_manager.get_credentials()? { @@ -48,7 +48,7 @@ pub(super) async fn handle_text_to_image_artcraft_via_router( let router_request = GenerateImageRequestBuilder { model, - provider: Provider::Artcraft, + provider: RouterProvider::Artcraft, prompt: request.prompt.clone(), image_inputs, resolution, @@ -100,70 +100,70 @@ pub(super) async fn handle_text_to_image_artcraft_via_router( }) } -fn get_aspect_ratio_t2i(request: &EnqueueTextToImageRequest) -> Option { +fn get_aspect_ratio_t2i(request: &EnqueueTextToImageRequest) -> Option { if let Some(ar) = request.common_aspect_ratio { return Some(convert_desktop_aspect_ratio(ar)); } if let Some(ar) = request.aspect_ratio { return Some(match ar { - TextToImageSize::Auto => RouterCommonAspectRatio::Auto, - TextToImageSize::Square => RouterCommonAspectRatio::Square, - TextToImageSize::Wide => RouterCommonAspectRatio::Wide, - TextToImageSize::Tall => RouterCommonAspectRatio::Tall, + TextToImageSize::Auto => RouterAspectRatio::Auto, + TextToImageSize::Square => RouterAspectRatio::Square, + TextToImageSize::Wide => RouterAspectRatio::Wide, + TextToImageSize::Tall => RouterAspectRatio::Tall, }); } None } -fn get_resolution_t2i(request: &EnqueueTextToImageRequest) -> Option { +fn get_resolution_t2i(request: &EnqueueTextToImageRequest) -> Option { if let Some(res) = request.common_resolution { return Some(convert_desktop_resolution(res)); } if let Some(res) = request.image_resolution { return Some(match res { - TextToImageResolution::OneK => RouterCommonResolution::OneK, - TextToImageResolution::TwoK => RouterCommonResolution::TwoK, - TextToImageResolution::FourK => RouterCommonResolution::FourK, + TextToImageResolution::OneK => RouterResolution::OneK, + TextToImageResolution::TwoK => RouterResolution::TwoK, + TextToImageResolution::FourK => RouterResolution::FourK, }); } None } -fn get_quality_t2i(request: &EnqueueTextToImageRequest) -> Option { +fn get_quality_t2i(request: &EnqueueTextToImageRequest) -> Option { request.quality.map(|quality| quality.to_artcraft_router_type()) } -fn convert_desktop_aspect_ratio(ar: CommonAspectRatio2) -> RouterCommonAspectRatio { +fn convert_desktop_aspect_ratio(ar: CommonAspectRatio2) -> RouterAspectRatio { match ar { - CommonAspectRatio2::Auto => RouterCommonAspectRatio::Auto, - CommonAspectRatio2::Square => RouterCommonAspectRatio::Square, - CommonAspectRatio2::WideThreeByTwo => RouterCommonAspectRatio::WideThreeByTwo, - CommonAspectRatio2::WideFourByThree => RouterCommonAspectRatio::WideFourByThree, - CommonAspectRatio2::WideFiveByFour => RouterCommonAspectRatio::WideFiveByFour, - CommonAspectRatio2::WideSixteenByNine => RouterCommonAspectRatio::WideSixteenByNine, - CommonAspectRatio2::WideTwentyOneByNine => RouterCommonAspectRatio::WideTwentyOneByNine, - CommonAspectRatio2::TallTwoByThree => RouterCommonAspectRatio::TallTwoByThree, - CommonAspectRatio2::TallThreeByFour => RouterCommonAspectRatio::TallThreeByFour, - CommonAspectRatio2::TallFourByFive => RouterCommonAspectRatio::TallFourByFive, - CommonAspectRatio2::TallNineBySixteen => RouterCommonAspectRatio::TallNineBySixteen, - CommonAspectRatio2::TallNineByTwentyOne => RouterCommonAspectRatio::TallNineByTwentyOne, - CommonAspectRatio2::Wide => RouterCommonAspectRatio::Wide, - CommonAspectRatio2::Tall => RouterCommonAspectRatio::Tall, - CommonAspectRatio2::Auto2k => RouterCommonAspectRatio::Auto2k, - CommonAspectRatio2::Auto4k => RouterCommonAspectRatio::Auto4k, - CommonAspectRatio2::SquareHd => RouterCommonAspectRatio::SquareHd, + CommonAspectRatio2::Auto => RouterAspectRatio::Auto, + CommonAspectRatio2::Square => RouterAspectRatio::Square, + CommonAspectRatio2::WideThreeByTwo => RouterAspectRatio::WideThreeByTwo, + CommonAspectRatio2::WideFourByThree => RouterAspectRatio::WideFourByThree, + CommonAspectRatio2::WideFiveByFour => RouterAspectRatio::WideFiveByFour, + CommonAspectRatio2::WideSixteenByNine => RouterAspectRatio::WideSixteenByNine, + CommonAspectRatio2::WideTwentyOneByNine => RouterAspectRatio::WideTwentyOneByNine, + CommonAspectRatio2::TallTwoByThree => RouterAspectRatio::TallTwoByThree, + CommonAspectRatio2::TallThreeByFour => RouterAspectRatio::TallThreeByFour, + CommonAspectRatio2::TallFourByFive => RouterAspectRatio::TallFourByFive, + CommonAspectRatio2::TallNineBySixteen => RouterAspectRatio::TallNineBySixteen, + CommonAspectRatio2::TallNineByTwentyOne => RouterAspectRatio::TallNineByTwentyOne, + CommonAspectRatio2::Wide => RouterAspectRatio::Wide, + CommonAspectRatio2::Tall => RouterAspectRatio::Tall, + CommonAspectRatio2::Auto2k => RouterAspectRatio::Auto2k, + CommonAspectRatio2::Auto4k => RouterAspectRatio::Auto4k, + CommonAspectRatio2::SquareHd => RouterAspectRatio::SquareHd, } } -fn convert_desktop_resolution(res: CommonResolution2) -> RouterCommonResolution { +fn convert_desktop_resolution(res: CommonResolution2) -> RouterResolution { match res { - CommonResolution2::OneK => RouterCommonResolution::OneK, - CommonResolution2::TwoK => RouterCommonResolution::TwoK, - CommonResolution2::ThreeK => RouterCommonResolution::ThreeK, - CommonResolution2::FourK => RouterCommonResolution::FourK, - CommonResolution2::HalfK => RouterCommonResolution::HalfK, - CommonResolution2::FourEightyP => RouterCommonResolution::FourEightyP, - CommonResolution2::SevenTwentyP => RouterCommonResolution::SevenTwentyP, - CommonResolution2::TenEightyP => RouterCommonResolution::TenEightyP, + CommonResolution2::OneK => RouterResolution::OneK, + CommonResolution2::TwoK => RouterResolution::TwoK, + CommonResolution2::ThreeK => RouterResolution::ThreeK, + CommonResolution2::FourK => RouterResolution::FourK, + CommonResolution2::HalfK => RouterResolution::HalfK, + CommonResolution2::FourEightyP => RouterResolution::FourEightyP, + CommonResolution2::SevenTwentyP => RouterResolution::SevenTwentyP, + CommonResolution2::TenEightyP => RouterResolution::TenEightyP, } } diff --git a/crates/desktop/artcraft/src/core/commands/enqueue/image_to_gaussian/artcraft/handle_artcraft_gaussian.rs b/crates/desktop/artcraft/src/core/commands/enqueue/image_to_gaussian/artcraft/handle_artcraft_gaussian.rs index 188efa4693..0854e8af70 100644 --- a/crates/desktop/artcraft/src/core/commands/enqueue/image_to_gaussian/artcraft/handle_artcraft_gaussian.rs +++ b/crates/desktop/artcraft/src/core/commands/enqueue/image_to_gaussian/artcraft/handle_artcraft_gaussian.rs @@ -6,7 +6,7 @@ use crate::core::commands::enqueue::task_enqueue_success::TaskEnqueueSuccess; use crate::core::events::generation_events::common::GenerationModel; use crate::core::state::app_env_configs::app_env_configs::AppEnvConfigs; use crate::services::storyteller::state::storyteller_credential_manager::StorytellerCredentialManager; -use artcraft_router::api::common_splat_model::CommonSplatModel; +use artcraft_router::api::router_splat_model::RouterSplatModel; use tauri::AppHandle; pub async fn handle_gaussian_artcraft( @@ -20,13 +20,13 @@ pub async fn handle_gaussian_artcraft( match request.model { None => Err(GenerateError::no_model_specified()), Some(GaussianModel::Marble0p1Mini) => { - handle_artcraft_splat_via_router(request, app_env_configs, &creds, CommonSplatModel::Marble0p1Mini, GenerationModel::WorldlabsMarble0p1Mini).await + handle_artcraft_splat_via_router(request, app_env_configs, &creds, RouterSplatModel::Marble0p1Mini, GenerationModel::WorldlabsMarble0p1Mini).await } Some( GaussianModel::Marble0p1Plus | GaussianModel::WorldLabsMarble // Legacy variant — route to Plus ) => { - handle_artcraft_splat_via_router(request, app_env_configs, &creds, CommonSplatModel::Marble0p1Plus, GenerationModel::WorldlabsMarble0p1Plus).await + handle_artcraft_splat_via_router(request, app_env_configs, &creds, RouterSplatModel::Marble0p1Plus, GenerationModel::WorldlabsMarble0p1Plus).await } } } diff --git a/crates/desktop/artcraft/src/core/commands/enqueue/image_to_gaussian/artcraft/handle_artcraft_splat_via_router.rs b/crates/desktop/artcraft/src/core/commands/enqueue/image_to_gaussian/artcraft/handle_artcraft_splat_via_router.rs index 83a6aaa638..0ddb799eb5 100644 --- a/crates/desktop/artcraft/src/core/commands/enqueue/image_to_gaussian/artcraft/handle_artcraft_splat_via_router.rs +++ b/crates/desktop/artcraft/src/core/commands/enqueue/image_to_gaussian/artcraft/handle_artcraft_splat_via_router.rs @@ -4,9 +4,9 @@ use crate::core::commands::enqueue::task_enqueue_success::TaskEnqueueSuccess; use crate::core::events::generation_events::common::GenerationModel; use crate::core::state::app_env_configs::app_env_configs::AppEnvConfigs; use artcraft_client::credentials::storyteller_credential_set::StorytellerCredentialSet; -use artcraft_router::api::common_splat_model::CommonSplatModel; +use artcraft_router::api::router_splat_model::RouterSplatModel; use artcraft_router::api::image_list_ref::ImageListRef; -use artcraft_router::api::provider::Provider; +use artcraft_router::api::router_provider::RouterProvider; use artcraft_router::client::router_artcraft_client::RouterArtcraftClient; use artcraft_router::client::router_client::RouterClient; use artcraft_router::generate::generate_splat::generate_splat_request::GenerateSplatRequest; @@ -18,7 +18,7 @@ pub(super) async fn handle_artcraft_splat_via_router( request: &EnqueueImageToGaussianRequest, app_env_configs: &AppEnvConfigs, creds: &StorytellerCredentialSet, - model: CommonSplatModel, + model: RouterSplatModel, generation_model: GenerationModel, ) -> Result { let client = RouterClient::Artcraft(RouterArtcraftClient::new( @@ -28,7 +28,7 @@ pub(super) async fn handle_artcraft_splat_via_router( let router_request = GenerateSplatRequest { model, - provider: Provider::Artcraft, + provider: RouterProvider::Artcraft, prompt: request.prompt.clone(), reference_images: request.image_media_tokens.clone().map(ImageListRef::MediaFileTokens), idempotency_token: None, diff --git a/crates/desktop/artcraft/src/core/commands/generate/common/router_image_request_to_artcraft_prompt.rs b/crates/desktop/artcraft/src/core/commands/generate/common/router_image_request_to_artcraft_prompt.rs index 0a3efba6df..5f03e3f3b6 100644 --- a/crates/desktop/artcraft/src/core/commands/generate/common/router_image_request_to_artcraft_prompt.rs +++ b/crates/desktop/artcraft/src/core/commands/generate/common/router_image_request_to_artcraft_prompt.rs @@ -1,8 +1,8 @@ use artcraft_api_defs::prompts::create_prompt::CreatePromptRequest; -use artcraft_router::api::common_aspect_ratio::CommonAspectRatio as RouterAspectRatio; -use artcraft_router::api::common_image_model::CommonImageModel; -use artcraft_router::api::common_resolution::CommonResolution as RouterResolution; -use artcraft_router::api::provider::Provider; +use artcraft_router::api::router_aspect_ratio::RouterAspectRatio; +use artcraft_router::api::router_image_model::RouterImageModel; +use artcraft_router::api::router_resolution::RouterResolution; +use artcraft_router::api::router_provider::RouterProvider; use artcraft_router::generate::generate_image::generate_image_request_builder::GenerateImageRequestBuilder; use enums::common::generation::common_aspect_ratio::CommonAspectRatio as EnumsAspectRatio; use enums::common::generation::common_generation_mode::CommonGenerationMode; @@ -39,36 +39,36 @@ fn determine_image_generation_mode(request: &GenerateImageRequestBuilder) -> Com } } -fn image_model_to_common_model_type(model: CommonImageModel) -> Option { +fn image_model_to_common_model_type(model: RouterImageModel) -> Option { match model { - CommonImageModel::Flux1Dev => Some(CommonModelType::Flux1Dev), - CommonImageModel::Flux1Schnell => Some(CommonModelType::Flux1Schnell), - CommonImageModel::FluxPro11 => Some(CommonModelType::FluxPro11), - CommonImageModel::FluxPro11Ultra => Some(CommonModelType::FluxPro11Ultra), - CommonImageModel::GptImage1 => Some(CommonModelType::GptImage1), - CommonImageModel::GptImage1p5 => Some(CommonModelType::GptImage1p5), - CommonImageModel::GptImage2 => Some(CommonModelType::GptImage2), - CommonImageModel::NanoBanana => Some(CommonModelType::NanoBanana), - CommonImageModel::NanoBanana2 => Some(CommonModelType::NanoBanana2), - CommonImageModel::NanoBananaPro => Some(CommonModelType::NanoBananaPro), - CommonImageModel::Seedream4 => Some(CommonModelType::Seedream4), - CommonImageModel::Seedream4p5 => Some(CommonModelType::Seedream4p5), - CommonImageModel::Seedream5Lite => Some(CommonModelType::Seedream5Lite), - CommonImageModel::QwenEdit2511Angles => Some(CommonModelType::QwenEdit2511Angles), - CommonImageModel::Flux2LoraAngles => Some(CommonModelType::Flux2LoraAngles), - CommonImageModel::GrokImagineImage => Some(CommonModelType::GrokImagineImage), - CommonImageModel::GrokImagineImageQuality => Some(CommonModelType::GrokImagineImageQuality), + RouterImageModel::Flux1Dev => Some(CommonModelType::Flux1Dev), + RouterImageModel::Flux1Schnell => Some(CommonModelType::Flux1Schnell), + RouterImageModel::FluxPro11 => Some(CommonModelType::FluxPro11), + RouterImageModel::FluxPro11Ultra => Some(CommonModelType::FluxPro11Ultra), + RouterImageModel::GptImage1 => Some(CommonModelType::GptImage1), + RouterImageModel::GptImage1p5 => Some(CommonModelType::GptImage1p5), + RouterImageModel::GptImage2 => Some(CommonModelType::GptImage2), + RouterImageModel::NanoBanana => Some(CommonModelType::NanoBanana), + RouterImageModel::NanoBanana2 => Some(CommonModelType::NanoBanana2), + RouterImageModel::NanoBananaPro => Some(CommonModelType::NanoBananaPro), + RouterImageModel::Seedream4 => Some(CommonModelType::Seedream4), + RouterImageModel::Seedream4p5 => Some(CommonModelType::Seedream4p5), + RouterImageModel::Seedream5Lite => Some(CommonModelType::Seedream5Lite), + RouterImageModel::QwenEdit2511Angles => Some(CommonModelType::QwenEdit2511Angles), + RouterImageModel::Flux2LoraAngles => Some(CommonModelType::Flux2LoraAngles), + RouterImageModel::GrokImagineImage => Some(CommonModelType::GrokImagineImage), + RouterImageModel::GrokImagineImageQuality => Some(CommonModelType::GrokImagineImageQuality), } } -fn provider_to_generation_provider(provider: Provider) -> GenerationProvider { +fn provider_to_generation_provider(provider: RouterProvider) -> GenerationProvider { match provider { - Provider::Artcraft => GenerationProvider::Artcraft, - Provider::Fal => GenerationProvider::Fal, + RouterProvider::Artcraft => GenerationProvider::Artcraft, + RouterProvider::Fal => GenerationProvider::Fal, // Unused providers -> ArtCraft - Provider::Seedance2Pro => GenerationProvider::Artcraft , - Provider::GmiCloud => GenerationProvider::Artcraft, - Provider::GrokApi => GenerationProvider::Artcraft, + RouterProvider::Seedance2Pro => GenerationProvider::Artcraft , + RouterProvider::GmiCloud => GenerationProvider::Artcraft, + RouterProvider::GrokApi => GenerationProvider::Artcraft, } } @@ -115,8 +115,8 @@ mod tests { fn base_builder() -> GenerateImageRequestBuilder { GenerateImageRequestBuilder { - model: CommonImageModel::NanoBananaPro, - provider: Provider::Fal, + model: RouterImageModel::NanoBananaPro, + provider: RouterProvider::Fal, prompt: Some("a cat in space".to_string()), image_inputs: None, resolution: None, @@ -192,11 +192,11 @@ mod tests { #[test] fn all_image_models_map() { let models = [ - (CommonImageModel::Flux1Dev, CommonModelType::Flux1Dev), - (CommonImageModel::Flux1Schnell, CommonModelType::Flux1Schnell), - (CommonImageModel::NanoBananaPro, CommonModelType::NanoBananaPro), - (CommonImageModel::GptImage1, CommonModelType::GptImage1), - (CommonImageModel::Seedream4, CommonModelType::Seedream4), + (RouterImageModel::Flux1Dev, CommonModelType::Flux1Dev), + (RouterImageModel::Flux1Schnell, CommonModelType::Flux1Schnell), + (RouterImageModel::NanoBananaPro, CommonModelType::NanoBananaPro), + (RouterImageModel::GptImage1, CommonModelType::GptImage1), + (RouterImageModel::Seedream4, CommonModelType::Seedream4), ]; for (router_model, expected) in models { let builder = GenerateImageRequestBuilder { model: router_model, ..base_builder() }; @@ -207,7 +207,7 @@ mod tests { #[test] fn provider_mapping() { - let builder = GenerateImageRequestBuilder { provider: Provider::Artcraft, ..base_builder() }; + let builder = GenerateImageRequestBuilder { provider: RouterProvider::Artcraft, ..base_builder() }; let prompt = router_image_request_to_artcraft_prompt(&builder); assert_eq!(prompt.generation_provider, Some(GenerationProvider::Artcraft)); } diff --git a/crates/desktop/artcraft/src/core/commands/generate/common/router_video_request_to_artcraft_prompt.rs b/crates/desktop/artcraft/src/core/commands/generate/common/router_video_request_to_artcraft_prompt.rs index 5733313a4a..54a03842f1 100644 --- a/crates/desktop/artcraft/src/core/commands/generate/common/router_video_request_to_artcraft_prompt.rs +++ b/crates/desktop/artcraft/src/core/commands/generate/common/router_video_request_to_artcraft_prompt.rs @@ -1,8 +1,8 @@ use artcraft_api_defs::prompts::create_prompt::CreatePromptRequest; -use artcraft_router::api::common_aspect_ratio::CommonAspectRatio as RouterAspectRatio; -use artcraft_router::api::common_resolution::CommonResolution as RouterResolution; -use artcraft_router::api::common_video_model::CommonVideoModel; -use artcraft_router::api::provider::Provider; +use artcraft_router::api::router_aspect_ratio::RouterAspectRatio; +use artcraft_router::api::router_resolution::RouterResolution; +use artcraft_router::api::router_video_model::RouterVideoModel; +use artcraft_router::api::router_provider::RouterProvider; use artcraft_router::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use enums::common::generation::common_aspect_ratio::CommonAspectRatio as EnumsAspectRatio; use enums::common::generation::common_generation_mode::CommonGenerationMode; @@ -46,46 +46,46 @@ fn determine_video_generation_mode(request: &GenerateVideoRequestBuilder) -> Com } } -fn video_model_to_common_model_type(model: CommonVideoModel) -> Option { +fn video_model_to_common_model_type(model: RouterVideoModel) -> Option { match model { - CommonVideoModel::GrokVideo => Some(CommonModelType::GrokVideo), - CommonVideoModel::Kling16Pro => Some(CommonModelType::Kling16Pro), - CommonVideoModel::Kling21Pro => Some(CommonModelType::Kling21Pro), - CommonVideoModel::Kling21Master => Some(CommonModelType::Kling21Master), - CommonVideoModel::Kling2p5TurboPro => Some(CommonModelType::Kling2p5TurboPro), - CommonVideoModel::Kling2p6Pro => Some(CommonModelType::Kling2p6Pro), - CommonVideoModel::Kling3p0Standard => Some(CommonModelType::Kling3p0Standard), - CommonVideoModel::Kling3p0Pro => Some(CommonModelType::Kling3p0Pro), - CommonVideoModel::Seedance10Lite => Some(CommonModelType::Seedance10Lite), - CommonVideoModel::Seedance1p5Pro => Some(CommonModelType::Seedance1p5Pro), - CommonVideoModel::Seedance2p0 => Some(CommonModelType::Seedance2p0), - CommonVideoModel::Seedance2p0Fast => Some(CommonModelType::Seedance2p0Fast), - CommonVideoModel::HappyHorse1p0 => Some(CommonModelType::HappyHorse1p0), - CommonVideoModel::Sora2 => Some(CommonModelType::Sora2), - CommonVideoModel::Sora2Pro => Some(CommonModelType::Sora2Pro), - CommonVideoModel::Veo2 => Some(CommonModelType::Veo2), - CommonVideoModel::Veo3 => Some(CommonModelType::Veo3), - CommonVideoModel::Veo3Fast => Some(CommonModelType::Veo3Fast), - CommonVideoModel::Veo3p1 => Some(CommonModelType::Veo3p1), - CommonVideoModel::Veo3p1Fast => Some(CommonModelType::Veo3p1Fast), - CommonVideoModel::Seedance2p0BytePlus => Some(CommonModelType::Seedance2p0BytePlus), - CommonVideoModel::Seedance2p0BytePlusFast => Some(CommonModelType::Seedance2p0BytePlusFast), - CommonVideoModel::Seedance2p0Ultra => Some(CommonModelType::Seedance2p0Ultra), - CommonVideoModel::Seedance2p0UltraFast => Some(CommonModelType::Seedance2p0UltraFast), - CommonVideoModel::PreviewModel => Some(CommonModelType::PreviewModel), - CommonVideoModel::PreviewModelFast => Some(CommonModelType::PreviewModelFast), - CommonVideoModel::GrokImagineVideo => Some(CommonModelType::GrokImagineVideo), + RouterVideoModel::GrokVideo => Some(CommonModelType::GrokVideo), + RouterVideoModel::Kling16Pro => Some(CommonModelType::Kling16Pro), + RouterVideoModel::Kling21Pro => Some(CommonModelType::Kling21Pro), + RouterVideoModel::Kling21Master => Some(CommonModelType::Kling21Master), + RouterVideoModel::Kling2p5TurboPro => Some(CommonModelType::Kling2p5TurboPro), + RouterVideoModel::Kling2p6Pro => Some(CommonModelType::Kling2p6Pro), + RouterVideoModel::Kling3p0Standard => Some(CommonModelType::Kling3p0Standard), + RouterVideoModel::Kling3p0Pro => Some(CommonModelType::Kling3p0Pro), + RouterVideoModel::Seedance10Lite => Some(CommonModelType::Seedance10Lite), + RouterVideoModel::Seedance1p5Pro => Some(CommonModelType::Seedance1p5Pro), + RouterVideoModel::Seedance2p0 => Some(CommonModelType::Seedance2p0), + RouterVideoModel::Seedance2p0Fast => Some(CommonModelType::Seedance2p0Fast), + RouterVideoModel::HappyHorse1p0 => Some(CommonModelType::HappyHorse1p0), + RouterVideoModel::Sora2 => Some(CommonModelType::Sora2), + RouterVideoModel::Sora2Pro => Some(CommonModelType::Sora2Pro), + RouterVideoModel::Veo2 => Some(CommonModelType::Veo2), + RouterVideoModel::Veo3 => Some(CommonModelType::Veo3), + RouterVideoModel::Veo3Fast => Some(CommonModelType::Veo3Fast), + RouterVideoModel::Veo3p1 => Some(CommonModelType::Veo3p1), + RouterVideoModel::Veo3p1Fast => Some(CommonModelType::Veo3p1Fast), + RouterVideoModel::Seedance2p0BytePlus => Some(CommonModelType::Seedance2p0BytePlus), + RouterVideoModel::Seedance2p0BytePlusFast => Some(CommonModelType::Seedance2p0BytePlusFast), + RouterVideoModel::Seedance2p0Ultra => Some(CommonModelType::Seedance2p0Ultra), + RouterVideoModel::Seedance2p0UltraFast => Some(CommonModelType::Seedance2p0UltraFast), + RouterVideoModel::PreviewModel => Some(CommonModelType::PreviewModel), + RouterVideoModel::PreviewModelFast => Some(CommonModelType::PreviewModelFast), + RouterVideoModel::GrokImagineVideo => Some(CommonModelType::GrokImagineVideo), } } -fn provider_to_generation_provider(provider: Provider) -> GenerationProvider { +fn provider_to_generation_provider(provider: RouterProvider) -> GenerationProvider { match provider { - Provider::Artcraft => GenerationProvider::Artcraft, - Provider::Fal => GenerationProvider::Fal, + RouterProvider::Artcraft => GenerationProvider::Artcraft, + RouterProvider::Fal => GenerationProvider::Fal, // Unused providers -> ArtCraft - Provider::Seedance2Pro => GenerationProvider::Artcraft , - Provider::GmiCloud => GenerationProvider::Artcraft, - Provider::GrokApi => GenerationProvider::Artcraft, + RouterProvider::Seedance2Pro => GenerationProvider::Artcraft , + RouterProvider::GmiCloud => GenerationProvider::Artcraft, + RouterProvider::GrokApi => GenerationProvider::Artcraft, } } @@ -131,8 +131,8 @@ mod tests { fn base_builder() -> GenerateVideoRequestBuilder { GenerateVideoRequestBuilder { - model: CommonVideoModel::Kling3p0Standard, - provider: Provider::Fal, + model: RouterVideoModel::Kling3p0Standard, + provider: RouterProvider::Fal, prompt: Some("a dog running on the beach".to_string()), negative_prompt: None, start_frame: None, @@ -244,10 +244,10 @@ mod tests { #[test] fn video_model_mapping() { let models = [ - (CommonVideoModel::Kling3p0Standard, CommonModelType::Kling3p0Standard), - (CommonVideoModel::Veo3, CommonModelType::Veo3), - (CommonVideoModel::Seedance2p0, CommonModelType::Seedance2p0), - (CommonVideoModel::Sora2, CommonModelType::Sora2), + (RouterVideoModel::Kling3p0Standard, CommonModelType::Kling3p0Standard), + (RouterVideoModel::Veo3, CommonModelType::Veo3), + (RouterVideoModel::Seedance2p0, CommonModelType::Seedance2p0), + (RouterVideoModel::Sora2, CommonModelType::Sora2), ]; for (router_model, expected) in models { let builder = GenerateVideoRequestBuilder { model: router_model, ..base_builder() }; diff --git a/crates/desktop/artcraft/src/core/commands/generate/generate_image/providers/artcraft/legacy/artcraft_flux_2_lora_angles.rs b/crates/desktop/artcraft/src/core/commands/generate/generate_image/providers/artcraft/legacy/artcraft_flux_2_lora_angles.rs index 3bdbf2f24d..2bd967eabc 100644 --- a/crates/desktop/artcraft/src/core/commands/generate/generate_image/providers/artcraft/legacy/artcraft_flux_2_lora_angles.rs +++ b/crates/desktop/artcraft/src/core/commands/generate/generate_image/providers/artcraft/legacy/artcraft_flux_2_lora_angles.rs @@ -1,9 +1,9 @@ use log::{error, info}; use artcraft_client::credentials::storyteller_credential_set::StorytellerCredentialSet; -use artcraft_router::api::common_image_model::CommonImageModel; +use artcraft_router::api::router_image_model::RouterImageModel; use artcraft_router::api::image_list_ref::ImageListRef; -use artcraft_router::api::provider::Provider; +use artcraft_router::api::router_provider::RouterProvider; use artcraft_router::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use artcraft_router::client::router_artcraft_client::RouterArtcraftClient; use artcraft_router::client::router_client::RouterClient; @@ -34,8 +34,8 @@ pub async fn handle_flux_2_lora_angles( let image_inputs = build_image_inputs(request, semantic_media_files); let router_request = GenerateImageRequestBuilder { - model: CommonImageModel::Flux2LoraAngles, - provider: Provider::Artcraft, + model: RouterImageModel::Flux2LoraAngles, + provider: RouterProvider::Artcraft, prompt: request.prompt.clone(), image_inputs, resolution: None, diff --git a/crates/desktop/artcraft/src/core/commands/generate/generate_image/providers/artcraft/legacy/artcraft_qwen_edit_2511_angles.rs b/crates/desktop/artcraft/src/core/commands/generate/generate_image/providers/artcraft/legacy/artcraft_qwen_edit_2511_angles.rs index 89c643bb61..7512d3a219 100644 --- a/crates/desktop/artcraft/src/core/commands/generate/generate_image/providers/artcraft/legacy/artcraft_qwen_edit_2511_angles.rs +++ b/crates/desktop/artcraft/src/core/commands/generate/generate_image/providers/artcraft/legacy/artcraft_qwen_edit_2511_angles.rs @@ -1,9 +1,9 @@ use log::{error, info}; use artcraft_client::credentials::storyteller_credential_set::StorytellerCredentialSet; -use artcraft_router::api::common_image_model::CommonImageModel; +use artcraft_router::api::router_image_model::RouterImageModel; use artcraft_router::api::image_list_ref::ImageListRef; -use artcraft_router::api::provider::Provider; +use artcraft_router::api::router_provider::RouterProvider; use artcraft_router::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use artcraft_router::client::router_artcraft_client::RouterArtcraftClient; use artcraft_router::client::router_client::RouterClient; @@ -34,8 +34,8 @@ pub async fn handle_qwen_edit_2511_angles( let image_inputs = build_image_inputs(request, semantic_media_files); let router_request = GenerateImageRequestBuilder { - model: CommonImageModel::QwenEdit2511Angles, - provider: Provider::Artcraft, + model: RouterImageModel::QwenEdit2511Angles, + provider: RouterProvider::Artcraft, prompt: request.prompt.clone(), image_inputs, resolution: None, diff --git a/crates/desktop/artcraft/src/core/commands/generate/generate_image/providers/artcraft_router/handle_api_providers.rs b/crates/desktop/artcraft/src/core/commands/generate/generate_image/providers/artcraft_router/handle_api_providers.rs index e842f8bc9e..e151a0fed2 100644 --- a/crates/desktop/artcraft/src/core/commands/generate/generate_image/providers/artcraft_router/handle_api_providers.rs +++ b/crates/desktop/artcraft/src/core/commands/generate/generate_image/providers/artcraft_router/handle_api_providers.rs @@ -1,7 +1,7 @@ use artcraft_client::endpoints::prompts::create_prompt::create_prompt; use artcraft_client::utils::api_host::ApiHost; use artcraft_router::api::image_list_ref::ImageListRef; -use artcraft_router::api::provider::Provider; +use artcraft_router::api::router_provider::RouterProvider; use artcraft_router::client::generation_mode_mismatch_strategy::GenerationModeMismatchStrategy; use artcraft_router::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use artcraft_router::client::router_client::RouterClient; @@ -68,7 +68,7 @@ async fn handle_fal( let router_request = GenerateImageRequestBuilder { model: router_model, - provider: Provider::Fal, + provider: RouterProvider::Fal, prompt: request.prompt.clone(), image_inputs, resolution: request.resolution.map(convert_resolution), diff --git a/crates/desktop/artcraft/src/core/commands/generate/generate_image/providers/artcraft_router/utils/convert_enums_to_router.rs b/crates/desktop/artcraft/src/core/commands/generate/generate_image/providers/artcraft_router/utils/convert_enums_to_router.rs index f81bbd5779..33c23040fa 100644 --- a/crates/desktop/artcraft/src/core/commands/generate/generate_image/providers/artcraft_router/utils/convert_enums_to_router.rs +++ b/crates/desktop/artcraft/src/core/commands/generate/generate_image/providers/artcraft_router/utils/convert_enums_to_router.rs @@ -1,6 +1,6 @@ -use artcraft_router::api::common_aspect_ratio::CommonAspectRatio as RouterAspectRatio; -use artcraft_router::api::common_quality::CommonQuality as RouterQuality; -use artcraft_router::api::common_resolution::CommonResolution as RouterResolution; +use artcraft_router::api::router_aspect_ratio::RouterAspectRatio; +use artcraft_router::api::router_quality::RouterQuality; +use artcraft_router::api::router_resolution::RouterResolution; use enums::common::generation::common_aspect_ratio::CommonAspectRatio as EnumsAspectRatio; use enums::common::generation::common_quality::CommonQuality as EnumsQuality; use enums::common::generation::common_resolution::CommonResolution as EnumsResolution; diff --git a/crates/desktop/artcraft/src/core/commands/generate/generate_video/artcraft/handle_artcraft_video.rs b/crates/desktop/artcraft/src/core/commands/generate/generate_video/artcraft/handle_artcraft_video.rs index 5bc8e45424..45d9da305c 100644 --- a/crates/desktop/artcraft/src/core/commands/generate/generate_video/artcraft/handle_artcraft_video.rs +++ b/crates/desktop/artcraft/src/core/commands/generate/generate_video/artcraft/handle_artcraft_video.rs @@ -7,7 +7,7 @@ use crate::core::events::generation_events::common::GenerationModel; use crate::core::state::app_env_configs::app_env_configs::AppEnvConfigs; use crate::services::storyteller::state::storyteller_credential_manager::StorytellerCredentialManager; use anyhow::anyhow; -use artcraft_router::api::common_video_model::CommonVideoModel; +use artcraft_router::api::router_video_model::RouterVideoModel; use tauri::AppHandle; pub async fn handle_video_artcraft( @@ -21,25 +21,25 @@ pub async fn handle_video_artcraft( let (router_model, generation_model) = match request.model { None => return Err(GenerateError::no_model_specified()), - Some(TauriVideoModel::HappyHorse1p0) => (CommonVideoModel::HappyHorse1p0, GenerationModel::HappyHorse1p0), - Some(TauriVideoModel::Kling16Pro) => (CommonVideoModel::Kling16Pro, GenerationModel::Kling1_6), - Some(TauriVideoModel::Kling21Master) => (CommonVideoModel::Kling21Master, GenerationModel::Kling21Master), - Some(TauriVideoModel::Kling21Pro) => (CommonVideoModel::Kling21Pro, GenerationModel::Kling21Pro), - Some(TauriVideoModel::Kling2p5TurboPro) => (CommonVideoModel::Kling2p5TurboPro, GenerationModel::Kling2p5TurboPro), - Some(TauriVideoModel::Kling2p6Pro) => (CommonVideoModel::Kling2p6Pro, GenerationModel::Kling2p6Pro), - Some(TauriVideoModel::Kling3p0Pro) => (CommonVideoModel::Kling3p0Pro, GenerationModel::Kling3p0Pro), - Some(TauriVideoModel::Kling3p0Standard) => (CommonVideoModel::Kling3p0Standard, GenerationModel::Kling3p0Standard), - Some(TauriVideoModel::Seedance10Lite) => (CommonVideoModel::Seedance10Lite, GenerationModel::Seedance10Lite), - Some(TauriVideoModel::Seedance1p5Pro) => (CommonVideoModel::Seedance1p5Pro, GenerationModel::Seedance1p5Pro), - Some(TauriVideoModel::Seedance2p0) => (CommonVideoModel::Seedance2p0, GenerationModel::Seedance2p0), - Some(TauriVideoModel::Seedance2p0Fast) => (CommonVideoModel::Seedance2p0Fast, GenerationModel::Seedance2p0Fast), - Some(TauriVideoModel::Sora2) => (CommonVideoModel::Sora2, GenerationModel::Sora2), - Some(TauriVideoModel::Sora2Pro) => (CommonVideoModel::Sora2Pro, GenerationModel::Sora2Pro), - Some(TauriVideoModel::Veo2) => (CommonVideoModel::Veo2, GenerationModel::Veo2), - Some(TauriVideoModel::Veo3) => (CommonVideoModel::Veo3, GenerationModel::Veo3), - Some(TauriVideoModel::Veo3Fast) => (CommonVideoModel::Veo3Fast, GenerationModel::Veo3Fast), - Some(TauriVideoModel::Veo3p1) => (CommonVideoModel::Veo3p1, GenerationModel::Veo3p1), - Some(TauriVideoModel::Veo3p1Fast) => (CommonVideoModel::Veo3p1Fast, GenerationModel::Veo3p1Fast), + Some(TauriVideoModel::HappyHorse1p0) => (RouterVideoModel::HappyHorse1p0, GenerationModel::HappyHorse1p0), + Some(TauriVideoModel::Kling16Pro) => (RouterVideoModel::Kling16Pro, GenerationModel::Kling1_6), + Some(TauriVideoModel::Kling21Master) => (RouterVideoModel::Kling21Master, GenerationModel::Kling21Master), + Some(TauriVideoModel::Kling21Pro) => (RouterVideoModel::Kling21Pro, GenerationModel::Kling21Pro), + Some(TauriVideoModel::Kling2p5TurboPro) => (RouterVideoModel::Kling2p5TurboPro, GenerationModel::Kling2p5TurboPro), + Some(TauriVideoModel::Kling2p6Pro) => (RouterVideoModel::Kling2p6Pro, GenerationModel::Kling2p6Pro), + Some(TauriVideoModel::Kling3p0Pro) => (RouterVideoModel::Kling3p0Pro, GenerationModel::Kling3p0Pro), + Some(TauriVideoModel::Kling3p0Standard) => (RouterVideoModel::Kling3p0Standard, GenerationModel::Kling3p0Standard), + Some(TauriVideoModel::Seedance10Lite) => (RouterVideoModel::Seedance10Lite, GenerationModel::Seedance10Lite), + Some(TauriVideoModel::Seedance1p5Pro) => (RouterVideoModel::Seedance1p5Pro, GenerationModel::Seedance1p5Pro), + Some(TauriVideoModel::Seedance2p0) => (RouterVideoModel::Seedance2p0, GenerationModel::Seedance2p0), + Some(TauriVideoModel::Seedance2p0Fast) => (RouterVideoModel::Seedance2p0Fast, GenerationModel::Seedance2p0Fast), + Some(TauriVideoModel::Sora2) => (RouterVideoModel::Sora2, GenerationModel::Sora2), + Some(TauriVideoModel::Sora2Pro) => (RouterVideoModel::Sora2Pro, GenerationModel::Sora2Pro), + Some(TauriVideoModel::Veo2) => (RouterVideoModel::Veo2, GenerationModel::Veo2), + Some(TauriVideoModel::Veo3) => (RouterVideoModel::Veo3, GenerationModel::Veo3), + Some(TauriVideoModel::Veo3Fast) => (RouterVideoModel::Veo3Fast, GenerationModel::Veo3Fast), + Some(TauriVideoModel::Veo3p1) => (RouterVideoModel::Veo3p1, GenerationModel::Veo3p1), + Some(TauriVideoModel::Veo3p1Fast) => (RouterVideoModel::Veo3p1Fast, GenerationModel::Veo3p1Fast), Some(other) => return Err(GenerateError::AnyhowError( anyhow!("wrong logic: another branch should handle this: {:?}", other))), }; diff --git a/crates/desktop/artcraft/src/core/commands/generate/generate_video/artcraft/handle_artcraft_video_via_router.rs b/crates/desktop/artcraft/src/core/commands/generate/generate_video/artcraft/handle_artcraft_video_via_router.rs index d991ec0437..5b0bdd2d59 100644 --- a/crates/desktop/artcraft/src/core/commands/generate/generate_video/artcraft/handle_artcraft_video_via_router.rs +++ b/crates/desktop/artcraft/src/core/commands/generate/generate_video/artcraft/handle_artcraft_video_via_router.rs @@ -6,10 +6,10 @@ use crate::core::state::app_env_configs::app_env_configs::AppEnvConfigs; use artcraft_client::credentials::storyteller_credential_set::StorytellerCredentialSet; use artcraft_router::api::audio_list_ref::AudioListRef; use artcraft_router::api::character_list_ref::CharacterListRef; -use artcraft_router::api::common_video_model::CommonVideoModel; +use artcraft_router::api::router_video_model::RouterVideoModel; use artcraft_router::api::image_list_ref::ImageListRef; use artcraft_router::api::image_ref::ImageRef; -use artcraft_router::api::provider::Provider; +use artcraft_router::api::router_provider::RouterProvider; use artcraft_router::api::video_list_ref::VideoListRef; use artcraft_router::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use artcraft_router::client::router_artcraft_client::RouterArtcraftClient; @@ -25,7 +25,7 @@ pub(super) async fn handle_artcraft_video_via_router( request: &TauriGenerateVideoRequest, app_env_configs: &AppEnvConfigs, creds: &StorytellerCredentialSet, - model: CommonVideoModel, + model: RouterVideoModel, generation_model: GenerationModel, ) -> Result { let client = RouterClient::Artcraft(RouterArtcraftClient::new( @@ -44,7 +44,7 @@ pub(super) async fn handle_artcraft_video_via_router( let router_request = GenerateVideoRequestBuilder { model, - provider: Provider::Artcraft, + provider: RouterProvider::Artcraft, prompt: request.prompt.clone(), start_frame, end_frame, diff --git a/crates/desktop/artcraft/src/core/commands/generate/generate_video/request.rs b/crates/desktop/artcraft/src/core/commands/generate/generate_video/request.rs index 1e2412f8cc..e03581ca6c 100644 --- a/crates/desktop/artcraft/src/core/commands/generate/generate_video/request.rs +++ b/crates/desktop/artcraft/src/core/commands/generate/generate_video/request.rs @@ -1,5 +1,5 @@ -use artcraft_router::api::common_aspect_ratio::CommonAspectRatio; -use artcraft_router::api::common_resolution::CommonResolution; +use artcraft_router::api::router_aspect_ratio::RouterAspectRatio; +use artcraft_router::api::router_resolution::RouterResolution; use enums::common::generation_provider::GenerationProvider; use enums::tauri::ux::tauri_command_caller::TauriCommandCaller; use serde_derive::{Deserialize, Serialize}; @@ -93,8 +93,8 @@ pub struct TauriGenerateVideoRequest { pub reference_audio_media_tokens: Option>, pub reference_character_tokens: Option>, - pub aspect_ratio: Option, - pub resolution: Option, + pub aspect_ratio: Option, + pub resolution: Option, pub duration_seconds: Option, pub generate_audio: Option, diff --git a/crates/schema/public/enums/src/common/generation/common_image_model.rs b/crates/schema/public/enums/src/common/generation/common_image_model.rs index d7dea22c08..8d75435a1a 100644 --- a/crates/schema/public/enums/src/common/generation/common_image_model.rs +++ b/crates/schema/public/enums/src/common/generation/common_image_model.rs @@ -6,7 +6,7 @@ use strum::EnumCount; use strum::EnumIter; /// Image models available for generation. -/// Mirrors artcraft_router::api::common_image_model::CommonImageModel. +/// Mirrors artcraft_router::api::router_image_model::RouterImageModel. #[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize, ToSchema)] #[cfg_attr(test, derive(EnumIter, EnumCount))] #[serde(rename_all = "snake_case")] diff --git a/crates/schema/public/enums/src/common/generation/common_splat_model.rs b/crates/schema/public/enums/src/common/generation/common_splat_model.rs index 736800752a..1db4fd2953 100644 --- a/crates/schema/public/enums/src/common/generation/common_splat_model.rs +++ b/crates/schema/public/enums/src/common/generation/common_splat_model.rs @@ -1,7 +1,7 @@ use utoipa::ToSchema; /// Splat models available for generation. -/// Mirrors artcraft_router::api::common_splat_model::CommonSplatModel. +/// Mirrors artcraft_router::api::router_splat_model::RouterSplatModel. #[derive(Copy, Clone, Debug, Serialize, Deserialize, ToSchema)] #[serde(rename_all = "snake_case")] pub enum CommonSplatModel { diff --git a/crates/schema/public/enums/src/common/generation/common_video_model.rs b/crates/schema/public/enums/src/common/generation/common_video_model.rs index ee1e6132cb..8020fc9b47 100644 --- a/crates/schema/public/enums/src/common/generation/common_video_model.rs +++ b/crates/schema/public/enums/src/common/generation/common_video_model.rs @@ -1,7 +1,7 @@ use utoipa::ToSchema; /// Video models available for generation. -/// Mirrors artcraft_router::api::common_video_model::CommonVideoModel. +/// Mirrors artcraft_router::api::router_video_model::RouterVideoModel. #[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize, Deserialize, ToSchema)] #[serde(rename_all = "snake_case")] pub enum CommonVideoModel { diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/generate/cost_estimate/image/estimate_image_cost_handler.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/generate/cost_estimate/image/estimate_image_cost_handler.rs index 616790d753..848af61a09 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/generate/cost_estimate/image/estimate_image_cost_handler.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/generate/cost_estimate/image/estimate_image_cost_handler.rs @@ -7,11 +7,11 @@ use artcraft_api_defs::generate::cost_estimate::estimate_image_cost::{ EstimateImageCostError, EstimateImageCostErrorType, EstimateImageCostRequest, EstimateImageCostResponse, }; -use artcraft_router::api::common_aspect_ratio::CommonAspectRatio as RouterAspectRatio; -use artcraft_router::api::common_image_model::CommonImageModel as RouterImageModel; -use artcraft_router::api::common_quality::CommonQuality as RouterQuality; -use artcraft_router::api::common_resolution::CommonResolution as RouterResolution; -use artcraft_router::api::provider::Provider as RouterProvider; +use artcraft_router::api::router_aspect_ratio::RouterAspectRatio; +use artcraft_router::api::router_image_model::RouterImageModel; +use artcraft_router::api::router_quality::RouterQuality; +use artcraft_router::api::router_resolution::RouterResolution; +use artcraft_router::api::router_provider::RouterProvider; use artcraft_router::client::generation_mode_mismatch_strategy::GenerationModeMismatchStrategy; use artcraft_router::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use artcraft_router::generate::generate_image::generate_image_request_builder::GenerateImageRequestBuilder; @@ -98,7 +98,7 @@ impl ResponseError for HandlerError { let (error_type, error_message) = match self { HandlerError::InvalidProviderForModel { provider, model } => ( EstimateImageCostErrorType::InvalidProviderForModel, - format!("Provider '{}' is not supported for model '{}'", provider, model), + format!("RouterProvider '{}' is not supported for model '{}'", provider, model), ), HandlerError::InvalidInput(msg) => ( EstimateImageCostErrorType::InvalidInput, diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/generate/cost_estimate/splat/estimate_splat_cost_handler.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/generate/cost_estimate/splat/estimate_splat_cost_handler.rs index 2ecf8fd925..9dfa0e67a0 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/generate/cost_estimate/splat/estimate_splat_cost_handler.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/generate/cost_estimate/splat/estimate_splat_cost_handler.rs @@ -7,9 +7,9 @@ use artcraft_api_defs::generate::cost_estimate::estimate_splat_cost::{ EstimateSplatCostError, EstimateSplatCostErrorType, EstimateSplatCostRequest, EstimateSplatCostResponse, }; -use artcraft_router::api::common_splat_model::CommonSplatModel as RouterSplatModel; +use artcraft_router::api::router_splat_model::RouterSplatModel; use artcraft_router::api::image_list_ref::ImageListRef; -use artcraft_router::api::provider::Provider as RouterProvider; +use artcraft_router::api::router_provider::RouterProvider; use artcraft_router::generate::generate_splat::generate_splat_request::GenerateSplatRequest; use enums::common::generation::common_splat_model::CommonSplatModel; use enums::common::generation_provider::GenerationProvider; @@ -104,7 +104,7 @@ impl ResponseError for HandlerError { let (error_type, error_message) = match self { HandlerError::InvalidProviderForModel { provider, model } => ( EstimateSplatCostErrorType::InvalidProviderForModel, - format!("Provider '{}' is not supported for model '{}'", provider, model), + format!("RouterProvider '{}' is not supported for model '{}'", provider, model), ), HandlerError::InvalidInput(msg) => ( EstimateSplatCostErrorType::InvalidInput, diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/generate/cost_estimate/video/estimate_video_cost_handler.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/generate/cost_estimate/video/estimate_video_cost_handler.rs index 65e7c0763d..3ec2d9d1d7 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/generate/cost_estimate/video/estimate_video_cost_handler.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/generate/cost_estimate/video/estimate_video_cost_handler.rs @@ -7,10 +7,10 @@ use artcraft_api_defs::generate::cost_estimate::estimate_video_cost::{ EstimateVideoCostError, EstimateVideoCostErrorType, EstimateVideoCostRequest, EstimateVideoCostResponse, }; -use artcraft_router::api::common_aspect_ratio::CommonAspectRatio as RouterAspectRatio; -use artcraft_router::api::common_resolution::CommonResolution as RouterResolution; -use artcraft_router::api::common_video_model::CommonVideoModel as RouterVideoModel; -use artcraft_router::api::provider::Provider as RouterProvider; +use artcraft_router::api::router_aspect_ratio::RouterAspectRatio; +use artcraft_router::api::router_resolution::RouterResolution; +use artcraft_router::api::router_video_model::RouterVideoModel; +use artcraft_router::api::router_provider::RouterProvider; use artcraft_router::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use artcraft_router::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use enums::common::generation::common_aspect_ratio::CommonAspectRatio; @@ -99,7 +99,7 @@ impl ResponseError for HandlerError { let (error_type, error_message) = match self { HandlerError::InvalidProviderForModel { provider, model } => ( EstimateVideoCostErrorType::InvalidProviderForModel, - format!("Provider '{}' is not supported for model '{}'", provider, model), + format!("RouterProvider '{}' is not supported for model '{}'", provider, model), ), HandlerError::InvalidInput(msg) => ( EstimateVideoCostErrorType::InvalidInput, diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/cost/image/omni_gen_image_cost_handler.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/cost/image/omni_gen_image_cost_handler.rs index 7eaf266133..4f3a2e442d 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/cost/image/omni_gen_image_cost_handler.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/cost/image/omni_gen_image_cost_handler.rs @@ -5,7 +5,7 @@ use actix_web::{web, HttpRequest}; use artcraft_api_defs::omni_gen::cost_and_generate_requests::omni_gen_image_cost_and_generate_request::OmniGenImageCostAndGenerateRequest; use artcraft_api_defs::omni_gen::cost_response::omni_gen_image_cost_response::OmniGenImageCostResponse; use artcraft_router::api::image_list_ref::ImageListRef; -use artcraft_router::api::provider::Provider; +use artcraft_router::api::router_provider::RouterProvider; use artcraft_router::generate::generate_image::generate_image_request_builder::GenerateImageRequestBuilder; use artcraft_router::generate::generate_image::image_generation_cost_estimate::ImageGenerationCostEstimate; use log::warn; @@ -33,7 +33,7 @@ pub async fn omni_gen_image_cost_handler( ) -> Result, CommonWebError> { let mut builder = hydrate_to_router_request(&request)?; - builder.provider = Provider::Artcraft; // NB: Explicitly spell this out. + builder.provider = RouterProvider::Artcraft; // NB: Explicitly spell this out. let estimate = builder.build2() .map_err(|e| { diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/cost/video/omni_gen_video_cost_handler.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/cost/video/omni_gen_video_cost_handler.rs index 3d83835012..479e692b79 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/cost/video/omni_gen_video_cost_handler.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/cost/video/omni_gen_video_cost_handler.rs @@ -4,7 +4,7 @@ use actix_web::web::Json; use actix_web::{web, HttpRequest}; use artcraft_api_defs::omni_gen::cost_and_generate_requests::omni_gen_video_cost_and_generate_request::OmniGenVideoCostAndGenerateRequest; use artcraft_api_defs::omni_gen::cost_response::omni_gen_video_cost_response::OmniGenVideoCostResponse; -use artcraft_router::api::provider::Provider; +use artcraft_router::api::router_provider::RouterProvider; use log::warn; use crate::http_server::common_responses::common_web_error::CommonWebError; use crate::http_server::endpoints::omni_gen::generate::video::helpers::hydrate_router_request::hydrate_to_router_request; @@ -29,7 +29,7 @@ pub async fn omni_gen_video_cost_handler( ) -> Result, CommonWebError> { let mut builder = hydrate_to_router_request(&request)?; - builder.provider = Provider::Artcraft; + builder.provider = RouterProvider::Artcraft; let estimate = builder.build2() .map_err(|e| { diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/generate/image/hydrate_to_router_request.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/generate/image/hydrate_to_router_request.rs index e7ea49fc50..566533f5b0 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/generate/image/hydrate_to_router_request.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/generate/image/hydrate_to_router_request.rs @@ -1,10 +1,10 @@ use artcraft_api_defs::omni_gen::cost_and_generate_requests::omni_gen_image_cost_and_generate_request::OmniGenImageCostAndGenerateRequest; -use artcraft_router::api::common_aspect_ratio::CommonAspectRatio as CommonAspectRatioRouter; -use artcraft_router::api::common_image_model::CommonImageModel as CommonImageModelRouter; -use artcraft_router::api::common_quality::CommonQuality as CommonQualityRouter; -use artcraft_router::api::common_resolution::CommonResolution as CommonResolutionRouter; +use artcraft_router::api::router_aspect_ratio::RouterAspectRatio; +use artcraft_router::api::router_image_model::RouterImageModel; +use artcraft_router::api::router_quality::RouterQuality; +use artcraft_router::api::router_resolution::RouterResolution; use artcraft_router::api::image_list_ref::ImageListRef; -use artcraft_router::api::provider::Provider; +use artcraft_router::api::router_provider::RouterProvider; use artcraft_router::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use artcraft_router::generate::generate_image::generate_image_request_builder::GenerateImageRequestBuilder; use enums::common::generation::common_aspect_ratio::CommonAspectRatio as CommonAspectRatioEnum; @@ -38,7 +38,7 @@ pub fn hydrate_to_router_request( Ok(GenerateImageRequestBuilder { model, - provider: Provider::Artcraft, + provider: RouterProvider::Artcraft, prompt: request.prompt.clone(), image_inputs: request.image_media_tokens.clone() .map(ImageListRef::MediaFileTokens), @@ -57,7 +57,7 @@ pub fn hydrate_to_router_request( fn convert_model( model: &CommonImageModelEnum, -) -> Result { +) -> Result { let json = serde_json::to_string(model)?; serde_json::from_str(&json).map_err(|e| { CommonWebError::BadInputWithSimpleMessage( @@ -68,7 +68,7 @@ fn convert_model( fn convert_aspect_ratio( ar: &CommonAspectRatioEnum, -) -> Result { +) -> Result { let json = serde_json::to_string(ar)?; serde_json::from_str(&json).map_err(|e| { CommonWebError::BadInputWithSimpleMessage( @@ -79,7 +79,7 @@ fn convert_aspect_ratio( fn convert_resolution( res: &CommonResolutionEnum, -) -> Result { +) -> Result { let json = serde_json::to_string(res)?; serde_json::from_str(&json).map_err(|e| { CommonWebError::BadInputWithSimpleMessage( @@ -90,7 +90,7 @@ fn convert_resolution( fn convert_quality( quality: &CommonQualityEnum, -) -> Result { +) -> Result { let json = serde_json::to_string(quality)?; serde_json::from_str(&json).map_err(|e| { CommonWebError::BadInputWithSimpleMessage( diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/generate/image/pipeline_v2/run_pipeline_v2.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/generate/image/pipeline_v2/run_pipeline_v2.rs index 0e294d090e..4387d4de53 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/generate/image/pipeline_v2/run_pipeline_v2.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/generate/image/pipeline_v2/run_pipeline_v2.rs @@ -1,7 +1,7 @@ use log::{info, warn}; use artcraft_router::api::image_list_ref::ImageListRef; -use artcraft_router::api::provider::Provider; +use artcraft_router::api::router_provider::RouterProvider; use artcraft_router::client::router_client::RouterClient; use artcraft_router::client::router_fal_client::RouterFalClient; use artcraft_router::generate::generate_image::generate_image_request_builder::GenerateImageRequestBuilder; @@ -71,7 +71,7 @@ fn build_execution_request( router_builder: &GenerateImageRequestBuilder, ) -> Result { let mut execution_builder = router_builder.clone(); - execution_builder.provider = Provider::Fal; + execution_builder.provider = RouterProvider::Fal; execution_builder.build2().map_err(|e| { warn!("Failed to build2 for image v2 pipeline: {}", e); @@ -101,7 +101,7 @@ fn estimate_cost_in_credits( router_builder: &GenerateImageRequestBuilder, ) -> Result { let mut cost_builder = router_builder.clone(); - cost_builder.provider = Provider::Artcraft; + cost_builder.provider = RouterProvider::Artcraft; let request = cost_builder.build2().map_err(|e| { warn!("Failed to build image cost request: {}", e); @@ -150,11 +150,11 @@ async fn finalize_request( } fn build_router_client( - provider: Provider, + provider: RouterProvider, server_state: &ServerState, ) -> Result { match provider { - Provider::Fal => { + RouterProvider::Fal => { let fal_client = RouterFalClient::new_with_webhook( server_state.fal.api_key.clone(), server_state.fal.webhook_url.clone(), diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/generate/video/helpers/build_router_client.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/generate/video/helpers/build_router_client.rs index b1fa5486ef..0a9e847a4b 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/generate/video/helpers/build_router_client.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/generate/video/helpers/build_router_client.rs @@ -1,6 +1,6 @@ //! Build a RouterClient for the given provider from server state. -use artcraft_router::api::provider::Provider; +use artcraft_router::api::router_provider::RouterProvider; use artcraft_router::client::router_client::RouterClient; use artcraft_router::client::router_fal_client::RouterFalClient; use artcraft_router::client::router_gmicloud_client::RouterGmiCloudClient; @@ -12,27 +12,27 @@ use crate::http_server::common_responses::common_web_error::CommonWebError; use crate::state::server_state::ServerState; pub fn build_router_client( - provider: Provider, + provider: RouterProvider, server_state: &ServerState, use_alternate_kinovi: bool, ) -> Result { match provider { - Provider::Seedance2Pro => { + RouterProvider::Seedance2Pro => { kinovi_provider(server_state, use_alternate_kinovi) } - Provider::Fal => { + RouterProvider::Fal => { let fal_client = RouterFalClient::new_with_webhook( server_state.fal.api_key.clone(), server_state.fal.webhook_url.clone(), ); Ok(RouterClient::Fal(fal_client)) } - Provider::GmiCloud => { + RouterProvider::GmiCloud => { Ok(RouterClient::GmiCloud(RouterGmiCloudClient::new( server_state.gmicloud.api_key.clone(), ))) } - Provider::GrokApi => { + RouterProvider::GrokApi => { Ok(RouterClient::GrokApi(RouterGrokApiClient::new( server_state.grok_api.api_key.clone(), ))) diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/generate/video/helpers/hydrate_router_request.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/generate/video/helpers/hydrate_router_request.rs index 12172711c0..604697dc0e 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/generate/video/helpers/hydrate_router_request.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/generate/video/helpers/hydrate_router_request.rs @@ -2,12 +2,12 @@ use crate::http_server::common_responses::common_web_error::CommonWebError; use artcraft_api_defs::omni_gen::cost_and_generate_requests::omni_gen_video_cost_and_generate_request::OmniGenVideoCostAndGenerateRequest; use artcraft_router::api::audio_list_ref::AudioListRef; use artcraft_router::api::character_list_ref::CharacterListRef; -use artcraft_router::api::common_aspect_ratio::CommonAspectRatio as CommonAspectRatioRouter; -use artcraft_router::api::common_resolution::CommonResolution as CommonResolutionRouter; -use artcraft_router::api::common_video_model::CommonVideoModel as CommonVideoModelRouter; +use artcraft_router::api::router_aspect_ratio::RouterAspectRatio; +use artcraft_router::api::router_resolution::RouterResolution; +use artcraft_router::api::router_video_model::RouterVideoModel; use artcraft_router::api::image_list_ref::ImageListRef; use artcraft_router::api::image_ref::ImageRef; -use artcraft_router::api::provider::Provider; +use artcraft_router::api::router_provider::RouterProvider; use artcraft_router::api::video_list_ref::VideoListRef; use artcraft_router::client::request_mismatch_mitigation_strategy::RequestMismatchMitigationStrategy; use artcraft_router::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; @@ -38,7 +38,7 @@ pub fn hydrate_to_router_request( Ok(GenerateVideoRequestBuilder { model, - provider: Provider::Artcraft, + provider: RouterProvider::Artcraft, prompt: request.prompt.clone(), negative_prompt: request.negative_prompt.clone(), start_frame: request.start_frame_image_media_token.clone() @@ -65,7 +65,7 @@ pub fn hydrate_to_router_request( fn convert_model( model: &CommonVideoModelEnum, -) -> Result { +) -> Result { let json = serde_json::to_string(model)?; serde_json::from_str(&json).map_err(|e| { CommonWebError::BadInputWithSimpleMessage( @@ -76,7 +76,7 @@ fn convert_model( fn convert_aspect_ratio( ar: &CommonAspectRatioEnum, -) -> Result { +) -> Result { let json = serde_json::to_string(ar)?; serde_json::from_str(&json).map_err(|e| { CommonWebError::BadInputWithSimpleMessage( @@ -87,7 +87,7 @@ fn convert_aspect_ratio( fn convert_resolution( res: &CommonResolutionEnum, -) -> Result { +) -> Result { let json = serde_json::to_string(res)?; serde_json::from_str(&json).map_err(|e| { CommonWebError::BadInputWithSimpleMessage( diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/generate/video/pipeline_v2/run_pipeline_v2.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/generate/video/pipeline_v2/run_pipeline_v2.rs index e01c8e964a..469fec82cf 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/generate/video/pipeline_v2/run_pipeline_v2.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/omni_gen/generate/video/pipeline_v2/run_pipeline_v2.rs @@ -2,8 +2,8 @@ use std::collections::HashMap; use log::{error, info, warn}; use sqlx::pool::PoolConnection; -use artcraft_router::api::common_video_model::CommonVideoModel; -use artcraft_router::api::provider::Provider; +use artcraft_router::api::router_video_model::RouterVideoModel; +use artcraft_router::api::router_provider::RouterProvider; use artcraft_router::generate::generate_video::generate_video_request_builder::GenerateVideoRequestBuilder; use artcraft_router::generate::generate_video::generate_video_response::GenerateVideoResponse; use artcraft_router::generate::generate_video_v2::video_generation_draft_context::VideoGenerationDraftContext; @@ -44,25 +44,25 @@ pub async fn run_pipeline_v2(args: RunPipelineV2Args<'_>) -> Result { - router_builder.model = CommonVideoModel::Seedance2p0; + RouterVideoModel::PreviewModel | + RouterVideoModel::Seedance2p0BytePlus => { + router_builder.model = RouterVideoModel::Seedance2p0; }, - CommonVideoModel::PreviewModelFast | - CommonVideoModel::Seedance2p0BytePlusFast => { - router_builder.model = CommonVideoModel::Seedance2p0Fast; + RouterVideoModel::PreviewModelFast | + RouterVideoModel::Seedance2p0BytePlusFast => { + router_builder.model = RouterVideoModel::Seedance2p0Fast; }, _ => {}, // Fall-through } let provider = match router_builder.model { - CommonVideoModel::HappyHorse1p0 => Provider::Seedance2Pro, - CommonVideoModel::Seedance2p0 => Provider::Seedance2Pro, - CommonVideoModel::Seedance2p0Fast => Provider::Seedance2Pro, - CommonVideoModel::Seedance2p0Ultra => Provider::GmiCloud, - CommonVideoModel::Seedance2p0UltraFast => Provider::GmiCloud, - CommonVideoModel::GrokImagineVideo => Provider::GrokApi, - _ => Provider::Fal, + RouterVideoModel::HappyHorse1p0 => RouterProvider::Seedance2Pro, + RouterVideoModel::Seedance2p0 => RouterProvider::Seedance2Pro, + RouterVideoModel::Seedance2p0Fast => RouterProvider::Seedance2Pro, + RouterVideoModel::Seedance2p0Ultra => RouterProvider::GmiCloud, + RouterVideoModel::Seedance2p0UltraFast => RouterProvider::GmiCloud, + RouterVideoModel::GrokImagineVideo => RouterProvider::GrokApi, + _ => RouterProvider::Fal, }; // 1. Build execution request @@ -71,7 +71,7 @@ pub async fn run_pipeline_v2(args: RunPipelineV2Args<'_>) -> Result) -> Result) -> Result