rig_core/providers/xiaomimimo.rs
1//! Xiaomi MiMo's endpoints and model identifiers.
2//!
3//! [`from_env`] and [`new`] build a client on the chat-completions
4//! [`XIAOMIMIMO`](crate::providers::openai::wire::XIAOMIMIMO) dialect, the
5//! module's primary one; [`anthropic_from_env`] and [`anthropic_new`] build a
6//! Messages-format client.
7//!
8//! ```no_run
9//! use rig_core::providers::xiaomimimo;
10//!
11//! # fn run() -> Result<(), Box<dyn std::error::Error>> {
12//! let model = xiaomimimo::from_env()?.chat(xiaomimimo::MIMO_V2_5_PRO);
13//! # let _ = model;
14//! # Ok(())
15//! # }
16//! ```
17
18/// OpenAI-compatible base URL.
19pub const API_BASE_URL: &str = "https://api.xiaomimimo.com/v1";
20/// Anthropic-compatible base URL.
21pub const ANTHROPIC_API_BASE_URL: &str = "https://api.xiaomimimo.com/anthropic";
22
23/// `mimo-v2-flash`
24pub const MIMO_V2_FLASH: &str = "mimo-v2-flash";
25/// `mimo-v2-omni`
26pub const MIMO_V2_OMNI: &str = "mimo-v2-omni";
27/// `mimo-v2-pro`
28pub const MIMO_V2_PRO: &str = "mimo-v2-pro";
29/// `mimo-v2.5`
30pub const MIMO_V2_5: &str = "mimo-v2.5";
31/// `mimo-v2.5-pro`
32pub const MIMO_V2_5_PRO: &str = "mimo-v2.5-pro";
33
34/// Whether MiMo `model` reads images: V2 Flash and Pro and V2.5 Pro are text
35/// only; V2 Omni, V2.5 and later read images. Every wire MiMo serves
36/// applies this rule to an id the catalog does not list.
37pub(crate) fn reads_images(model: &str) -> bool {
38 !((model.starts_with("mimo-v2-") && !model.contains("omni"))
39 || model.starts_with("mimo-v2.5-pro"))
40}
41
42pub mod extension;
43
44/// The provider key: the dialect name, a reply's `Origin::provider` and
45/// the typed provider-options key.
46pub const PROVIDER_NAME: &str = "xiaomimimo";
47
48crate::client::macros::openai_vendor!(crate::providers::openai::wire::XIAOMIMIMO, "Xiaomi MiMo");
49crate::client::macros::anthropic_vendor!(
50 crate::providers::anthropic::wire::XIAOMIMIMO,
51 "Xiaomi MiMo",
52 anthropic_from_env,
53 anthropic_new
54);