Token 估算
curl --request POST \
--url https://api.minimax.cn/v1/responses/input_tokens \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--data '
{
"model": "MiniMax-M3.1-Flash",
"input": "请帮我写一封邮件,邀请团队成员参加下周三下午 3 点的项目复盘会议,说明会议议程,并提醒大家提前准备各自负责模块的进展总结和遇到的问题。"
}
'import requests
url = "https://api.minimax.cn/v1/responses/input_tokens"
payload = {
"model": "MiniMax-M3.1-Flash",
"input": "请帮我写一封邮件,邀请团队成员参加下周三下午 3 点的项目复盘会议,说明会议议程,并提醒大家提前准备各自负责模块的进展总结和遇到的问题。"
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: 'Bearer <token>'},
body: JSON.stringify({
model: 'MiniMax-M3.1-Flash',
input: '请帮我写一封邮件,邀请团队成员参加下周三下午 3 点的项目复盘会议,说明会议议程,并提醒大家提前准备各自负责模块的进展总结和遇到的问题。'
})
};
fetch('https://api.minimax.cn/v1/responses/input_tokens', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.minimax.cn/v1/responses/input_tokens",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'MiniMax-M3.1-Flash',
'input' => '请帮我写一封邮件,邀请团队成员参加下周三下午 3 点的项目复盘会议,说明会议议程,并提醒大家提前准备各自负责模块的进展总结和遇到的问题。'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.minimax.cn/v1/responses/input_tokens"
payload := strings.NewReader("{\n \"model\": \"MiniMax-M3.1-Flash\",\n \"input\": \"请帮我写一封邮件,邀请团队成员参加下周三下午 3 点的项目复盘会议,说明会议议程,并提醒大家提前准备各自负责模块的进展总结和遇到的问题。\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.minimax.cn/v1/responses/input_tokens")
.header("Content-Type", "<content-type>")
.header("Authorization", "Bearer <token>")
.body("{\n \"model\": \"MiniMax-M3.1-Flash\",\n \"input\": \"请帮我写一封邮件,邀请团队成员参加下周三下午 3 点的项目复盘会议,说明会议议程,并提醒大家提前准备各自负责模块的进展总结和遇到的问题。\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.minimax.cn/v1/responses/input_tokens")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = 'Bearer <token>'
request.body = "{\n \"model\": \"MiniMax-M3.1-Flash\",\n \"input\": \"请帮我写一封邮件,邀请团队成员参加下周三下午 3 点的项目复盘会议,说明会议议程,并提醒大家提前准备各自负责模块的进展总结和遇到的问题。\"\n}"
response = http.request(request)
puts response.read_body{
"object": "response.input_tokens",
"input_tokens": 235
}OpenAI Responses API
Token 估算
估算请求的输入 token 数,不真正调用模型生成。常用于在调用主接口前评估请求成本与是否触发上下文长度上限。
POST
/
v1
/
responses
/
input_tokens
Token 估算
curl --request POST \
--url https://api.minimax.cn/v1/responses/input_tokens \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--data '
{
"model": "MiniMax-M3.1-Flash",
"input": "请帮我写一封邮件,邀请团队成员参加下周三下午 3 点的项目复盘会议,说明会议议程,并提醒大家提前准备各自负责模块的进展总结和遇到的问题。"
}
'import requests
url = "https://api.minimax.cn/v1/responses/input_tokens"
payload = {
"model": "MiniMax-M3.1-Flash",
"input": "请帮我写一封邮件,邀请团队成员参加下周三下午 3 点的项目复盘会议,说明会议议程,并提醒大家提前准备各自负责模块的进展总结和遇到的问题。"
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: 'Bearer <token>'},
body: JSON.stringify({
model: 'MiniMax-M3.1-Flash',
input: '请帮我写一封邮件,邀请团队成员参加下周三下午 3 点的项目复盘会议,说明会议议程,并提醒大家提前准备各自负责模块的进展总结和遇到的问题。'
})
};
fetch('https://api.minimax.cn/v1/responses/input_tokens', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.minimax.cn/v1/responses/input_tokens",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'MiniMax-M3.1-Flash',
'input' => '请帮我写一封邮件,邀请团队成员参加下周三下午 3 点的项目复盘会议,说明会议议程,并提醒大家提前准备各自负责模块的进展总结和遇到的问题。'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.minimax.cn/v1/responses/input_tokens"
payload := strings.NewReader("{\n \"model\": \"MiniMax-M3.1-Flash\",\n \"input\": \"请帮我写一封邮件,邀请团队成员参加下周三下午 3 点的项目复盘会议,说明会议议程,并提醒大家提前准备各自负责模块的进展总结和遇到的问题。\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.minimax.cn/v1/responses/input_tokens")
.header("Content-Type", "<content-type>")
.header("Authorization", "Bearer <token>")
.body("{\n \"model\": \"MiniMax-M3.1-Flash\",\n \"input\": \"请帮我写一封邮件,邀请团队成员参加下周三下午 3 点的项目复盘会议,说明会议议程,并提醒大家提前准备各自负责模块的进展总结和遇到的问题。\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.minimax.cn/v1/responses/input_tokens")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = 'Bearer <token>'
request.body = "{\n \"model\": \"MiniMax-M3.1-Flash\",\n \"input\": \"请帮我写一封邮件,邀请团队成员参加下周三下午 3 点的项目复盘会议,说明会议议程,并提醒大家提前准备各自负责模块的进展总结和遇到的问题。\"\n}"
response = http.request(request)
puts response.read_body{
"object": "response.input_tokens",
"input_tokens": 235
}授权
请求头
请求体的媒介类型,请设置为 application/json,确保请求数据的格式为 JSON
可用选项:
application/json 请求体
application/json
调用的模型名称,如 MiniMax-M3.1-Flash
示例:
"MiniMax-M3.1-Flash"
对话内容,支持简单文本或完整对话历史数组
系统指令
工具列表
Show child attributes
Show child attributes
工具选择策略:auto 表示由模型自动判断是否调用工具
可用选项:
auto 输出格式控制
Show child attributes
Show child attributes
推理控制。默认值随模型不同,因此未在 schema 层声明统一默认值。
MiniMax-M3.1-Flash:推理始终开启,省略reasoning时也会推理。effort可取low、medium、high、xhigh或max,并且确实会调节推理深度;省略时默认使用max档位。传入effort: "none"会返回 HTTP 400。MiniMax-M3:默认关闭推理;将effort设为非none值可开启推理,但不会调节推理深度。
Show child attributes
Show child attributes
此页面对您有帮助吗?