Skip to main content

Crate mimo_api

Crate mimo_api 

Source
Expand description

§MiMo API - Xiaomi MiMo API Client for Rust

A Rust client library for Xiaomi MiMo Open Platform API, compatible with OpenAI API format.

§Features

  • Chat completions (streaming and non-streaming)
  • Function calling / Tool use
  • Web search integration
  • Multi-modal input (image, audio, video)
  • Text-to-speech synthesis
  • Structured output
  • Deep thinking mode

§Example

use mimo_api::{Client, Message, ChatRequest};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create client from environment variable XIAOMI_API_KEY
    let client = Client::from_env()?;
     
    // Create a chat request
    let request = ChatRequest::new("mimo-v2-flash")
        .message(Message::user("Hello, introduce yourself!"));
     
    // Send the request
    let response = client.chat(request).await?;
     
    println!("{}", response.choices[0].message.content);
    Ok(())
}

§Environment Variables

  • XIAOMI_API_KEY: Your Xiaomi MiMo API key (required)

Re-exports§

pub use client::Client;
pub use error::Error;
pub use error::Result;
pub use types::*;

Modules§

client
HTTP client for the MiMo API.
error
Error types for the MiMo API client.
prelude
Re-export commonly used types
schema
Schema helpers for creating tool parameter schemas.
types
Data types for the MiMo API.