MaaS_Mimo
请求协议
https
Header
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
Content-Type |
string | 是 | 固定为 application/json |
Authorization |
string | 是 | Bearer ${YOUR_AK} |
请求 URL
POST
https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/chat/completions
请求 Body 参数
| 参数名 | 字段类型 | 是否必填 | 默认值 | 描述 |
|---|---|---|---|---|
| messages | array | 是 | - | 对话的消息列表。包含 content, role, name 等子属性。 |
messages.content |
string / array | 是 | - | 开发者消息的内容。 |
messages.role |
string | 是 | - | 开发者消息的角色,可选值:developer。 |
messages.name |
string | 否 | - | 参与者的可选名称,为模型提供信息以区分相同角色的参与者。 |
| model | string | 是 | - | 用于生成响应的模型 ID。 |
| frequency_penalty | number / null | 否 | 0 |
取值范围 [-2.0, 2.0]。正值会根据 token 在已有文本中的出现频率进行惩罚,降低重复可能性。 |
| max_completion_tokens | integer / null | 否 | 32768 | 对话补全中可以生成的 token 数的上限。 取值范围为 [1, 8192]所需范围: [1, 131072] |
| presence_penalty | number / null | 否 | 0 |
取值范围 [-2.0, 2.0]。正值会根据 token 是否已在文本中出现进行惩罚,增加谈论新主题的可能性。 |
| response_format | object | 否 | - | 一个指定模型必须输出的格式的对象。 |
response_format.type |
string | 是 | - | 所定义的响应格式类型,仅为 text。 |
| stop | string / array / null | 否 | null |
最多 4 个序列,当 API 生成到这些序列时会停止生成。 |
| stream | boolean / null | 否 | false |
若为 true,模型的响应数据会通过 SSE 流式传输到客户端。 |
| thinking | object | 否 | - | 控制模型是否启用思维链。 |
thinking.type |
string | 是 | enabled | 是否启用思维链,可选值:enabled, disabled。 |
| temperature | number | 否 | 1.0 | 采样温度,介于 0 和 1.5 之间。较高的值使输出更随机,较低的值更确定。 |
| tool_choice | string | 否 | auto |
控制模型如何选择工具。 |
| tools | array | 否 | - | 模型可能调用的工具列表,目前仅支持函数作为工具。 |
tools.function |
object | 是 | - | 用于生成响应的函数工具。 |
tools.function.name |
string | 是 | - | 工具函数的名称,长度限制为 1-64 字符。 |
tools.function.description |
string | 否 | - | 函数功能的描述,供模型判断何时以及如何调用该函数。 |
tools.function.parameters |
object | 否 | - | 函数接受的参数,以 JSON 模式对象的形式描述。 |
tools.function.strict |
boolean | 否 | false |
生成函数调用时是否启用严格的模式遵循。 |
tools.type |
string | 是 | - | 工具类型,目前仅支持 function。 |
| top_p | number | 否 | 0.95 |
核采样的概率阈值,用于控制模型生成文本的多样性。 |
调用示例
模型支持路径:MaaS_Mimo_V2.5_20260423 、MaaS_Mimo_V2.5_pro_20260423
/chat/completions
/chat/completions 非流式请求
curl --location --request POST 'https://genaiapi.cloudsway.net/v1/ai/{Your EndpointPath}/chat/completions' \
--header 'Authorization: Bearer ${your AK}' \
--header 'Content-Type: application/json' \
--data-raw '{
"messages": [
{
"role": "system",
"content": "You are MiMo, an AI assistant developed by Xiaomi. Today is date: Tuesday, December 16, 2025. Your knowledge cutoff date is December 2024."
},
{
"role": "user",
"content": "please introduce yourself"
}
],
"max_completion_tokens": 1024
}'
/v1/messages
curl --location --request POST 'http://genaiapi.cloudsway.net/{Your EndpointPath}/v1/messages' \
--header 'Authorization: Bearer ${your AK}' \
--header 'Content-Type: application/json' \
--data-raw '{
"max_tokens": 128,
"system": [
{
"type": "text",
"text": "You are a helpful assistant that remembers our conversation.",
"cache_control": {"type": "ephemeral"}
}
],
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "My name is Alex. I work on machine learning.",
"cache_control": {"type": "ephemeral"}
}
]
},
{"role": "user", "content": "What did I say I work on?"}
]
}'
返回示例
{
"id": "chatcmpl-LnYo0Rzyh3fkDQGmYoETI54W",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! I'm MiMo, an AI assistant created by Xiaomi. I'm here to help answer your questions, provide information, and assist with various tasks to the best of my abilities. Feel free to ask me anything! 😊",
"reasoning_content": "Hmm, the user asked for a self-introduction. This is a straightforward request with no complex requirements. \n\nI should keep it concise but cover key points: identity, purpose, and availability. Since I'm an AI assistant, I'll mention my developer and core function. \n\nAdding a friendly closing would make it more engaging. No need for extra details unless the user asks follow-up questions. \n\nThe tone should be helpful and approachable, matching how a digital assistant would naturally introduce itself."
},
"finish_reason": "stop",
"native_finish_reason": "stop"
}
],
"created": 1780036404,
"model": "MaaS_Mimo_V2.5_20260423",
"object": "chat.completion",
"usage": {
"prompt_tokens": 55,
"completion_tokens": 149,
"total_tokens": 204,
"completion_tokens_details": {
"accepted_prediction_tokens": 0,
"audio_tokens": 0,
"image_tokens": 0,
"reasoning_tokens": 99,
"rejected_prediction_tokens": 0
},
"prompt_tokens_details": {
"audio_tokens": 0,
"cached_tokens": 0,
"image_tokens": 0
}
}
}
统一域名访问
/chat/completions
curl --location --request POST 'https://genaiapi.cloudsway.net/v1/chat/completions' \
--header 'Authorization: Bearer ${your AK}' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "MaaS_Mimo_V2.5_20260423",
"messages": [
{
"role": "system",
"content": "You are MiMo, an AI assistant developed by Xiaomi. Today is date: Tuesday, December 16, 2025. Your knowledge cutoff date is December 2024."
},
{
"role": "user",
"content": "please introduce yourself"
}
],
"max_completion_tokens": 1024
}'
/v1/messages
curl --location --request POST 'https://genaiapi.cloudsway.net/v1/messages' \
--header 'Authorization: Bearer ${your AK}' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "MaaS_Mimo_V2.5_20260423",
"max_tokens": 128,
"system": [
{
"type": "text",
"text": "You are a helpful assistant that remembers our conversation.",
"cache_control": {"type": "ephemeral"}
}
],
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "My name is Alex. I work on machine learning.",
"cache_control": {"type": "ephemeral"}
}
]
},
{"role": "user", "content": "What did I say I work on?"}
]
}'
返回示例
{
"id": "4340ec22040848d9ab8d24c2412684dd",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "You said you work on **machine learning**. Nice to meet you, Alex! 😊"
},
{
"type": "thinking",
"signature": "",
"thinking": "The user told me their name is Alex and they work on machine learning."
}
],
"model": "MaaS_Mimo_V2.5_20260423",
"usage": {
"input_tokens": 44,
"output_tokens": 37
},
"stop_reason": "end_turn"
}