# MiMo 2.5 视频理解调用指南 ## ⚠️ 关键注意事项 **必须用 OpenAI 格式调用,Anthropic 格式会丢弃视频数据!** ## 调用方式 ```python import openai import base64 client = openai.OpenAI( base_url="http://127.0.0.1:15721/v1", # 本地代理 api_key="dummy-key" ) with open("compressed.mp4", "rb") as f: video_b64 = base64.b64encode(f.read()).decode() response = client.chat.completions.create( model="mimo-v2.5", # 模型名 messages=[{ "role": "user", "content": [ { "type": "video_url", # ← OpenAI 格式 "video_url": { "url": f"data:video/mp4;base64,{video_b64}" } }, { "type": "text", "text": "请分析这个视频的内容" } ] }], max_tokens=8192, ) print(response.choices[0].message.content) ``` ## 错误示范 (Anthropic 格式 — 会丢失视频!) ```python # ❌ 错误! 视频数据会被丢弃 client = anthropic.Anthropic(base_url="http://127.0.0.1:15721", api_key="dummy-key") message = client.messages.create( model="claude-opus-4-8", messages=[{ "role": "user", "content": [ {"type": "video", "source": {"type": "base64", ...}}, # ← 不支持! {"type": "text", "text": "..."} ] }] ) ``` ## 参数说明 | 参数 | 推荐值 | 说明 | |------|--------|------| | `model` | `mimo-v2.5` | 通过代理映射到 MiMo 2.5 | | `video_url.url` | `data:video/mp4;base64,...` | Base64 编码的视频 | | `max_tokens` | 8192 | 输出 token 上限 | | `temperature` | 0.1 | 低温度,更稳定的分析 | ## 视频压缩建议 | 原始大小 | 建议 | 压缩后 | |---------|------|--------| | > 10 MB | 必须压缩 | scale=480, crf=28 | | 2-10 MB | 建议压缩 | scale=480, crf=30 | | < 2 MB | 可直接发送 | — | ```bash ffmpeg -y -i input.mp4 -vf scale=-2:480 -c:v libx264 -preset fast -crf 28 -c:a aac -b:a 48k -ar 16000 -ac 1 output.mp4 ```