Compare commits

...
Author SHA1 Message Date
Brandon Thomas 0247974c01 group providers together 2026-05-28 15:13:56 -04:00
54 changed files with 290 additions and 285 deletions
@@ -123,7 +123,7 @@ pub async fn create_character_handler(
// --- Upload image to Kinovi CDN ---
let seedance_image_url = upload_to_kinovi(
&server_state.seedance2pro.cookies,
&server_state.inference_providers.seedance2pro.cookies,
image_cdn_url,
).await?;
@@ -132,7 +132,7 @@ pub async fn create_character_handler(
// --- Call Kinovi generate_character ---
let session = Seedance2ProSession::from_cookies_string(
server_state.seedance2pro.cookies.clone()
server_state.inference_providers.seedance2pro.cookies.clone()
);
let gen_result = generate_character(GenerateCharacterArgs {
@@ -101,7 +101,7 @@ pub async fn edit_character_handler(
if has_name_change {
if let Some(ref kinovi_id) = character.kinovi_character_id {
let session = Seedance2ProSession::from_cookies_string(
server_state.seedance2pro.cookies.clone()
server_state.inference_providers.seedance2pro.cookies.clone()
);
update_character(UpdateCharacterArgs {
@@ -94,7 +94,7 @@ pub async fn flux_2_lora_edit_image_angle_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -130,8 +130,8 @@ pub async fn flux_2_lora_edit_image_angle_handler(
let args = EnqueueFlux2LoraEditImageAngleArgs {
request: fal_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -94,7 +94,7 @@ pub async fn qwen_edit_2511_edit_image_angle_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -131,8 +131,8 @@ pub async fn qwen_edit_2511_edit_image_angle_handler(
let args = EnqueueQwenEdit2511EditImageAngleArgs {
request: fal_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -121,14 +121,14 @@ pub async fn remove_image_background_handler(
server_state.server_environment,
&bucket_path);
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let args = RemoveBackgroundRembgWebhookArgs {
request: RemoveBackgroundRembgWebhookRequest {
image_url: media_links.cdn_url.to_string(),
},
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
let fal_result = remove_background_rembg_webhook(args)
@@ -164,7 +164,7 @@ pub async fn flux_pro_kontext_max_edit_image_handler(
// warn!("Temporary wallet deduction failed: {:?}", err); // Infallible for now.
//}
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let num_images = match request.num_images {
Some(FluxProKontextMaxEditImageNumImages::One) => FluxProKontextMaxNumImages::One,
@@ -180,8 +180,8 @@ pub async fn flux_pro_kontext_max_edit_image_handler(
image_url: image_url.to_string(),
num_images,
},
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
let fal_result = enqueue_flux_pro_kontext_max_edit_webhook(args)
@@ -139,7 +139,7 @@ pub async fn gemini_25_flash_edit_image_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let mut num_images = match request.num_images {
Some(Gemini25FlashEditImageNumImages::One) => Gemini25FlashEditNumImages::One,
@@ -157,8 +157,8 @@ pub async fn gemini_25_flash_edit_image_handler(
num_images,
aspect_ratio: None, // TODO
},
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
let apriori_job_token = InferenceJobToken::generate();
@@ -141,7 +141,7 @@ pub async fn gpt_image_1_edit_image_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let image_size = match request.image_size {
Some(GptImage1EditImageImageSize::Square) => GptEditImageSize::Square,
@@ -168,7 +168,7 @@ pub async fn gpt_image_1_edit_image_handler(
None => GptEditImageQuality::High, // Default to High
};
let openai_api_key = OpenAiApiKey::from_str(&server_state.openai.api_key);
let openai_api_key = OpenAiApiKey::from_str(&server_state.inference_providers.openai.api_key);
let args = GptEditImageByokArgs {
@@ -179,8 +179,8 @@ pub async fn gpt_image_1_edit_image_handler(
image_size,
quality,
},
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
openai_api_key: &openai_api_key,
};
@@ -135,7 +135,7 @@ pub async fn qwen_edit_image_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -162,8 +162,8 @@ pub async fn qwen_edit_image_handler(
negative_prompt: request.negative_prompt.clone(),
acceleration: acceleration.map(|s| s.to_string()),
},
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
let cost = args.request.calculate_cost_in_cents();
@@ -134,15 +134,15 @@ pub async fn seededit_3_edit_image_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let args = SeedEditV3EditArgs {
request: SeedEditV3EditRequest {
prompt: request.prompt.as_deref().unwrap_or("").to_string(),
image_url: image_url.to_string(),
},
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
let fal_result = enqueue_seededit_v3_edit_webhook(args)
@@ -160,7 +160,7 @@ pub async fn flux_dev_juggernaut_inpaint_image_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let num_images = match request.num_images {
Some(FluxDevJuggernautInpaintImageNumImages::One) => FluxDevJuggernautInfillNumImages::One,
@@ -177,8 +177,8 @@ pub async fn flux_dev_juggernaut_inpaint_image_handler(
mask_url: mask_image_url,
num_images,
},
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
let fal_result = enqueue_flux_dev_juggernaut_infill_webhook(args)
@@ -160,7 +160,7 @@ pub async fn flux_pro_1_inpaint_image_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let num_images = match request.num_images {
Some(FluxPro1InpaintImageNumImages::One) => FluxPro1InfillNumImages::One,
@@ -177,8 +177,8 @@ pub async fn flux_pro_1_inpaint_image_handler(
mask_url: mask_image_url,
num_images,
},
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
let fal_result = enqueue_flux_pro_1_infill_webhook(args)
@@ -98,7 +98,7 @@ pub async fn bytedance_seedream_5_lite_multi_function_image_gen_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -141,8 +141,8 @@ pub async fn bytedance_seedream_5_lite_multi_function_image_gen_handler(
let args = EnqueueBytedanceSeedreamV5LiteEditImageArgs {
request: edit_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -205,8 +205,8 @@ pub async fn bytedance_seedream_5_lite_multi_function_image_gen_handler(
let args = EnqueueBytedanceSeedreamV5LiteTextToImageArgs {
request: t2i_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
fal_result = enqueue_bytedance_seedream_v5_lite_text_to_image_webhook(args)
@@ -110,7 +110,7 @@ pub async fn bytedance_seedream_v4_multi_function_image_gen_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -158,8 +158,8 @@ pub async fn bytedance_seedream_v4_multi_function_image_gen_handler(
let args = EnqueueBytedanceSeedreamV4EditImageArgs {
request: edit_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -227,8 +227,8 @@ pub async fn bytedance_seedream_v4_multi_function_image_gen_handler(
let args = EnqueueBytedanceSeedreamV4TextToImageArgs {
request: t2i_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
fal_result = enqueue_bytedance_seedream_v4_text_to_image_webhook(args)
@@ -110,7 +110,7 @@ pub async fn bytedance_seedream_v4p5_multi_function_image_gen_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -157,8 +157,8 @@ pub async fn bytedance_seedream_v4p5_multi_function_image_gen_handler(
let args = EnqueueBytedanceSeedreamV4p5EditImageArgs {
request: edit_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -225,8 +225,8 @@ pub async fn bytedance_seedream_v4p5_multi_function_image_gen_handler(
let args = EnqueueBytedanceSeedreamV4p5TextToImageArgs {
request: t2i_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
fal_result = enqueue_bytedance_seedream_v4p5_text_to_image_webhook(args)
@@ -144,7 +144,7 @@ pub async fn gpt_image_1p5_multi_function_image_gen_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -206,8 +206,8 @@ pub async fn gpt_image_1p5_multi_function_image_gen_handler(
let args = EnqueueGptImage1p5EditImageArgs {
request: edit_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -272,8 +272,8 @@ pub async fn gpt_image_1p5_multi_function_image_gen_handler(
let args = EnqueueGptImage1p5TextToImageArgs {
request: t2i_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -98,7 +98,7 @@ pub async fn nano_banana_2_multi_function_image_gen_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -152,8 +152,8 @@ pub async fn nano_banana_2_multi_function_image_gen_handler(
let args = EnqueueNanoBanana2EditImageArgs {
request: edit_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -219,8 +219,8 @@ pub async fn nano_banana_2_multi_function_image_gen_handler(
let args = EnqueueNanoBanana2TextToImageArgs {
request: t2i_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -113,7 +113,7 @@ pub async fn nano_banana_multi_function_image_gen_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -154,8 +154,8 @@ pub async fn nano_banana_multi_function_image_gen_handler(
num_images,
aspect_ratio: Some(aspect_ratio),
},
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
let cost = args.request.calculate_cost_in_cents();
@@ -213,8 +213,8 @@ pub async fn nano_banana_multi_function_image_gen_handler(
let args = Gemini25FlashTextToImageArgs {
request: t2i_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -111,7 +111,7 @@ pub async fn nano_banana_pro_multi_function_image_gen_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -160,8 +160,8 @@ pub async fn nano_banana_pro_multi_function_image_gen_handler(
resolution: Some(resolution),
aspect_ratio: Some(aspect_ratio),
},
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
let cost = args.request.calculate_cost_in_cents();
@@ -227,8 +227,8 @@ pub async fn nano_banana_pro_multi_function_image_gen_handler(
let args = EnqueueNanoBananaProTextToImageArgs {
request: t2i_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -135,7 +135,7 @@ pub async fn generate_flux_1_dev_text_to_image_handler(
const IS_MOD : bool = false;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let aspect_ratio = match request.aspect_ratio {
Some(GenerateFlux1DevTextToImageAspectRatio::Square) => Flux1DevAspectRatio::Square,
@@ -161,8 +161,8 @@ pub async fn generate_flux_1_dev_text_to_image_handler(
aspect_ratio,
num_images,
},
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
let fal_result = enqueue_flux_1_dev_text_to_image_webhook(args)
@@ -115,7 +115,7 @@ pub async fn generate_flux_1_schnell_text_to_image_handler(
const IS_MOD : bool = false;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let aspect_ratio = match request.aspect_ratio {
Some(GenerateFlux1SchnellTextToImageAspectRatio::Square) => Flux1SchnellAspectRatio::Square,
@@ -141,8 +141,8 @@ pub async fn generate_flux_1_schnell_text_to_image_handler(
aspect_ratio,
num_images,
},
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
let fal_result = enqueue_flux_1_schnell_text_to_image_webhook(args)
@@ -89,7 +89,7 @@ pub async fn generate_flux_pro_11_text_to_image_handler(
const IS_MOD : bool = false;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -129,8 +129,8 @@ pub async fn generate_flux_pro_11_text_to_image_handler(
let args = FluxPro11Args {
request: flux_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
let fal_result = enqueue_flux_pro_11_text_to_image_webhook(args)
@@ -89,7 +89,7 @@ pub async fn generate_flux_pro_11_ultra_text_to_image_handler(
const IS_MOD : bool = false;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -133,8 +133,8 @@ pub async fn generate_flux_pro_11_ultra_text_to_image_handler(
let args = FluxPro11UltraArgs {
request: ultra_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
let fal_result = enqueue_flux_pro_11_ultra_text_to_image_webhook(args)
@@ -93,7 +93,7 @@ pub async fn generate_gpt_image_1_text_to_image_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let image_size = match request.image_size {
Some(GenerateGptImage1TextToImageImageSize::Square) => GptTextToImageSize::Square,
@@ -120,7 +120,7 @@ pub async fn generate_gpt_image_1_text_to_image_handler(
None => GptTextToImageQuality::High, // Default to High
};
let openai_api_key = OpenAiApiKey::from_str(&server_state.openai.api_key);
let openai_api_key = OpenAiApiKey::from_str(&server_state.inference_providers.openai.api_key);
let byok_request = GptTextToImageByokRequest {
prompt: request.prompt.as_deref().unwrap_or("").to_string(),
@@ -135,8 +135,8 @@ pub async fn generate_gpt_image_1_text_to_image_handler(
let args = GptTextToImageByokArgs {
request: byok_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
openai_api_key: &openai_api_key,
};
@@ -129,14 +129,14 @@ pub async fn generate_hunyuan_2_0_image_to_3d_handler(
server_state.server_environment,
&bucket_path);
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let args = Hunyuan3d2Args {
request: Hunyuan3d2Request {
image_url: media_links.cdn_url.to_string(),
},
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
let fal_result = enqueue_hunyuan_3d_2_image_to_3d_webhook(args)
@@ -128,14 +128,14 @@ pub async fn generate_hunyuan_2_1_image_to_3d_handler(
server_state.server_environment,
&bucket_path);
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let args = Hunyuan3d21Args {
request: Hunyuan3d21Request {
image_url: media_links.cdn_url.to_string(),
},
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
let fal_result = enqueue_hunyuan_3d_2_1_image_to_3d_webhook(args)
@@ -145,7 +145,7 @@ pub async fn generate_hunyuan3d_v3_multi_function_object_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
// Determine which mode we're in based on inputs
let has_prompt = request
@@ -185,8 +185,8 @@ pub async fn generate_hunyuan3d_v3_multi_function_object_handler(
polygon_type,
enable_pbr: Some(enable_pbr),
},
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
enqueue_hunyuan3d_v3_text_to_3d_webhook(args)
@@ -226,8 +226,8 @@ pub async fn generate_hunyuan3d_v3_multi_function_object_handler(
polygon_type,
enable_pbr: Some(enable_pbr),
},
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
enqueue_hunyuan3d_v3_sketch_to_3d_webhook(args)
@@ -269,8 +269,8 @@ pub async fn generate_hunyuan3d_v3_multi_function_object_handler(
polygon_type,
enable_pbr: Some(enable_pbr),
},
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
enqueue_hunyuan3d_v3_image_to_3d_webhook(args)
@@ -143,7 +143,7 @@ pub async fn generate_worldlabs_marble_0p1_mini_splat_handler(
};
// Call World Labs API to start generation
let creds = WorldLabsApiCreds::new(server_state.worldlabs.api_key.clone());
let creds = WorldLabsApiCreds::new(server_state.inference_providers.worldlabs.api_key.clone());
let generate_result = match generate_world(GenerateWorldArgs {
creds: &creds,
@@ -143,7 +143,7 @@ pub async fn generate_worldlabs_marble_0p1_plus_splat_handler(
};
// Call World Labs API to start generation
let creds = WorldLabsApiCreds::new(server_state.worldlabs.api_key.clone());
let creds = WorldLabsApiCreds::new(server_state.inference_providers.worldlabs.api_key.clone());
let generate_result = match generate_world(GenerateWorldArgs {
creds: &creds,
@@ -141,7 +141,7 @@ pub async fn beeble_switchx_edit_video_gen_handler(
// ==================== DOWNLOAD & UPLOAD TO BEEBLE ==================== //
let beeble_api_key = &server_state.beeble.api_key;
let beeble_api_key = &server_state.inference_providers.beeble.api_key;
// Download + upload source video
info!("Downloading source video from CDN: {}", source_video_cdn_url);
@@ -216,7 +216,7 @@ pub async fn beeble_switchx_edit_video_gen_handler(
reference_image_uri: maybe_reference_beeble_uri,
alpha_uri: None,
max_resolution: Some(1080),
callback_url: Some(server_state.beeble.webhook_url.clone()),
callback_url: Some(server_state.inference_providers.beeble.webhook_url.clone()),
idempotency_key: Some(request.uuid_idempotency_token.clone()),
},
}).await.map_err(|err| {
@@ -141,7 +141,7 @@ pub async fn generate_kling_1_6_pro_video_handler(
})?),
};
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -175,8 +175,8 @@ pub async fn generate_kling_1_6_pro_video_handler(
let args = Kling1p6ProArgs {
request: fal_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -131,7 +131,7 @@ pub async fn generate_kling_2_1_master_video_handler(
server_state.server_environment,
&bucket_path);
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -164,8 +164,8 @@ pub async fn generate_kling_2_1_master_video_handler(
let args = Kling2p1MasterArgs {
request: fal_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -146,7 +146,7 @@ pub async fn generate_kling_2_1_pro_video_handler(
})?),
};
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -180,8 +180,8 @@ pub async fn generate_kling_2_1_pro_video_handler(
let args = Kling2p1ProArgs {
request: fal_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -146,7 +146,7 @@ pub async fn generate_seedance_1_0_lite_image_to_video_handler(
})?),
};
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -203,8 +203,8 @@ pub async fn generate_seedance_1_0_lite_image_to_video_handler(
let args = Seedance1LiteArgs {
request: i2v_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
let fal_result = enqueue_seedance_1_lite_image_to_video_webhook(args)
@@ -125,7 +125,7 @@ pub async fn generate_seedance_1_0_pro_image_to_video_handler(
CommonWebError::NotFound
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -177,8 +177,8 @@ pub async fn generate_seedance_1_0_pro_image_to_video_handler(
let args = Seedance1ProArgs {
request: i2v_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
let fal_result = enqueue_seedance_1_pro_image_to_video_webhook(args)
@@ -138,7 +138,7 @@ pub async fn generate_veo_2_image_to_video_handler(
server_state.server_environment,
&bucket_path);
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -169,8 +169,8 @@ pub async fn generate_veo_2_image_to_video_handler(
let args = Veo2Args {
request: veo2_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -130,7 +130,7 @@ pub async fn generate_veo_3_fast_image_to_video_handler(
server_state.server_environment,
&bucket_path);
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -173,8 +173,8 @@ pub async fn generate_veo_3_fast_image_to_video_handler(
let args = Veo3FastArgs {
request: veo3_fast_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -133,7 +133,7 @@ pub async fn generate_veo_3_image_to_video_handler(
server_state.server_environment,
&bucket_path);
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -177,8 +177,8 @@ pub async fn generate_veo_3_image_to_video_handler(
let args = Veo3Args {
request: veo3_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -146,7 +146,7 @@ pub async fn kling_2p5_turbo_pro_multi_function_video_gen_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -176,8 +176,8 @@ pub async fn kling_2p5_turbo_pro_multi_function_video_gen_handler(
let args = EnqueueKlingV2p5TurboProImageToVideoArgs {
request: fal_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -225,8 +225,8 @@ pub async fn kling_2p5_turbo_pro_multi_function_video_gen_handler(
let args = EnqueueKlingV2p5TurboProTextToVideoArgs {
request: t2v_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -144,7 +144,7 @@ pub async fn kling_2p6_pro_multi_function_video_gen_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -173,8 +173,8 @@ pub async fn kling_2p6_pro_multi_function_video_gen_handler(
let args = EnqueueKlingV2p6ProImageToVideoArgs {
request: fal_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -222,8 +222,8 @@ pub async fn kling_2p6_pro_multi_function_video_gen_handler(
let args = EnqueueKlingV2p6ProTextToVideoArgs {
request: t2v_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet...");
@@ -143,7 +143,7 @@ pub async fn kling_3p0_pro_multi_function_video_gen_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -175,8 +175,8 @@ pub async fn kling_3p0_pro_multi_function_video_gen_handler(
let args = EnqueueKling3p0ProImageToVideoArgs {
request: fal_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -216,8 +216,8 @@ pub async fn kling_3p0_pro_multi_function_video_gen_handler(
let args = EnqueueKling3p0ProTextToVideoArgs {
request: t2v_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet...");
@@ -143,7 +143,7 @@ pub async fn kling_3p0_standard_multi_function_video_gen_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -175,8 +175,8 @@ pub async fn kling_3p0_standard_multi_function_video_gen_handler(
let args = EnqueueKling3p0StandardImageToVideoArgs {
request: fal_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -216,8 +216,8 @@ pub async fn kling_3p0_standard_multi_function_video_gen_handler(
let args = EnqueueKling3p0StandardTextToVideoArgs {
request: t2v_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet...");
@@ -131,7 +131,7 @@ pub async fn seedance_1p5_pro_multi_function_video_gen_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -172,8 +172,8 @@ pub async fn seedance_1p5_pro_multi_function_video_gen_handler(
let args = EnqueueSeedance1p5ProImageToVideoArgs {
request: i2v_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
fal_result = enqueue_seedance_1p5_pro_image_to_video_webhook(args)
@@ -203,8 +203,8 @@ pub async fn seedance_1p5_pro_multi_function_video_gen_handler(
let args = EnqueueSeedance1p5ProTextToVideoArgs {
request: t2v_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -192,7 +192,7 @@ pub async fn seedance_2p0_multi_function_video_gen_handler(
info!("User {:?} is seedance-whitelisted, trying whitelist session first", user_token);
let whitelist_session = Seedance2ProSession::from_cookies_string(
server_state.seedance2pro.cookies_byteplus.clone()
server_state.inference_providers.seedance2pro.cookies_byteplus.clone()
);
let result = upload_and_generate(
@@ -215,7 +215,7 @@ pub async fn seedance_2p0_multi_function_video_gen_handler(
warn!("Whitelist session failed for user {:?}: {:?}, falling back to regular session", user_token, err);
let regular_session = Seedance2ProSession::from_cookies_string(
server_state.seedance2pro.cookies.clone()
server_state.inference_providers.seedance2pro.cookies.clone()
);
let result = upload_and_generate(
@@ -253,7 +253,7 @@ pub async fn seedance_2p0_multi_function_video_gen_handler(
info!("User {:?} using regular seedance session", user_token);
let regular_session = Seedance2ProSession::from_cookies_string(
server_state.seedance2pro.cookies.clone()
server_state.inference_providers.seedance2pro.cookies.clone()
);
let result = upload_and_generate(
@@ -144,7 +144,7 @@ pub async fn sora_2_multi_function_video_gen_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -196,8 +196,8 @@ pub async fn sora_2_multi_function_video_gen_handler(
let args = EnqueueSora2ImageToVideoArgs {
request: i2v_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
fal_result = enqueue_sora_2_image_to_video_webhook(args)
@@ -251,8 +251,8 @@ pub async fn sora_2_multi_function_video_gen_handler(
let args = EnqueueSora2TextToVideoArgs {
request: t2v_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
fal_result = enqueue_sora_2_text_to_video_webhook(args)
@@ -144,7 +144,7 @@ pub async fn sora_2_pro_multi_function_video_gen_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -197,8 +197,8 @@ pub async fn sora_2_pro_multi_function_video_gen_handler(
let args = EnqueueSora2ProImageToVideoArgs {
request: i2v_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
fal_result = enqueue_sora_2_pro_image_to_video_webhook(args)
@@ -253,8 +253,8 @@ pub async fn sora_2_pro_multi_function_video_gen_handler(
let args = EnqueueSora2ProTextToVideoArgs {
request: t2v_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
fal_result = enqueue_sora_2_pro_text_to_video_webhook(args)
@@ -143,7 +143,7 @@ pub async fn veo_3p1_fast_multi_function_video_gen_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -192,8 +192,8 @@ pub async fn veo_3p1_fast_multi_function_video_gen_handler(
let args = EnqueueVeo3p1FastFirstLastFrameImageToVideoArgs {
request: flf_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -249,8 +249,8 @@ pub async fn veo_3p1_fast_multi_function_video_gen_handler(
let args = EnqueueVeo3p1FastImageToVideoArgs {
request: i2v_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -319,8 +319,8 @@ pub async fn veo_3p1_fast_multi_function_video_gen_handler(
let args = EnqueueVeo3p1FastTextToVideoArgs {
request: t2v_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
fal_result = enqueue_veo_3p1_fast_text_to_video_webhook(args)
@@ -143,7 +143,7 @@ pub async fn veo_3p1_multi_function_video_gen_handler(
CommonWebError::BadInputWithSimpleMessage("repeated idempotency token".to_string())
})?;
info!("Fal webhook URL: {}", server_state.fal.webhook_url);
info!("Fal webhook URL: {}", server_state.inference_providers.fal.webhook_url);
let apriori_job_token = InferenceJobToken::generate();
@@ -192,8 +192,8 @@ pub async fn veo_3p1_multi_function_video_gen_handler(
let args = EnqueueVeo3p1FirstLastFrameImageToVideoArgs {
request: flf_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -249,8 +249,8 @@ pub async fn veo_3p1_multi_function_video_gen_handler(
let args = EnqueueVeo3p1ImageToVideoArgs {
request: i2v_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
info!("Charging wallet: {}", cost);
@@ -319,8 +319,8 @@ pub async fn veo_3p1_multi_function_video_gen_handler(
let args = EnqueueVeo3p1TextToVideoArgs {
request: t2v_request,
webhook_url: &server_state.fal.webhook_url,
api_key: &server_state.fal.api_key,
webhook_url: &server_state.inference_providers.fal.webhook_url,
api_key: &server_state.inference_providers.fal.api_key,
};
fal_result = enqueue_veo_3p1_text_to_video_webhook(args)
@@ -156,8 +156,8 @@ fn build_router_client(
match provider {
RouterProvider::Fal => {
let fal_client = RouterFalClient::new_with_webhook(
server_state.fal.api_key.clone(),
server_state.fal.webhook_url.clone(),
server_state.inference_providers.fal.api_key.clone(),
server_state.inference_providers.fal.webhook_url.clone(),
);
Ok(RouterClient::Fal(fal_client))
},
@@ -22,19 +22,19 @@ pub fn build_router_client(
}
RouterProvider::Fal => {
let fal_client = RouterFalClient::new_with_webhook(
server_state.fal.api_key.clone(),
server_state.fal.webhook_url.clone(),
server_state.inference_providers.fal.api_key.clone(),
server_state.inference_providers.fal.webhook_url.clone(),
);
Ok(RouterClient::Fal(fal_client))
}
RouterProvider::GmiCloud => {
Ok(RouterClient::GmiCloud(RouterGmiCloudClient::new(
server_state.gmicloud.api_key.clone(),
server_state.inference_providers.gmicloud.api_key.clone(),
)))
}
RouterProvider::GrokApi => {
Ok(RouterClient::GrokApi(RouterGrokApiClient::new(
server_state.grok_api.api_key.clone(),
server_state.inference_providers.grok_api.api_key.clone(),
)))
}
other => {
@@ -49,12 +49,12 @@ fn kinovi_provider(server_state: &ServerState, use_alternate_kinovi: bool) -> Re
let session = if use_alternate_kinovi {
// Alternate Kinovi
Seedance2ProSession::from_cookies_string(
server_state.seedance2pro.cookies_byteplus.clone()
server_state.inference_providers.seedance2pro.cookies_byteplus.clone()
)
} else {
// Standard Kinovi
Seedance2ProSession::from_cookies_string(
server_state.seedance2pro.cookies.clone()
server_state.inference_providers.seedance2pro.cookies.clone()
)
};
@@ -9,7 +9,6 @@ use cloud_storage::bucket_client::BucketClient;
use elasticsearch::http::transport::Transport;
use elasticsearch::Elasticsearch;
use errors::AnyhowResult;
use fal_client::creds::fal_api_key::FalApiKey;
use log::info;
use memory_caching::arc_ttl_sieve::ArcTtlSieve;
use memory_caching::single_item_ttl_cache::SingleItemTtlCache;
@@ -34,15 +33,16 @@ use crate::startup::setup_bans::{
load_cidr_bans, load_ip_address_troll_bans,
load_static_container_ip_bans, load_troll_user_token_bans,
};
use crate::startup::setup_inference_providers::setup_inference_providers;
use crate::startup::setup_static_feature_flags::setup_static_feature_flags;
use crate::startup::setup_stripe_artcraft::setup_stripe_artcraft;
use crate::startup::setup_stripe_fakeyou::setup_stripe_fakeyou;
use crate::state::certs::google_sign_in_cert::GoogleSignInCert;
use crate::state::memory_cache::model_token_to_info_cache::ModelTokenToInfoCache;
use crate::state::server_state::{
BeebleData, DurableInMemoryCaches, EnvConfig, EphemeralInMemoryCaches, FalData,
GmiCloudData, GrokApiData, InMemoryCaches, OpenAiData, ResendData, Seedance2ProData, ServerInfo,
ServerState, TrollBans, WorldLabsData,
DurableInMemoryCaches, EnvConfig, EphemeralInMemoryCaches,
InMemoryCaches, ResendData, ServerInfo,
ServerState, TrollBans,
};
use crate::threads::db_health_checker_thread::db_health_check_status::HealthCheckStatus;
use crate::util::encrypted_sort_id::SortKeyCrypto;
@@ -197,14 +197,9 @@ pub async fn setup_dependencies(server_hostname: &str) -> AnyhowResult<SetupResu
.trim()
.to_string();
let fal_api_key = FalApiKey::new(easyenv::get_env_string_required("FAL_API_KEY")?);
let fal_webhook_url = easyenv::get_env_string_required("FAL_WEBHOOK_URL")?;
let inference_providers = setup_inference_providers()?;
let openai_api_key = easyenv::get_env_string_required("OPENAI_API_KEY")?;
let resend_api_key = easyenv::get_env_string_required("RESEND_API_KEY")?;
let gmicloud_api_key = easyenv::get_env_string_required("GMICLOUD_API_KEY")?;
let grok_api_key = easyenv::get_env_string_required("GROK_API_KEY")?;
let worldlabs_api_key = easyenv::get_env_string_required("WORLDLABS_API_KEY")?;
let startup_time = Utc::now();
@@ -245,35 +240,10 @@ pub async fn setup_dependencies(server_hostname: &str) -> AnyhowResult<SetupResu
sort_key_crypto,
opaque_cursors: opaque_cursor_encoder,
static_api_token_set,
beeble: BeebleData {
api_key: beeble_client::creds::beeble_api_key::BeebleApiKey::new(
easyenv::get_env_string_required("BEEBLE_API_KEY")?,
),
webhook_url: easyenv::get_env_string_required("BEEBLE_WEBHOOK_URL")?,
},
fal: FalData {
api_key: fal_api_key,
webhook_url: fal_webhook_url,
},
gmicloud: GmiCloudData {
api_key: gmicloud_client::creds::gmicloud_api_key::GmiCloudApiKey::new(gmicloud_api_key),
},
grok_api: GrokApiData {
api_key: grok_api_client::creds::grok_api_key::GrokApiKey::new(grok_api_key),
},
seedance2pro: Seedance2ProData {
cookies: easyenv::get_env_string_required("SEEDANCE2PRO_COOKIES")?,
cookies_byteplus: easyenv::get_env_string_required("SEEDANCE2PRO_WHITELIST_COOKIES")?,
},
openai: OpenAiData {
api_key: openai_api_key,
},
inference_providers,
resend: ResendData {
api_key: resend_api_key,
},
worldlabs: WorldLabsData {
api_key: worldlabs_api_key,
},
pager,
caches: InMemoryCaches {
durable: DurableInMemoryCaches {
@@ -3,6 +3,7 @@ pub mod setup_bans;
pub mod setup_metrics;
pub mod setup_pager;
pub mod setup_disabled_endpoints;
pub mod setup_inference_providers;
pub mod setup_static_feature_flags;
pub mod setup_stripe_artcraft;
pub mod setup_stripe_fakeyou;
@@ -0,0 +1,95 @@
use beeble_client::creds::beeble_api_key::BeebleApiKey;
use errors::AnyhowResult;
use fal_client::creds::fal_api_key::FalApiKey;
/// All third-party inference provider credentials and configuration grouped together.
pub struct InferenceProviders {
pub fal: FalData,
pub gmicloud: GmiCloudData,
pub grok_api: GrokApiData,
pub beeble: BeebleData,
pub seedance2pro: Seedance2ProData,
pub openai: OpenAiData,
pub worldlabs: WorldLabsData,
}
/// Fal integration
#[derive(Clone)]
pub struct FalData {
pub api_key: FalApiKey,
pub webhook_url: String,
}
/// GmiCloud integration
#[derive(Clone)]
pub struct GmiCloudData {
pub api_key: gmicloud_client::creds::gmicloud_api_key::GmiCloudApiKey,
}
/// Grok (xAI) API integration
#[derive(Clone)]
pub struct GrokApiData {
pub api_key: grok_api_client::creds::grok_api_key::GrokApiKey,
}
/// Beeble SwitchX integration
#[derive(Clone)]
pub struct BeebleData {
pub api_key: BeebleApiKey,
pub webhook_url: String,
}
/// Seedance 2 Pro integration
#[derive(Clone)]
pub struct Seedance2ProData {
/// Cookie string for seedance2-pro.com
pub cookies: String,
/// Cookie string for seedance2-pro.com (Whitelisted account)
pub cookies_byteplus: String,
}
/// OpenAI integration
#[derive(Clone)]
pub struct OpenAiData {
pub api_key: String,
}
/// World Labs integration
#[derive(Clone)]
pub struct WorldLabsData {
pub api_key: String,
}
pub fn setup_inference_providers() -> AnyhowResult<InferenceProviders> {
Ok(InferenceProviders {
fal: FalData {
api_key: FalApiKey::new(easyenv::get_env_string_required("FAL_API_KEY")?),
webhook_url: easyenv::get_env_string_required("FAL_WEBHOOK_URL")?,
},
gmicloud: GmiCloudData {
api_key: gmicloud_client::creds::gmicloud_api_key::GmiCloudApiKey::new(
easyenv::get_env_string_required("GMICLOUD_API_KEY")?,
),
},
grok_api: GrokApiData {
api_key: grok_api_client::creds::grok_api_key::GrokApiKey::new(
easyenv::get_env_string_required("GROK_API_KEY")?,
),
},
beeble: BeebleData {
api_key: BeebleApiKey::new(easyenv::get_env_string_required("BEEBLE_API_KEY")?),
webhook_url: easyenv::get_env_string_required("BEEBLE_WEBHOOK_URL")?,
},
seedance2pro: Seedance2ProData {
cookies: easyenv::get_env_string_required("SEEDANCE2PRO_COOKIES")?,
cookies_byteplus: easyenv::get_env_string_required("SEEDANCE2PRO_WHITELIST_COOKIES")?,
},
openai: OpenAiData {
api_key: easyenv::get_env_string_required("OPENAI_API_KEY")?,
},
worldlabs: WorldLabsData {
api_key: easyenv::get_env_string_required("WORLDLABS_API_KEY")?,
},
})
}
@@ -9,6 +9,7 @@ use crate::http_server::endpoints::voice_conversion::list_voice_conversion_model
use crate::http_server::session::session_checker::SessionChecker;
use crate::http_server::web_utils::redis_rate_limiter::RedisRateLimiter;
use crate::http_server::web_utils::scoped_temp_dir_creator::ScopedTempDirCreator;
use crate::startup::setup_inference_providers::InferenceProviders;
use crate::state::certs::google_sign_in_cert::GoogleSignInCert;
use crate::state::flags::paging_flags::PagingFlags;
use crate::state::memory_cache::model_token_to_info_cache::ModelTokenToInfoCache;
@@ -25,8 +26,6 @@ use billing_component::stripe::stripe_config::StripeConfig;
use chrono::{DateTime, Utc};
use cloud_storage::bucket_client::BucketClient;
use elasticsearch::Elasticsearch;
use beeble_client::creds::beeble_api_key::BeebleApiKey;
use fal_client::creds::fal_api_key::FalApiKey;
use memory_caching::arc_ttl_sieve::ArcTtlSieve;
use memory_caching::single_item_ttl_cache::SingleItemTtlCache;
use mysql_queries::mediators::badge_granter::BadgeGranter;
@@ -89,22 +88,10 @@ pub struct ServerState {
pub public_bucket_client: BucketClient,
pub auto_gc_bucket_client: BucketClient,
pub fal: FalData,
pub inference_providers: InferenceProviders,
pub gmicloud: GmiCloudData,
pub grok_api: GrokApiData,
pub beeble: BeebleData,
pub seedance2pro: Seedance2ProData,
pub openai: OpenAiData,
pub resend: ResendData,
pub worldlabs: WorldLabsData,
pub pager: Pager,
/// Where to store audio uploads for w2l
@@ -313,56 +300,8 @@ pub struct TrollBans {
pub ip_addresses: IpBanList,
}
/// Fal integration
#[derive(Clone)]
pub struct FalData {
pub api_key: FalApiKey,
pub webhook_url: String,
}
/// GmiCloud integration
#[derive(Clone)]
pub struct GmiCloudData {
pub api_key: gmicloud_client::creds::gmicloud_api_key::GmiCloudApiKey,
}
/// Grok (xAI) API integration
#[derive(Clone)]
pub struct GrokApiData {
pub api_key: grok_api_client::creds::grok_api_key::GrokApiKey,
}
/// Beeble SwitchX integration
#[derive(Clone)]
pub struct BeebleData {
pub api_key: BeebleApiKey,
pub webhook_url: String,
}
/// Seedance 2 Pro integration
#[derive(Clone)]
pub struct Seedance2ProData {
/// Cookie string for seedance2-pro.com
pub cookies: String,
/// Cookie string for seedance2-pro.com (Whitelisted account)
pub cookies_byteplus: String,
}
/// OpenAI integration
#[derive(Clone)]
pub struct OpenAiData {
pub api_key: String,
}
/// Resend integration
#[derive(Clone)]
pub struct ResendData {
pub api_key: String,
}
/// World Labs integration
#[derive(Clone)]
pub struct WorldLabsData {
pub api_key: String,
}