LogoMiMo API 文件
LogoMiMo API 文件
首頁歡迎使用

快速開始

定價與限速

API 參考

OpenAI 相容 APIAnthropic 相容 API

指南

支援

常見問題
API 參考聊天

OpenAI 相容 API

使用 OpenAI 相容端點,透過標準 Chat Completions 格式與 MiMo 模型互動。

端點

POST https://api.mimo-v2.com/v1/chat/completions

認證

使用以下任一請求頭進行身份驗證:

請求頭格式
api-key<your-api-key>
AuthorizationBearer <your-api-key>

您可以在 Mimo 控制檯的 設定 → API 金鑰 中生成 API 金鑰。

請求引數

引數型別必填說明
modelstring是模型 ID。可選值:mimo-v2-pro、mimo-v2-omni、mimo-v2-flash
messagesarray是訊息物件陣列,包含 role 和 content
max_completion_tokensinteger否最大生成 token 數(預設值因模型而異)
temperaturenumber否取樣溫度,0-2(預設:1.0)
top_pnumber否核取樣閾值,0-1(預設:0.95)
streamboolean否啟用流式輸出(預設:false)
stopstring/array否停止序列
frequency_penaltynumber否頻率懲罰,-2 到 2(預設:0)
presence_penaltynumber否存在懲罰,-2 到 2(預設:0)
toolsarray否工具/函式定義列表
tool_choicestring/object否工具選擇策略:auto、none 或指定工具

訊息物件

欄位型別說明
rolestring可選值:system、user、assistant、tool
contentstring/array訊息內容(文字或多模態內容陣列)
reasoning_contentstring(可選)模型的思考/推理內容
tool_callsarray(可選)助手發起的工具呼叫

請求示例

curl https://api.mimo-v2.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "api-key: YOUR_API_KEY" \
  -d '{
    "model": "mimo-v2-pro",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "你好,你是誰?"}
    ],
    "max_completion_tokens": 1024,
    "temperature": 0.7
  }'

響應格式

{
  "id": "chatcmpl-xxx",
  "object": "chat.completion",
  "created": 1711234567,
  "model": "mimo-v2-pro",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! I am MiMo...",
        "reasoning_content": "The user asked me to introduce myself..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 50,
    "completion_tokens": 100,
    "total_tokens": 150
  }
}

響應欄位

欄位說明
id補全的唯一識別符號
object固定為 chat.completion
created響應建立的 Unix 時間戳
model用於補全的模型
choices補全選項陣列
choices[].message.content生成的文字響應
choices[].message.reasoning_content模型的內部推理(可用時)
choices[].finish_reason模型停止原因:stop、length 或 tool_calls
usageToken 使用統計

流式響應

當 stream 設為 true 時,API 返回 Server-Sent Events(SSE)。每個事件包含一個部分響應塊。

流式請求示例

curl https://api.mimo-v2.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "api-key: YOUR_API_KEY" \
  -d '{
    "model": "mimo-v2-pro",
    "messages": [
      {"role": "user", "content": "你好!"}
    ],
    "stream": true
  }'

流式事件格式

每個 SSE 事件以 data: 為字首,包含一個 JSON 塊。流以 data: [DONE] 事件結束。

data: {"id":"chatcmpl-xxx","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":null}]}

data: {"id":"chatcmpl-xxx","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null}]}

data: {"id":"chatcmpl-xxx","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"好"},"finish_reason":null}]}

data: {"id":"chatcmpl-xxx","object":"chat.completion.chunk","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}

data: [DONE]

在流式模式下,reasoning_content 可能出現在主 content 之前的早期 delta 塊中。

定價與限速

上一頁

Anthropic 相容 API

使用 Anthropic 相容端點,透過 Messages API 格式與 MiMo 模型互動。

目錄

端點
認證
請求引數
訊息物件
請求示例
響應格式
響應欄位
流式響應
流式請求示例
流式事件格式