mimo-v2.5 是小米的推理模型(reasoning model),通过 OpenAI 兼容 API 调用。
关键参数:
- Base URL:
https://token-plan-cn.xiaomimimo.com/v1 - 模型名:
mimo-v2.5 - 响应格式: 标准 OpenAI chat completion,但额外包含
reasoning_content字段
单条跨境电商数据分析请求(system prompt + 一条英文新闻标题):
prompt_tokens: 42
completion_tokens: 575
└─ reasoning_tokens: 437 (76%)
└─ content_tokens: 138 (24%)
含义:mimo 将 3/4 的 token 预算用于内部推理链,只用 1/4 输出实际内容。
{
"choices": [{
"message": {
"role": "assistant",
"content": "{\"title_cn\": \"...\", \"summary\": \"...\", ...}",
"reasoning_content": "First, I need to analyze..."
}
}],
"usage": {
"completion_tokens": 575,
"completion_tokens_details": {
"reasoning_tokens": 437
}
}
}content字段为实际 JSON 输出(string 类型)reasoning_content为内部推理过程(不影响分析结果)- 如果
content为null(不是空字符串),Python 的.strip()会抛AttributeError - 当前代码
analyzer.py:212直接取choices[0].message.content,未处理 null 情况
analyzer.py:209 设置 timeout=60(秒)。mimo 单条推理实际耗时:
| 数据复杂度 | 推理 tokens | 预估耗时 | 是否可能超时 |
|---|---|---|---|
| 简单标题 | ~200 | ~10s | ❌ |
| 中等复杂 | ~400 | ~25s | ❌ |
| 复杂长文 | ~600+ | ~45s+ |
80 条数据中最复杂的 10-20 条可能触发超时 → 降级为 heuristic。
在运行日报前,用以下 Python 片段验证 mimo API 是否正常:
import requests, os
from dotenv import load_dotenv
load_dotenv('.env')
resp = requests.post(
f"{os.getenv('OPENAI_BASE_URL')}/chat/completions",
headers={"Authorization": f"Bearer {os.getenv('OPENAI_API_KEY')}", "Content-Type": "application/json"},
json={"model": "mimo-v2.5", "messages": [{"role": "user", "content": "say hi"}], "max_tokens": 50},
timeout=30,
)
data = resp.json()
content = data["choices"][0]["message"].get("content", "")
print(f"Status: {resp.status_code}, Content: {repr(content[:100])}")
# 应输出 HTTP 200 + 非空 content| 模型 | 类型 | 单条分析耗时 | 输出质量 | 稳定性 |
|---|---|---|---|---|
| mimo-v2.5 | reasoning | 20-50s | ✅ 高 | |
| gpt-4o | non-reasoning | 5-10s | ✅ 高 | ✅ 稳定 |
| gpt-4o-mini | non-reasoning | 2-5s | 🟡 中 | ✅ 稳定 |
| qwen-turbo | non-reasoning | 3-8s | 🟡 中 | ✅ 稳定 |
| agent 模式 | 无外部 API | 0s(Agent 直接分析) | ✅✅ 最高 | ✅ 无降级风险 |
生产环境首选:mode: agent
- 由 cron agent 自身做分析,无需外部 API
- 无超时、无限流、无降级风险
- 分析质量最高(Agent 有完整上下文和专业知识)
如必须用 llm 模式:
- 将
timeout从 60 改为 120 - 将
max_items_per_run从 80 降为 30-40 - 在 analyzer.py 中增加
contentnull 检查:content = resp.json()["choices"][0]["message"].get("content") or ""