1. 视频
API接口文档
  • 更新日志
  • 介绍
  • 稳定性保障
  • 模型接口
    • 谷歌gemini
      • 聊天
        • 文本生成
        • 文本生成-流式
        • 文本生成-流式-思考
      • 图像
        • 图片生成-文生图
        • 图片生成-图生图-传入base64编码
        • 图片生成-图生图-控制长宽比
        • 图片生成-图生图-控制长宽比和分辨率
        • 图片生成-依托 Google 图片搜索生成图片
        • 图片编辑
        • 图片理解
      • 语音
        • Gemini-音频理解
        • 文字转语音-单人
        • 文字转语音-多人
      • 文档
        • 文档理解
      • 工具
        • 函数调用
        • 代码执行
        • Google Search
        • Google Maps
        • URL context
      • 视觉& Veo
        • 视频生成
        • 视频理解
      • 嵌入(Embeddings)
        • Embeddings
    • Claude
      • 聊天
        • 聊天对话
        • 思考
      • 图片
        • 图片理解-本地图片
        • 图片理解-URL图片
      • 文档
        • PDF文档识别-URL文档
        • PDF文档识别 -本地文档
      • 工具
        • 函数调用
    • OpenAI
      • 聊天
        • 聊天对话
      • 图片
        • 图片识别-传入url
        • 图片识别-本地图片
        • gpt-图像编辑
        • gpt-文本生图
      • 视频
        • Sora-视频生成官方格式
      • 语音
        • TTS-文本转语音
      • 使用工具
        • 网络搜索
    • 可灵
      • 图像生成
      • 文生视频
      • 图生视频
      • 查询任务
    • MJ图像
      • 快速教学
      • 切换不同的速度
      • 任务提交
        • 提交Imagine
        • 执行Action任务
        • 提交Describe任务
        • 提交Blend任务
      • 任务查询
        • 查询所有任务
        • 根据ID列表查询任务
        • 指定ID获取任务
        • 获取任务图片的seed
    • xAI
      • 聊天
        • 文本生成
        • 流式输出
        • 思维Reasoning
      • 图片
        • 图片理解
        • 图片生成
      • 视频
        • 视频生成
      • 语音
        • 文字生成语音
      • 工具
        • 函数调用
        • 网络搜索
    • minimax
      • MiniMax概述
    • 模型(Models)
      • 列出模型
    • 小米mimo
      • 模型超参
      • 对话
        • openai格式
        • Anthropic API格式
      • 图片
        • 图片理解
        • 图片传入方式
        • 图片限制
      • 视频
        • 视频理解
  • 常见错误
    • Unexpected role "tool". Allowed roles are "user" or "assistant". For instructions on how to use tools
    • This model is not supported by Responses API.
    • 403 Forbidden {"message":"用户额度不足, 剩余额度: $-1.74
    • The model is overloaded. Please try again later
    • No available channel for model
    • API接口返回HTTP 状态码及其含义
  1. 视频

视频理解

快速开始#

通过视频 URL 方式传入模型快速体验视频理解效果,示例代码如下。

curl#

python#

from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("MIMO_API_KEY"),
    base_url="https://api.xiaomimimo.com/v1"
)

completion = client.chat.completions.create(
    model="mimo-v2-omni",
    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": [
                {
                    "type": "video_url",
                    "video_url": {
                        "url": "https://example-files.cnbj1.mi-fds.com/example-files/video/video_example.mp4"
                    },
                    "fps": 2,
                    "media_resolution": "default"
                },
                {
                    "type": "text",
                    "text": "please describe the content of the video"
                }
            ]
        }
    ],
    max_completion_tokens=1024
)

print(completion.model_dump_json())

响应结果#

{
    "id": "2cb45ce8504441c29f0601de5e5b61ff",
    "choices": [
        {
            "finish_reason": "stop",
            "index": 0,
            "message": {
                "content": "The video features a small, fluffy white kitten sitting on a polished wooden floor. The kitten is positioned near a window draped with light-colored, textured curtains. Bright sunlight streams through the window, casting distinct shadows and illuminating the kitten's fur. The kitten looks towards the left side of the frame and occasionally licks its nose or lips. In the background, to the right, a potted green plant with large leaves, resembling a Monstera, is visible against a plain wall. The overall scene is bright and peaceful.",
                "role": "assistant",
                "tool_calls": null,
                "reasoning_content": "The user wants a description of the video provided.\n1.  **Analyze the video:**\n*   **Subject:** A white kitten.\n*   **Action:** The kitten is sitting on a wooden floor, looking towards the left side of the frame. It occasionally licks its lips or nose.\n*   **Setting:** Indoors, near a window with light-colored curtains. Sunlight is streaming in, creating shadows on the floor. There is a plant in the background (Monstera)."
            }
        }
    ],
    "created": 1773831625,
    "model": "mimo-v2-omni",
    "object": "chat.completion",
    "usage": {
        "completion_tokens": 210,
        "prompt_tokens": 1278,
        "total_tokens": 1488,
        "completion_tokens_details": {
            "reasoning_tokens": 101
        },
        "prompt_tokens_details": {
            "audio_tokens": 20,
            "cached_tokens": 47,
            "video_tokens": 1170
        }
    }
}

视频传入方式#

支持的视频传入方式如下:#

视频 URL 传入:需提供公网可访问的视频 URL 地址。
Base64 编码传入:将视频转换为 Base64 编码字符串后再传入。

视频 URL 传入#

通过公网可访问的视频 URL 地址直接传入视频,适用于视频已存储在公网可访问环境的场景。单个视频文件大小不能超过 300 MB。

Curl#

python#

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("MIMO_API_KEY"),
    base_url="https://api.shubiaobiao.com/v1"
)

completion = client.chat.completions.create(
    model="mimo-v2-omni",
    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": [
                {
                    "type": "video_url",
                    "video_url": {
                        "url": "https://example-files.cnbj1.mi-fds.com/example-files/video/video_example.mp4"
                    },
                    "fps": 2,
                    "media_resolution": "default"
                },
                {
                    "type": "text",
                    "text": "please describe the content of the video"
                }
            ]
        }
    ],
    max_completion_tokens=1024
)

print(completion.model_dump_json())

Base64 编码传入#

将视频文件转换为 Base64 编码字符串后传入,适用于视频无法通过公网 URL 访问的场景。转换后的 Base64 编码的字符串大小不能超过 10 MB。
请在 Base64 编码前携带前缀:data:{MIME_TYPE};base64,$BASE64_VIDEO
{MIME_TYPE}:视频的 MIME 类型(媒体类型),用于标识视频格式,需替换为实际视频对应的 MIME 值。
$BASE64_VIDEO:视频文件的纯 Base64 编码字符串(不含任何前缀)。

curl#

python#

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("MIMO_API_KEY"),
    base_url="https://api.shubiaobiao.com/v1"
)

completion = client.chat.completions.create(
    model="mimo-v2-omni",
    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": [
                {
                    "type": "video_url",
                    "video_url": {
                        "url": "data:{MIME_TYPE};base64,$BASE64_VIDEO"
                    },
                    "fps": 2,
                    "media_resolution": "default"
                },
                {
                    "type": "text",
                    "text": "please describe the content of the video"
                }
            ]
        }
    ],
    max_completion_tokens=1024
)

print(completion.model_dump_json())

使用说明#

视频限制#

视频格式:MP4,MOV,AVI,WMV。
视频文件格式变种较多,不能保证所有文件都能被识别,请通过测试验证文件能够被正常识别。
视频大小:
以 URL 方式传入时:单个视频文件大小不超过 300 MB。
以 Base64 编码传入时:单个视频的 Base64 编码字符串大小不超过 10 MB。
视频数量:传入多个视频时,视频数量受模型上下文长度限制,所有音频和文本的总 Token 数必须小于模型的上下文长度。
修改于 2026-03-19 06:04:01
上一页
图片限制
下一页
Unexpected role "tool". Allowed roles are "user" or "assistant". For instructions on how to use tools
Built with