### Install SGLang and Launch MiMo-V2-Flash Server Source: https://github.com/xiaomimimo/mimo-v2-flash/blob/main/README.md This snippet details the installation of a specific SGLang version and the subsequent launch of the MiMo-V2-Flash model server. It requires Python 3 and specifies various server configurations including model path, distributed training parameters, and attention mechanisms. The output is a running server ready to accept requests. ```bash pip install sglang==0.5.6.post2.dev8005+pr.15207.g39d5bd57a \ --index-url https://sgl-project.github.io/whl/pr/ \ --extra-index-url https://pypi.org/simple #Launch the server SGLANG_ENABLE_SPEC_V2=1 python3 -m sglang.launch_server \ --model-path XiaomiMiMo/MiMo-V2-Flash \ --served-model-name mimo-v2-flash \ --pp-size 1 \ --dp-size 2 \ --enable-dp-attention \ --tp-size 8 \ --moe-a2a-backend deepep \ --page-size 1 \ --host 0.0.0.0 \ --port 9001 \ --trust-remote-code \ --mem-fraction-static 0.75 \ --max-running-requests 128 \ --chunked-prefill-size 16384 \ --reasoning-parser qwen3 \ --tool-call-parser mimo \ --context-length 262144 \ --attention-backend fa3 \ --speculative-algorithm EAGLE \ --speculative-num-steps 3 \ --speculative-eagle-topk 1 \ --speculative-num-draft-tokens 4 \ --enable-mtp ``` -------------------------------- ### MiMo-V2-Flash System Prompt (Chinese) Source: https://github.com/xiaomimimo/mimo-v2-flash/blob/main/README.md This is an example of a system prompt for the MiMo-V2-Flash model in Chinese. It defines the AI's persona as 'MiMo (中文名称也是MiMo),是小米公司研发的AI智能助手' and provides current date/week information along with a knowledge cutoff date. This prompt helps set the context and behavior for the AI. ```plaintext 你是MiMo(中文名称也是MiMo),是小米公司研发的AI智能助手。 今天的日期:{date} {week},你的知识截止日期是2024年12月。 ``` -------------------------------- ### MiMo-V2-Flash System Prompt (English) Source: https://github.com/xiaomimimo/mimo-v2-flash/blob/main/README.md This is an example of a system prompt for the MiMo-V2-Flash model in English. It defines the AI's persona as 'MiMo, an AI assistant developed by Xiaomi' and provides current date/week information along with a knowledge cutoff date. This prompt helps set the context and behavior for the AI. ```plaintext You are MiMo, an AI assistant developed by Xiaomi. Today's date: {date} {week}. Your knowledge cutoff date is December 2024. ``` -------------------------------- ### SGLang Server Deployment Source: https://context7.com/xiaomimimo/mimo-v2-flash/llms.txt Instructions for deploying the MiMo-V2-Flash inference server using SGLang with Multi-Token Prediction and speculative decoding enabled. This setup supports a large context length and optimized memory management. ```APIDOC ## SGLang Server Deployment ### Description Launch the MiMo-V2-Flash inference server using SGLang with Multi-Token Prediction and speculative decoding enabled. This configuration supports up to 262k context length with optimized memory management and distributed inference across multiple GPUs. ### Method Shell Command ### Endpoint N/A (Server deployment command) ### Parameters None ### Request Example ```bash # Install compatible SGLang version pip install sglang==0.5.6.post2.dev8005+pr.15207.g39d5bd57a \ --index-url https://sgl-project.github.io/whl/pr/ \ --extra-index-url https://pypi.org/simple # Launch inference server with MTP and speculative decoding SGLANG_ENABLE_SPEC_V2=1 python3 -m sglang.launch_server \ --model-path XiaomiMiMo/MiMo-V2-Flash \ --served-model-name mimo-v2-flash \ --pp-size 1 \ --dp-size 2 \ --enable-dp-attention \ --tp-size 8 \ --moe-a2a-backend deepep \ --page-size 1 \ --host 0.0.0.0 \ --port 9001 \ --trust-remote-code \ --mem-fraction-static 0.75 \ --max-running-requests 128 \ --chunked-prefill-size 16384 \ --reasoning-parser qwen3 \ --tool-call-parser mimo \ --context-length 262144 \ --attention-backend fa3 \ --speculative-algorithm EAGLE \ --speculative-num-steps 3 \ --speculative-eagle-topk 1 \ --speculative-num-draft-tokens 4 \ --enable-mtp ``` ### Response #### Success Response Server starts on http://0.0.0.0:9001 Ready to accept requests at /v1/chat/completions endpoint ``` -------------------------------- ### Deploy MiMo-V2-Flash with SGLang Server Source: https://context7.com/xiaomimimo/mimo-v2-flash/llms.txt Launches the MiMo-V2-Flash inference server using SGLang, enabling Multi-Token Prediction and speculative decoding. This setup supports up to 262k context length, optimized memory, and distributed inference. Dependencies include a specific SGLang version. Input is model path and server configuration parameters. Output is the server running status. ```bash pip install sglang==0.5.6.post2.dev8005+pr.15207.g39d5bd57a \ --index-url https://sgl-project.github.io/whl/pr/ \ --extra-index-url https://pypi.org/simple SGLANG_ENABLE_SPEC_V2=1 python3 -m sglang.launch_server \ --model-path XiaomiMiMo/MiMo-V2-Flash \ --served-model-name mimo-v2-flash \ --pp-size 1 \ --dp-size 2 \ --enable-dp-attention \ --tp-size 8 \ --moe-a2a-backend deepep \ --page-size 1 \ --host 0.0.0.0 \ --port 9001 \ --trust-remote-code \ --mem-fraction-static 0.75 \ --max-running-requests 128 \ --chunked-prefill-size 16384 \ --reasoning-parser qwen3 \ --tool-call-parser mimo \ --context-length 262144 \ --attention-backend fa3 \ --speculative-algorithm EAGLE \ --speculative-num-steps 3 \ --speculative-eagle-topk 1 \ --speculative-num-draft-tokens 4 \ --enable-mtp ``` -------------------------------- ### Process Long Context with MiMo-V2-Flash Source: https://context7.com/xiaomimimo/mimo-v2-flash/llms.txt Illustrates processing extended context, up to 256k tokens, using MiMo-V2-Flash. The example shows a `curl` command for a POST request to analyze a large document, identifying specific information like machine learning architectures and findings. It mentions optimized attention mechanisms contributing to efficient processing. ```bash # Read and analyze a large document (example with chunked processing) curl -X POST http://localhost:9001/v1/chat/completions \ -H 'Content-Type: application/json' \ -d '{ "messages": [ { "role": "system", "content": "You are MiMo, an AI assistant developed by Xiaomi.\n\nToday'\''s date: 2025-12-30 Monday. Your knowledge cutoff date is December 2024." }, { "role": "user", "content": "Analyze the following 50-page research paper and identify all mentions of machine learning architectures, their performance metrics, and key findings:\n\n[DOCUMENT CONTENT - 100,000+ tokens]..." } ], "model": "mimo-v2-flash", "max_tokens": 4096, "temperature": 0.8, "top_p": 0.95, "chat_template_kwargs": { "enable_thinking": true } }' ``` -------------------------------- ### Initial API Request with Tool Definitions (curl) Source: https://context7.com/xiaomimimo/mimo-v2-flash/llms.txt This snippet shows an initial POST request to the /v1/chat/completions endpoint. It includes system and user messages, specifies the model, and defines available tools ('get_weather' and 'calculate') with their parameters. This sets up the AI to understand and utilize these tools for task execution. ```bash curl -X POST http://localhost:9001/v1/chat/completions \ -H 'Content-Type: application/json' \ -d '{ "messages": [ { "role": "system", "content": "You are MiMo, an AI assistant developed by Xiaomi.\n\nToday'\''s date: 2025-12-30 Monday. Your knowledge cutoff date is December 2024." }, { "role": "user", "content": "What is the weather in Beijing and calculate 15% tip on a $85 bill?" } ], "model": "mimo-v2-flash", "max_tokens": 4096, "temperature": 0.3, "top_p": 0.95, "tools": [ { "type": "function", "function": { "name": "get_weather", "description": "Get current weather for a location", "parameters": { "type": "object", "properties": { "location": {"type": "string", "description": "City name"} }, "required": ["location"] } } }, { "type": "function", "function": { "name": "calculate", "description": "Perform mathematical calculations", "parameters": { "type": "object", "properties": { "expression": {"type": "string", "description": "Math expression"} }, "required": ["expression"] } } } ], "chat_template_kwargs": { "enable_thinking": true } }' ``` -------------------------------- ### Execute Agentic Code Tasks with MiMo-V2-Flash Source: https://context7.com/xiaomimimo/mimo-v2-flash/llms.txt Demonstrates how to deploy MiMo-V2-Flash for agentic code tasks. This involves sending a system message, a user prompt with a Python code snippet to fix, and specifying model parameters like `max_tokens`, `temperature`, and `top_p`. The expected response includes reasoning and the corrected code. ```bash curl -X POST http://localhost:9001/v1/chat/completions \ -H 'Content-Type: application/json' \ -d '{ "messages": [ { "role": "system", "content": "You are MiMo, an AI assistant developed by Xiaomi.\n\nToday'\''s date: 2025-12-30 Monday. Your knowledge cutoff date is December 2024.\n\nYou are an expert software engineer. Analyze code carefully and provide precise solutions." }, { "role": "user", "content": "Fix the bug in this Python function:\n\n```python\ndef merge_sorted_lists(list1, list2):\n result = []\n i, j = 0, 0\n while i < len(list1) and j < len(list2):\n if list1[i] < list2[j]:\n result.append(list1[i])\n i += 1\n else:\n result.append(list2[j])\n j += 1\n return result\n```\n\nThe function is not returning all elements when one list is longer." } ], "model": "mimo-v2-flash", "max_tokens": 8192, "temperature": 0.3, "top_p": 0.95, "chat_template_kwargs": { "enable_thinking": true } }' ``` -------------------------------- ### POST /v1/chat/completions - Initial Request with Tool Definitions Source: https://context7.com/xiaomimimo/mimo-v2-flash/llms.txt This endpoint initiates a chat completion request. It allows specifying system and user messages, a model, and a list of tools that the AI can use to respond. This is the first step in a conversation where the AI might need to call external functions. ```APIDOC ## POST /v1/chat/completions ### Description Initiates a chat completion request with tool definitions. The AI can use these tools to gather information or perform actions based on the user's query. ### Method POST ### Endpoint `/v1/chat/completions` ### Parameters #### Request Body - **messages** (array) - Required - An array of message objects, each with a `role` (system, user, assistant) and `content`. - **model** (string) - Required - The name of the model to use (e.g., "mimo-v2-flash"). - **max_tokens** (integer) - Optional - The maximum number of tokens to generate in the response. - **temperature** (number) - Optional - Controls the randomness of the generated output. - **top_p** (number) - Optional - Controls diversity via nucleus sampling. - **tools** (array) - Optional - A list of tool definitions that the model can use. - **type** (string) - Required - The type of tool (e.g., "function"). - **function** (object) - Required - The definition of the function tool. - **name** (string) - Required - The name of the function. - **description** (string) - Optional - A description of what the function does. - **parameters** (object) - Required - The parameters the function accepts. - **type** (string) - Required - The type of the parameters (usually "object"). - **properties** (object) - Optional - Defines the properties of the parameters. - **required** (array) - Optional - A list of required parameter names. - **chat_template_kwargs** (object) - Optional - Additional keyword arguments for chat templating. - **enable_thinking** (boolean) - Optional - Enables AI to output its thinking process. ### Request Example ```json { "messages": [ { "role": "system", "content": "You are MiMo, an AI assistant developed by Xiaomi.\n\nToday's date: 2025-12-30 Monday. Your knowledge cutoff date is December 2024." }, { "role": "user", "content": "What is the weather in Beijing and calculate 15% tip on a $85 bill?" } ], "model": "mimo-v2-flash", "max_tokens": 4096, "temperature": 0.3, "top_p": 0.95, "tools": [ { "type": "function", "function": { "name": "get_weather", "description": "Get current weather for a location", "parameters": { "type": "object", "properties": { "location": {"type": "string", "description": "City name"} }, "required": ["location"] } } }, { "type": "function", "function": { "name": "calculate", "description": "Perform mathematical calculations", "parameters": { "type": "object", "properties": { "expression": {"type": "string", "description": "Math expression"} }, "required": ["expression"] } } } ], "chat_template_kwargs": { "enable_thinking": true } } ``` ### Response #### Success Response (200) - **choices** (array) - Contains the model's response. - **message** (object) - The message object from the assistant. - **role** (string) - The role of the message sender (e.g., "assistant"). - **reasoning_content** (string) - The AI's reasoning process (if `enable_thinking` is true). - **tool_calls** (array) - A list of tool calls the AI intends to make. - **id** (string) - The unique ID for the tool call. - **function** (object) - Details about the function call. - **name** (string) - The name of the function to call. - **arguments** (string) - A JSON string representing the arguments for the function call. #### Response Example ```json { "choices": [{ "message": { "role": "assistant", "reasoning_content": "I need to call two functions...", "tool_calls": [ {"id": "call_1", "function": {"name": "get_weather", "arguments": "{\"location\": \"Beijing\"}"}}, {"id": "call_2", "function": {"name": "calculate", "arguments": "{\"expression\": \"85 * 0.15\"}"}} ] } }] } ``` ``` -------------------------------- ### Load and Use MiMo-V2-Flash Model from HuggingFace (Python) Source: https://context7.com/xiaomimimo/mimo-v2-flash/llms.txt Loads the instruction-tuned MiMo-V2-Flash model and tokenizer from HuggingFace Hub using the transformers library. It then prepares a chat-based input with a system prompt and user query, generates a response using the model, and decodes the output. The code is designed for custom inference pipelines and fine-tuning workflows. Dependencies include 'transformers' and 'torch'. ```python from transformers import AutoModelForCausalLM, AutoTokenizer import torch # Load instruction-tuned model model_name = "XiaomiMiMo/MiMo-V2-Flash" tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained( model_name, torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True ) # Prepare input with system prompt messages = [ { "role": "system", "content": "You are MiMo, an AI assistant developed by Xiaomi.\n\nToday's date: 2025-12-30 Monday. Your knowledge cutoff date is December 2024." }, { "role": "user", "content": "Write a Python function to find the longest palindromic substring." } ] # Generate response input_ids = tokenizer.apply_chat_template( messages, add_generation_prompt=True, return_tensors="pt" ).to(model.device) outputs = model.generate( input_ids, max_new_tokens=2048, temperature=0.8, top_p=0.95, do_sample=True ) response = tokenizer.decode(outputs[0][input_ids.shape[1]:], skip_special_tokens=True) print(response) # Expected output: Complete Python function with explanation # def longest_palindrome(s: str) -> str: # if not s: # return "" # # def expand_around_center(left: int, right: int) -> str: # while left >= 0 and right < len(s) and s[left] == s[right]: # left -= 1 # right += 1 # return s[left + 1:right] # # longest = "" # for i in range(len(s)): # # Check odd length palindromes # palindrome1 = expand_around_center(i, i) # # Check even length palindromes # palindrome2 = expand_around_center(i, i + 1) # # longest = max([longest, palindrome1, palindrome2], key=len) # # return longest ``` -------------------------------- ### Solve Mathematical Problems with MiMo-V2-Flash Source: https://context7.com/xiaomimimo/mimo-v2-flash/llms.txt Shows how to use MiMo-V2-Flash for solving complex mathematical problems. The `curl` command demonstrates a request with a system message and a user prompt containing a geometry problem. The model is configured to provide step-by-step reasoning, as indicated by `enable_thinking: true`. ```bash curl -X POST http://localhost:9001/v1/chat/completions \ -H 'Content-Type: application/json' \ -d '{ "messages": [ { "role": "system", "content": "You are MiMo, an AI assistant developed by Xiaomi.\n\nToday'\''s date: 2025-12-30 Monday. Your knowledge cutoff date is December 2024." }, { "role": "user", "content": "A square pyramid has base edge length 12 and height 8. What is the total surface area of the pyramid?" } ], "model": "mimo-v2-flash", "max_tokens": 4096, "temperature": 0.8, "top_p": 0.95, "chat_template_kwargs": { "enable_thinking": true } }' ``` -------------------------------- ### Follow-up API Request with Tool Results (curl) Source: https://context7.com/xiaomimimo/mimo-v2-flash/llms.txt This snippet demonstrates a follow-up POST request that includes the history of the conversation, including the previous assistant response with tool calls and the results from executing those tools. This allows the AI to synthesize the information and provide a final, comprehensive answer. The 'tool' role messages contain the results of the 'get_weather' and 'calculate' functions. ```bash curl -X POST http://localhost:9001/v1/chat/completions \ -H 'Content-Type: application/json' \ -d '{ "messages": [ { "role": "system", "content": "You are MiMo, an AI assistant developed by Xiaomi.\n\nToday'\''s date: 2025-12-30 Monday. Your knowledge cutoff date is December 2024." }, { "role": "user", "content": "What is the weather in Beijing and calculate 15% tip on a $85 bill?" }, { "role": "assistant", "reasoning_content": "I need to call two functions...", "tool_calls": [ {"id": "call_1", "function": {"name": "get_weather", "arguments": "{\"location\": \"Beijing\"}"}}, {"id": "call_2", "function": {"name": "calculate", "arguments": "{\"expression\": \"85 * 0.15\"}"}} ] }, { "role": "tool", "tool_call_id": "call_1", "content": "{\"temperature\": \"5°C\", \"condition\": \"Cloudy\"}" }, { "role": "tool", "tool_call_id": "call_2", "content": "12.75" } ], "model": "mimo-v2-flash", "max_tokens": 4096, "temperature": 0.3, "top_p": 0.95, "chat_template_kwargs": { "enable_thinking": true } }' ``` -------------------------------- ### Multi-Turn Tool Use with Reasoning Source: https://context7.com/xiaomimimo/mimo-v2-flash/llms.txt Execute multi-turn conversations with tool calls while maintaining reasoning history. The model returns both reasoning_content and tool_calls, which must be persisted across turns for context continuity. ```APIDOC ## Multi-Turn Tool Use with Reasoning ### Description Execute multi-turn conversations with tool calls while maintaining reasoning history. The model returns both `reasoning_content` and `tool_calls`, which must be persisted across turns for context continuity. ### Method POST ### Endpoint `/v1/chat/completions` ### Parameters #### Query Parameters None #### Request Body - **messages** (array[object]) - Required - List of message objects, each with `role` (system, user, or assistant) and `content`. For tool use, `content` can include `tool_code` or `tool_results`. - **model** (string) - Required - The name of the model to use (e.g., `mimo-v2-flash`). - **max_tokens** (integer) - Optional - The maximum number of tokens to generate. - **temperature** (number) - Optional - Controls randomness. - **top_p** (number) - Optional - Controls diversity. - **stream** (boolean) - Optional - Whether to stream the response chunks. - **chat_template_kwargs** (object) - Optional - Additional arguments for chat templating. - **enable_thinking** (boolean) - Optional - Enables the model's reasoning output. ### Request Example (Example for a subsequent turn, assuming previous turns included tool calls and results) ```json { "messages": [ {"role": "system", "content": "You are MiMo, an AI assistant developed by Xiaomi."}, {"role": "user", "content": "What is the weather in San Francisco?"}, { "role": "assistant", "tool_code": "print(weather.get_weather(city='San Francisco'))", "reasoning_content": "I need to find the weather for San Francisco. I will use the weather.get_weather tool for this.", "tool_calls": [ { "id": "call_abc123", "type": "function", "function": { "name": "weather.get_weather", "arguments": "{\"city\": \"San Francisco\"}" } } ] }, { "role": "tool", "tool_call_id": "call_abc123", "content": "{\"temperature\": \"72\", \"unit\": \"fahrenheit\", \"description\": \"Clear skies\"}" }, {"role": "user", "content": "And what about in New York?"} ], "model": "mimo-v2-flash", "max_tokens": 4096, "temperature": 0.8, "stream": true, "chat_template_kwargs": { "enable_thinking": true } } ``` ### Response #### Success Response (Streaming) - **id** (string) - Unique identifier for the response. - **object** (string) - Type of object, e.g., `chat.completion.chunk`. - **choices** (array[object]) - List of response choices. - **index** (integer) - Index of the choice. - **delta** (object) - The generated content delta. - **role** (string) - The role of the message (e.g., `assistant`). - **reasoning_content** (string) - The thinking process of the model. - **tool_code** (string) - The code for the tool call. - **tool_calls** (array[object]) - List of tool calls. - **id** (string) - Unique identifier for the tool call. - **type** (string) - Type of tool call (e.g., `function`). - **function** (object) - Details of the function call. - **name** (string) - The name of the function. - **arguments** (string) - JSON string of arguments for the function. - **finish_reason** (string) - The reason the generation finished. #### Response Example (Streaming) ``` data: {"id":"...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"I need to find the weather for New York. I will use the weather.get_weather tool.","tool_calls":[{"id":"call_def456","type":"function","function":{"name":"weather.get_weather","arguments":"{\"city\": \"New York\"}"}}]}},"finish_reason":null}]} ``` ``` -------------------------------- ### Mathematical Reasoning Source: https://context7.com/xiaomimimo/mimo-v2-flash/llms.txt Solve complex mathematical problems with step-by-step reasoning. The model achieves 94.1% on AIME 2025 and 71.0% on MATH benchmark through extended chain-of-thought processing. ```APIDOC ## POST /v1/chat/completions ### Description Solves complex mathematical problems by providing step-by-step reasoning, leveraging chain-of-thought processing. ### Method POST ### Endpoint /v1/chat/completions ### Parameters #### Request Body - **messages** (array[object]) - Required - An array of message objects defining the conversation history and user prompt. - **role** (string) - Required - The role of the message sender ('system' or 'user'). - **content** (string) - Required - The mathematical problem to solve. - **model** (string) - Required - The model to use, e.g., "mimo-v2-flash". - **max_tokens** (integer) - Optional - The maximum number of tokens to generate. - **temperature** (number) - Optional - Controls randomness in generation. - **top_p** (number) - Optional - Controls diversity via nucleus sampling. - **chat_template_kwargs** (object) - Optional - Additional keyword arguments for chat templating. - **enable_thinking** (boolean) - Optional - Enables the display of thinking process. ### Request Example ```json { "messages": [ { "role": "system", "content": "You are MiMo, an AI assistant developed by Xiaomi.\n\nToday's date: 2025-12-30 Monday. Your knowledge cutoff date is December 2024." }, { "role": "user", "content": "A square pyramid has base edge length 12 and height 8. What is the total surface area of the pyramid?" } ], "model": "mimo-v2-flash", "max_tokens": 4096, "temperature": 0.8, "top_p": 0.95, "chat_template_kwargs": { "enable_thinking": true } } ``` ### Response #### Success Response (200) - **choices** (array[object]) - Contains the generated completion(s). - **message** (object) - **reasoning_content** (string) - Detailed step-by-step reasoning for the solution. - **content** (string) - The final answer to the mathematical problem. #### Response Example ```json { "choices": [{ "message": { "reasoning_content": "Need to find base area plus 4 triangular faces. Base area = 12² = 144. For triangular faces, need slant height. Height is 8, distance from center to edge is 6. Slant height = √(8² + 6²) = √100 = 10...", "content": "The total surface area of the pyramid is 384 square units." } }] } ``` ``` -------------------------------- ### POST /v1/chat/completions - Follow-up Request with Tool Results Source: https://context7.com/xiaomimimo/mimo-v2-flash/llms.txt This endpoint is used for follow-up chat completion requests. It includes the history of the conversation, including the AI's previous tool calls and the results from those tools. This allows the AI to generate a final, coherent response based on the provided information. ```APIDOC ## POST /v1/chat/completions ### Description Submits a follow-up chat completion request, including conversation history and tool results. This allows the AI to generate a final response based on all prior interactions. ### Method POST ### Endpoint `/v1/chat/completions` ### Parameters #### Request Body - **messages** (array) - Required - An array of message objects representing the conversation history. This should include system messages, user messages, assistant's previous `reasoning_content` and `tool_calls`, and `tool` responses. - **role** (string) - Required - The role of the message sender (system, user, assistant, tool). - **content** (string) - Required - The content of the message. For `tool` roles, this is the result of the tool execution. - **reasoning_content** (string) - Optional - The AI's reasoning process from a previous assistant turn. - **tool_calls** (array) - Optional - The tool calls made by the assistant in a previous turn. - **id** (string) - The unique ID for the tool call. - **function** (object) - Details about the function call. - **name** (string) - The name of the function to call. - **arguments** (string) - A JSON string representing the arguments for the function call. - **tool_call_id** (string) - Required when `role` is "tool" - The ID of the tool call this result corresponds to. - **model** (string) - Required - The name of the model to use (e.g., "mimo-v2-flash"). - **max_tokens** (integer) - Optional - The maximum number of tokens to generate in the response. - **temperature** (number) - Optional - Controls the randomness of the generated output. - **top_p** (number) - Optional - Controls diversity via nucleus sampling. - **chat_template_kwargs** (object) - Optional - Additional keyword arguments for chat templating. - **enable_thinking** (boolean) - Optional - Enables AI to output its thinking process. ### Request Example ```json { "messages": [ { "role": "system", "content": "You are MiMo, an AI assistant developed by Xiaomi.\n\nToday's date: 2025-12-30 Monday. Your knowledge cutoff date is December 2024." }, { "role": "user", "content": "What is the weather in Beijing and calculate 15% tip on a $85 bill?" }, { "role": "assistant", "reasoning_content": "I need to call two functions...", "tool_calls": [ {"id": "call_1", "function": {"name": "get_weather", "arguments": "{\"location\": \"Beijing\"}"}}, {"id": "call_2", "function": {"name": "calculate", "arguments": "{\"expression\": \"85 * 0.15\"}"}} ] }, { "role": "tool", "tool_call_id": "call_1", "content": "{\"temperature\": \"5°C\", \"condition\": \"Cloudy\"}" }, { "role": "tool", "tool_call_id": "call_2", "content": "12.75" } ], "model": "mimo-v2-flash", "max_tokens": 4096, "temperature": 0.3, "top_p": 0.95, "chat_template_kwargs": { "enable_thinking": true } } ``` ### Response #### Success Response (200) - **choices** (array) - Contains the model's final response. - **message** (object) - The final message object from the assistant. - **role** (string) - The role of the message sender (e.g., "assistant"). - **content** (string) - The final text response generated by the AI, incorporating tool results. #### Response Example ```json { "choices": [ { "message": { "role": "assistant", "content": "The weather in Beijing is currently 5°C and cloudy. A 15% tip on an $85 bill would be $12.75." } } ] } ``` ``` -------------------------------- ### Code Agent Task Execution Source: https://context7.com/xiaomimimo/mimo-v2-flash/llms.txt Deploy MiMo-V2-Flash for agentic code tasks with optimized sampling parameters. The model achieves 73.4% on SWE-Bench Verified through multi-turn reasoning and code generation. ```APIDOC ## POST /v1/chat/completions ### Description Executes agentic code tasks using the MiMo-V2-Flash model, optimized for reasoning and code generation. ### Method POST ### Endpoint /v1/chat/completions ### Parameters #### Request Body - **messages** (array[object]) - Required - An array of message objects defining the conversation history and user prompt. - **role** (string) - Required - The role of the message sender ('system' or 'user'). - **content** (string) - Required - The content of the message. - **model** (string) - Required - The model to use, e.g., "mimo-v2-flash". - **max_tokens** (integer) - Optional - The maximum number of tokens to generate. - **temperature** (number) - Optional - Controls randomness in generation. Lower values make output more focused and deterministic. - **top_p** (number) - Optional - Controls diversity via nucleus sampling. - **chat_template_kwargs** (object) - Optional - Additional keyword arguments for chat templating. - **enable_thinking** (boolean) - Optional - Enables the display of thinking process. ### Request Example ```json { "messages": [ { "role": "system", "content": "You are MiMo, an AI assistant developed by Xiaomi.\n\nToday's date: 2025-12-30 Monday. Your knowledge cutoff date is December 2024.\n\nYou are an expert software engineer. Analyze code carefully and provide precise solutions." }, { "role": "user", "content": "Fix the bug in this Python function:\n\n```python\ndef merge_sorted_lists(list1, list2):\n result = []\n i, j = 0, 0\n while i < len(list1) and j < len(list2):\n if list1[i] < list2[j]:\n result.append(list1[i])\n i += 1\n else:\n result.append(list2[j])\n j += 1\n return result\n```\n\nThe function is not returning all elements when one list is longer." } ], "model": "mimo-v2-flash", "max_tokens": 8192, "temperature": 0.3, "top_p": 0.95, "chat_template_kwargs": { "enable_thinking": true } } ``` ### Response #### Success Response (200) - **choices** (array[object]) - Contains the generated completion(s). - **message** (object) - **reasoning_content** (string) - The model's thinking process. - **content** (string) - The generated response, including corrected code. #### Response Example ```json { "choices": [{ "message": { "reasoning_content": "The bug is that remaining elements aren't added after one list is exhausted...", "content": "The bug is that the function doesn't append remaining elements after exiting the while loop...\n\n```python\ndef merge_sorted_lists(list1, list2):\n result = []\n i, j = 0, 0\n while i < len(list1) and j < len(list2):\n if list1[i] < list2[j]:\n result.append(list1[i])\n i += 1\n else:\n result.append(list2[j])\n j += 1\n result.extend(list1[i:])\n result.extend(list2[j:])\n return result\n```" } }] } ``` ``` -------------------------------- ### MiMo-V2-Flash Technical Report Citation Source: https://github.com/xiaomimimo/mimo-v2-flash/blob/main/README.md This BibTeX entry provides the citation details for the MiMo-V2-Flash technical report. It includes the title, author(s), year, and a URL to the report, allowing researchers and developers to properly reference the work. ```bibtex @misc{mimo2025flash, title={MiMo-V2-Flash Technical Report}, author={LLM-Core Xiaomi}, year={2025}, url={https://github.com/XiaomiMiMo/MiMo-V2-Flash/blob/main/paper.pdf} } ``` -------------------------------- ### Send Request to MiMo-V2-Flash Server Source: https://github.com/xiaomimimo/mimo-v2-flash/blob/main/README.md This snippet demonstrates how to send a chat completion request to the MiMo-V2-Flash model server using cURL. It specifies the request endpoint, headers, and a JSON payload containing user messages, model name, and generation parameters like `max_tokens`, `temperature`, and `stream`. The expected output is a streamed JSON response. ```bash curl -i http://localhost:9001/v1/chat/completions \ -H 'Content-Type:application/json' \ -d '{ "messages" : [{ "role": "user", "content": "Nice to meet you MiMo" }], "model": "mimo-v2-flash", "max_tokens": 4096, "temperature": 0.8, "top_p": 0.95, "stream": true, "chat_template_kwargs": { "enable_thinking": true } }' ``` -------------------------------- ### MiMo-V2-Flash Chat Completions API Source: https://github.com/xiaomimimo/mimo-v2-flash/blob/main/README.md This endpoint allows you to send chat messages to the MiMo-V2-Flash model and receive completions. ```APIDOC ## POST /v1/chat/completions ### Description Sends chat messages to the MiMo-V2-Flash model for generating responses. Supports streaming responses and advanced chat template configurations. ### Method POST ### Endpoint http://localhost:9001/v1/chat/completions ### Parameters #### Request Body - **messages** (array) - Required - The conversation history, each message with a 'role' (user or assistant) and 'content'. - **model** (string) - Required - The name of the model to use, e.g., "mimo-v2-flash". - **max_tokens** (integer) - Optional - The maximum number of tokens to generate. - **temperature** (number) - Optional - Controls randomness. Lower values make output more deterministic. - **top_p** (number) - Optional - Nucleus sampling parameter. - **stream** (boolean) - Optional - Whether to stream the response chunks. - **chat_template_kwargs** (object) - Optional - Additional arguments for the chat template. - **enable_thinking** (boolean) - Optional - Enables thinking mode for tool calls. ### Request Example ```json { "messages" : [ { "role": "user", "content": "Nice to meet you MiMo" } ], "model": "mimo-v2-flash", "max_tokens": 4096, "temperature": 0.8, "top_p": 0.95, "stream": true, "chat_template_kwargs": { "enable_thinking": true } } ``` ### Response #### Success Response (200) - **id** (string) - Unique identifier for the completion. - **object** (string) - Type of the object, e.g., "chat.completion". - **created** (integer) - Timestamp of creation. - **model** (string) - The model used for the completion. - **choices** (array) - Array of completion choices. - **index** (integer) - Index of the choice. - **message** (object) - The generated message. - **role** (string) - Role of the message sender (assistant). - **content** (string) - The generated text content. - **reasoning_content** (string) - (Optional) Reasoning content if thinking mode is enabled. - **tool_calls** (array) - (Optional) Tool calls if the model decides to use tools. - **finish_reason** (string) - The reason for finishing generation (e.g., stop, length). - **usage** (object) - Usage statistics. - **prompt_tokens** (integer) - Number of tokens in the prompt. - **completion_tokens** (integer) - Number of tokens in the completion. - **total_tokens** (integer) - Total tokens used. #### Response Example (Streamed) ```json { "id": "chatcmpl-7b9f6b9f6b9f6b9f6b9f6b9f6b9f6b9f", "object": "chat.completion.chunk", "created": 1678886400, "model": "mimo-v2-flash", "choices": [ { "index": 0, "delta": { "role": "assistant", "content": "Hello!" }, "finish_reason": null } ] } ``` #### Response Example (Non-Streamed) ```json { "id": "chatcmpl-7b9f6b9f6b9f6b9f6b9f6b9f6b9f6b9f", "object": "chat.completion", "created": 1678886400, "model": "mimo-v2-flash", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello! How can I help you today?" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 10, "completion_tokens": 15, "total_tokens": 25 } } ``` ``` -------------------------------- ### API Response with Tool Calls (JSON) Source: https://context7.com/xiaomimimo/mimo-v2-flash/llms.txt This JSON structure represents the AI's response to the initial request. It includes 'reasoning_content' explaining the AI's thought process and 'tool_calls', which are the specific function calls the AI has decided to make based on the user's prompt and the available tools. Each tool call includes an ID, function name, and arguments. ```json { "choices": [{ "message": { "role": "assistant", "reasoning_content": "I need to call two functions...", "tool_calls": [ {"id": "call_1", "function": {"name": "get_weather", "arguments": "{\"location\": \"Beijing\"}"}}, {"id": "call_2", "function": {"name": "calculate", "arguments": "{\"expression\": \"85 * 0.15\"}"}} ] } }] } ```