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 传入:需提供公网可访问的图片 URL 地址。
Base64 编码传入:将图片转换为 Base64 编码字符串后再传入。

图片 URL 传入#

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

OpenAI API#

Curl#

curl --location --request POST 'https://api.shubiaobiao.com/v1/chat/completions' \
--header "api-key: $MIMO_API_KEY" \
--header "Content-Type: application/json" \
--data-raw '{
    "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": "image_url",
                    "image_url": {
                        "url": "https://example-files.cnbj1.mi-fds.com/example-files/image/image_example.png"
                    }
                },
                {
                    "type": "text",
                    "text": "please describe the content of the image"
                }
            ]
        }
    ],
    "max_completion_tokens": 1024
}'

python#

Anthropic API#

Curl#

Python
import os
from anthropic import Anthropic

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

message = client.messages.create(
    model="mimo-v2-omni",
    max_tokens=1024,
    system="You are MiMo, an AI assistant developed by Xiaomi. Today is date: Tuesday, December 16, 2025. Your knowledge cutoff date is December 2024.",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "image",
                    "source": {
                        "type": "url",
                        "url": "https://example-files.cnbj1.mi-fds.com/example-files/image/image_example.png"
                    }
                },
                {
                    "type": "text",
                    "text": "please describe the content of the image"
                }
            ]
        }
    ]
)

print(message.content)

Base64 编码传入#

将图片文件转换为 Base64 编码字符串后传入,适用于图片无法通过公网 URL 访问的场景。转换后的 Base64 编码的字符串大小不能超过 10 MB。

OpenAI API#

请在 Base64 编码前携带前缀:data:{MIME_TYPE};base64,$BASE64_IMAGE
{MIME_TYPE}:图像的 MIME 类型(媒体类型),用于标识图像格式,需替换为实际图像对应的 MIME 值。
$BASE64_IMAGE:图像文件的纯 Base64 编码字符串(不含任何前缀)

Curl#

pyhton#

Anthropic API#

Curl#

--header "api-key: $MIMO_API_KEY" \
--header "Content-Type: application/json" \
--data-raw '{
    "model": "mimo-v2-omni",
    "max_tokens": 1024,
    "system": "You are MiMo, an AI assistant developed by Xiaomi. Today is date: Tuesday, December 16, 2025. Your knowledge cutoff date is December 2024.",
    "messages": [
        {
            "role": "user",
            "content": [
                {
                    "type": "image",
                    "source": {
                        "type": "base64",
                        "media_type": "{MIME_TYPE}"
                        "data": "$BASE64_IMAGE"
                    }
                },
                {
                    "type": "text",
                    "text": "please describe the content of the image"
                }
            ]
        }
    ]
}'

python#

from anthropic import Anthropic

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

message = client.messages.create(
    model="mimo-v2-omni",
    max_tokens=1024,
    system="You are MiMo, an AI assistant developed by Xiaomi. Today is date: Tuesday, December 16, 2025. Your knowledge cutoff date is December 2024.",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "image",
                    "source": {
                        "type": "base64",
                        "media_type": "{MIME_TYPE}"
                        "data": "$BASE64_IMAGE"
                    }
                },
                {
                    "type": "text",
                    "text": "please describe the content of the image"
                }
            ]
        }
    ]
)

print(message.content)

多图输入#

支持同时传入多张图像的公网 URL 或 Base64 编码字符串,模型能够解析图像内容并返回贴合图像语义的回复。
Curl
pyhton
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": "image_url",
                    "image_url": {
                        "url": "https://example-files.cnbj1.mi-fds.com/example-files/image/image_example.png"
                    }
                },
                {
                    "type": "image_url",
                    "image_url": {
                        "url": "data:{MIME_TYPE};base64,$BASE64_IMAGE"
                    }
                },
                {
                    "type": "text",
                    "text": "please describe the connections and differences between these two pictures"
                }
            ]
        }
    ],
    max_completion_tokens=1024
)

print(completion.model_dump_json())
修改于 2026-03-19 05:52:02
上一页
图片理解
下一页
图片限制
Built with