pub const GLOBAL_API_BASE_URL: &str = "https://api.minimax.io/v1";
pub const CHINA_API_BASE_URL: &str = "https://api.minimaxi.com/v1";
pub const GLOBAL_ANTHROPIC_API_BASE_URL: &str = "https://api.minimax.io/anthropic";
pub const CHINA_ANTHROPIC_API_BASE_URL: &str = "https://api.minimaxi.com/anthropic";
pub const MINIMAX_M3: &str = "MiniMax-M3";
pub const MINIMAX_M2_7: &str = "MiniMax-M2.7";
pub const MINIMAX_M2_7_HIGHSPEED: &str = "MiniMax-M2.7-highspeed";
pub const MINIMAX_M2_5: &str = "MiniMax-M2.5";
pub const MINIMAX_M2_5_HIGHSPEED: &str = "MiniMax-M2.5-highspeed";
pub(crate) fn reads_images(model: &str) -> bool {
!model.to_ascii_lowercase().starts_with("minimax-m2")
}
#[cfg(feature = "audio")]
pub mod audio_generation;
pub mod extension;
#[cfg(feature = "image")]
pub mod image_generation;
#[cfg(feature = "audio")]
pub mod voice_clone;
#[cfg(feature = "audio")]
pub use audio_generation::*;
#[cfg(feature = "image")]
pub use image_generation::*;
#[cfg(feature = "audio")]
pub use voice_clone::voice_cloning;
pub const PROVIDER_NAME: &str = "minimax";
crate::client::macros::openai_vendor!(crate::providers::openai::wire::MINIMAX, "MiniMax");
crate::client::macros::anthropic_vendor!(
crate::providers::anthropic::wire::MINIMAX,
"MiniMax",
anthropic_from_env,
anthropic_new
);
#[cfg(any(feature = "image", feature = "audio"))]
pub(crate) fn decode_reply<T: serde::de::DeserializeOwned>(
body: &[u8],
) -> Result<T, crate::error::ProviderError> {
#[derive(serde::Deserialize)]
struct Status {
#[serde(default)]
base_resp: Option<BaseResp>,
}
#[derive(serde::Deserialize)]
struct BaseResp {
#[serde(default)]
status_code: i64,
}
let status: Status = serde_json::from_slice(body)?;
if status
.base_resp
.is_some_and(|status| status.status_code != 0)
{
return Err(crate::error::ProviderError::from_provider_body(
String::from_utf8_lossy(body),
));
}
Ok(serde_json::from_slice(body)?)
}
#[cfg(all(test, any(feature = "image", feature = "audio")))]
mod tests;