Token 估算
curl --request POST \
--url https://api.minimaxi.com/v1/responses/input_tokens \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--data '
{
"model": "MiniMax-M3",
"input": [
{
"type": "message",
"role": "user",
"content": "请帮我用 Python 实现一个支持泛型的快速排序算法,要求:1) 原地排序节省内存;2) 处理重复元素时使用三路划分;3) 小数组切换到插入排序优化;4) 提供完整的单元测试。最后还请解释一下三路划分相比经典 Lomuto 划分在重复键场景下的优势。"
}
],
"tools": [
{
"type": "function",
"name": "search_docs",
"description": "搜索 Python 标准库或第三方库的官方文档",
"parameters": {
"type": "object",
"properties": {
"library": {
"type": "string",
"description": "库名称,如 `typing`、`itertools`"
},
"query": {
"type": "string",
"description": "搜索关键词"
}
},
"required": [
"library",
"query"
]
}
},
{
"type": "function",
"name": "run_python",
"description": "在沙箱中执行 Python 代码,返回标准输出和错误信息",
"parameters": {
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "要执行的 Python 代码"
},
"timeout_seconds": {
"type": "integer",
"description": "执行超时时间(秒)",
"default": 10
}
},
"required": [
"code"
]
}
}
]
}
'{
"object": "response.input_tokens",
"input_tokens": 588
}Responses
Token 估算
估算请求的输入 token 数,不真正调用模型生成。常用于在调用主接口前评估请求成本与是否触发上下文长度上限。
POST
/
v1
/
responses
/
input_tokens
Token 估算
curl --request POST \
--url https://api.minimaxi.com/v1/responses/input_tokens \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--data '
{
"model": "MiniMax-M3",
"input": [
{
"type": "message",
"role": "user",
"content": "请帮我用 Python 实现一个支持泛型的快速排序算法,要求:1) 原地排序节省内存;2) 处理重复元素时使用三路划分;3) 小数组切换到插入排序优化;4) 提供完整的单元测试。最后还请解释一下三路划分相比经典 Lomuto 划分在重复键场景下的优势。"
}
],
"tools": [
{
"type": "function",
"name": "search_docs",
"description": "搜索 Python 标准库或第三方库的官方文档",
"parameters": {
"type": "object",
"properties": {
"library": {
"type": "string",
"description": "库名称,如 `typing`、`itertools`"
},
"query": {
"type": "string",
"description": "搜索关键词"
}
},
"required": [
"library",
"query"
]
}
},
{
"type": "function",
"name": "run_python",
"description": "在沙箱中执行 Python 代码,返回标准输出和错误信息",
"parameters": {
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "要执行的 Python 代码"
},
"timeout_seconds": {
"type": "integer",
"description": "执行超时时间(秒)",
"default": 10
}
},
"required": [
"code"
]
}
}
]
}
'{
"object": "response.input_tokens",
"input_tokens": 588
}Documentation Index
Fetch the complete documentation index at: https://platform.minimaxi.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
授权
请求头
请求体的媒介类型,请设置为 application/json,确保请求数据的格式为 JSON
可用选项:
application/json 请求体
application/json
调用的模型名称,如 MiniMax-M3
示例:
"MiniMax-M3"
对话内容,支持简单文本或完整对话历史数组
系统指令
工具列表
Show child attributes
Show child attributes
工具选择策略:none 表示不调用任何工具;auto 表示由模型自动判断是否调用工具
可用选项:
none, auto 输出格式控制
Show child attributes
Show child attributes
思考强度控制。不传则采用 adaptive 模式(由模型自动判断)
Show child attributes
Show child attributes
此页面对您有帮助吗?
⌘I