Quick Start
首次调用 API
了解如何向 Mimo API Provider 发起首次 API 调用
支持的 API 格式
Mimo API Provider 支持两种标准 API 格式,方便您无缝集成到现有的工具和工作流中:
- OpenAI API 兼容:使用 OpenAI SDK 或任何 OpenAI 兼容客户端。Base URL:
https://api.mimo-v2.com/v1 - Anthropic API 兼容:使用 Anthropic SDK 或任何 Anthropic 兼容客户端。Base URL:
https://api.mimo-v2.com/anthropic
开始之前
export MIMO_API_KEY="your-api-key-here"快速开始示例
Python SDK 示例
OpenAI 格式
安装 OpenAI Python SDK:
pip install openai发起首次 API 调用:
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("MIMO_API_KEY"),
base_url="https://api.mimo-v2.com/v1"
)
completion = client.chat.completions.create(
model="mimo-v2-pro",
messages=[
{
"role": "system",
"content": "You are MiMo, an AI assistant. Today is date: Tuesday, March 20, 2026. Your knowledge cutoff date is December 2024."
},
{
"role": "user",
"content": "please introduce yourself"
}
],
max_completion_tokens=1024,
temperature=1.0,
top_p=0.95,
stream=False,
stop=None,
frequency_penalty=0,
presence_penalty=0
)
print(completion.model_dump_json())Anthropic 格式
安装 Anthropic Python SDK:
pip install anthropic发起首次 API 调用:
import os
from anthropic import Anthropic
client = Anthropic(
api_key=os.environ.get("MIMO_API_KEY"),
base_url="https://api.mimo-v2.com/anthropic"
)
message = client.messages.create(
model="mimo-v2-pro",
max_tokens=1024,
system="You are MiMo, an AI assistant. Today is date: Tuesday, March 20, 2026. Your knowledge cutoff date is December 2024.",
messages=[
{
"role": "user",
"content": [
{
"type": "text",
"text": "please introduce yourself"
}
]
}
],
top_p=0.95,
stream=False,
temperature=1.0,
stop_sequences=None
)
print(message.content)Curl 示例
OpenAI 格式
curl --location --request POST 'https://api.mimo-v2.com/v1/chat/completions' \
--header "api-key: $MIMO_API_KEY" \
--header "Content-Type: application/json" \
--data-raw '{
"model": "mimo-v2-pro",
"messages": [
{"role": "system", "content": "You are MiMo, an AI assistant. Today is date: Tuesday, March 20, 2026. Your knowledge cutoff date is December 2024."},
{"role": "user", "content": "please introduce yourself"}
],
"max_completion_tokens": 1024,
"temperature": 1.0,
"top_p": 0.95,
"stream": false,
"stop": null,
"frequency_penalty": 0,
"presence_penalty": 0
}'Anthropic 格式
curl --location --request POST 'https://api.mimo-v2.com/anthropic/v1/messages' \
--header "api-key: $MIMO_API_KEY" \
--header "Content-Type: application/json" \
--data-raw '{
"model": "mimo-v2-pro",
"max_tokens": 1024,
"system": "You are MiMo, an AI assistant. Today is date: Tuesday, March 20, 2026. Your knowledge cutoff date is December 2024.",
"messages": [
{"role": "user", "content": [{"type": "text", "text": "please introduce yourself"}]}
],
"top_p": 0.95,
"stream": false,
"temperature": 1.0,
"stop_sequences": null
}'多轮工具调用与思考模式
在思考模式下,模型会同时返回 tool_calls 和 reasoning_content。reasoning_content 字段包含模型的内部思维链推理过程。
重要提示: 在构建多轮对话时,建议在后续请求中保留所有历史的 reasoning_content 字段。这样可以让模型在多轮交互中保持推理过程的上下文,从而实现更连贯、更准确的工具调用。
curl --location --request POST 'https://api.mimo-v2.com/v1/chat/completions' \
--header "api-key: $MIMO_API_KEY" \
--header "Content-Type: application/json" \
--data-raw '{
"messages": [
{
"role": "assistant",
"content": "Hello! I am MiMo.",
"reasoning_content": "Okay, the user just asked me to introduce myself. That is a pretty straightforward request, but I should think about why they are asking this."
},
{
"role": "user",
"content": "What is the weather like in Beijing?"
}
],
"model": "mimo-v2-pro",
"max_completion_tokens": 1024,
"temperature": 1.0,
"stream": false,
"tools": [
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "The city and state, e.g. San Francisco, CA"},
"unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
},
"required": ["location"]
}
}
}
],
"tool_choice": "auto"
}'查看用量
您可以在 API 密钥控制台 中查看 API 使用情况,包括请求次数和 Token 消耗。控制台提供按模型和时间段的详细用量明细,帮助您有效追踪和管理使用情况。
MiMo API 文件