reasoning_content to maintain optimal performance. If this field is missing on the TokenHub side, no error will be reported, but model performance may be affected. For details, see Returning reasoning_content in Multi-Turn Tool Calling in this document.Model ID | Type | Thinking Capability | Context Window | Max Input | Max Output |
mimo-v2.6-pro | General-purpose multimodal model (text input, image input, video input / text output) | Supported (enabled by default and can be disabled) | 1M | 1M | 128K |
mimo-v2.6-flash | General-purpose multimodal model (text input, image input, video input / text output) | Supported (enabled by default and can be disabled) | 1M | 1M | 128K |
mimo-v2.5-pro | General-purpose conversational model (text input / text output) | Supported (enabled by default and can be disabled) | 1M | 1M | 128K |
https://tokenhub-intl.tencentcloudmaas.com/v1https://tokenhub.tencentcloudmaas.com/v1Protocol | Path | Applicable SDK | Authentication Header |
OpenAI Chat Completions | /v1/chat/completions | OpenAI SDK and compatible clients | Authorization: Bearer YOUR_API_KEY |
OpenAI Responses | /v1/responses | OpenAI SDK (Responses API) | Authorization: Bearer YOUR_API_KEY |
Anthropic Messages | /v1/messages | Anthropic SDK and compatible clients | x-api-key: YOUR_API_KEY |
YOUR_API_KEY with the API Key you created.curl https://tokenhub-intl.tencentcloudmaas.com/v1/chat/completions \\-H "Content-Type: application/json" \\-H "Authorization: Bearer YOUR_API_KEY" \\-d '{"model": "mimo-v2.5-pro","messages": [{"role": "user", "content": "Hello, please introduce yourself."}],"max_tokens": 2048}'
# pip install openaifrom openai import OpenAIclient = OpenAI(api_key="YOUR_API_KEY",base_url="https://tokenhub-intl.tencentcloudmaas.com/v1",)response = client.chat.completions.create(model="mimo-v2.5-pro",messages=[{"role": "user", "content": "Hello, please introduce yourself."}],max_tokens=2048,)print(response.choices[0].message.content)
// npm install openaiimport OpenAI from "openai";const client = new OpenAI({apiKey: "YOUR_API_KEY",baseURL: "https://tokenhub-intl.tencentcloudmaas.com/v1",});const response = await client.chat.completions.create({model: "mimo-v2.5-pro",messages: [{ role: "user", content: "Hello, please introduce yourself." }],max_tokens: 2048,});console.log(response.choices[0].message.content);
// To use OkHttp, add the dependency: implementation("com.squareup.okhttp3:okhttp:4.12.0")import okhttp3.*;import org.json.*;OkHttpClient httpClient = new OkHttpClient();JSONObject body = new JSONObject();body.put("model", "mimo-v2.5-pro");body.put("max_tokens", 2048);JSONArray messages = new JSONArray();messages.put(new JSONObject().put("role", "user").put("content", "Hello, please introduce yourself."));body.put("messages", messages);Request request = new Request.Builder().url("https://tokenhub-intl.tencentcloudmaas.com/v1/chat/completions").addHeader("Authorization", "Bearer YOUR_API_KEY").addHeader("Content-Type", "application/json").post(RequestBody.create(body.toString(), MediaType.get("application/json"))).build();try (Response response = httpClient.newCall(request).execute()) {JSONObject result = new JSONObject(response.body().string());System.out.println(result.getJSONArray("choices").getJSONObject(0).getJSONObject("message").getString("content"));}
package mainimport ("bytes""encoding/json""fmt""io""net/http")func main() {body := map[string]interface{}{"model": "mimo-v2.5-pro","messages": []map[string]string{{"role": "user", "content": "Hello, please introduce yourself."},},"max_tokens": 2048,}data, _ := json.Marshal(body)req, _ := http.NewRequest("POST","https://tokenhub-intl.tencentcloudmaas.com/v1/chat/completions",bytes.NewBuffer(data))req.Header.Set("Authorization", "Bearer YOUR_API_KEY")req.Header.Set("Content-Type", "application/json")resp, _ := http.DefaultClient.Do(req)defer resp.Body.Close()respBody, _ := io.ReadAll(resp.Body)var result map[string]interface{}json.Unmarshal(respBody, &result)choices := result["choices"].([]interface{})msg := choices[0].(map[string]interface{})["message"].(map[string]interface{})fmt.Println(msg["content"])}
curl https://tokenhub-intl.tencentcloudmaas.com/v1/chat/completions \\-H "Content-Type: application/json" \\-H "Authorization: Bearer YOUR_API_KEY" \\-d '{"model": "mimo-v2.5-pro","messages": [{"role": "user", "content": "Introduce large language models."}],"max_tokens": 2048}'
from openai import OpenAIclient = OpenAI(api_key="YOUR_API_KEY",base_url="https://tokenhub-intl.tencentcloudmaas.com/v1",)response = client.chat.completions.create(model="mimo-v2.5-pro",messages=[{"role": "user", "content": "Introduce large language models."}],max_tokens=2048,)print(response.choices[0].message.content)
import OpenAI from "openai";const client = new OpenAI({apiKey: "YOUR_API_KEY",baseURL: "https://tokenhub-intl.tencentcloudmaas.com/v1",});const response = await client.chat.completions.create({model: "mimo-v2.5-pro",messages: [{ role: "user", content: "Introduce large language models." }],max_tokens: 2048,});console.log(response.choices[0].message.content);
import okhttp3.*;import org.json.*;OkHttpClient httpClient = new OkHttpClient();JSONObject body = new JSONObject();body.put("model", "mimo-v2.5-pro");body.put("max_tokens", 2048);body.put("messages", new JSONArray().put(new JSONObject().put("role", "user").put("content", "Introduce large language models.")));Request request = new Request.Builder().url("https://tokenhub-intl.tencentcloudmaas.com/v1/chat/completions").addHeader("Authorization", "Bearer YOUR_API_KEY").addHeader("Content-Type", "application/json").post(RequestBody.create(body.toString(), MediaType.get("application/json"))).build();try (Response response = httpClient.newCall(request).execute()) {JSONObject result = new JSONObject(response.body().string());System.out.println(result.getJSONArray("choices").getJSONObject(0).getJSONObject("message").getString("content"));}
body := map[string]interface{}{"model": "mimo-v2.5-pro","messages": []map[string]string{{"role": "user", "content": "Introduce large language models."},},"max_tokens": 2048,}// ... The rest of the request code is the same as the quick start example.
stream to true to enable SSE streaming output. Deep thinking is enabled by default for MiMo-V2.5-Pro, which results in relatively long response times. It is recommended to enable streaming output for long text or complex reasoning scenarios to avoid request timeouts.curl https://tokenhub-intl.tencentcloudmaas.com/v1/chat/completions \\-H "Content-Type: application/json" \\-H "Authorization: Bearer YOUR_API_KEY" \\-d '{"model": "mimo-v2.5-pro","messages": [{"role": "user", "content": "Write a short poem about spring."}],"max_tokens": 2048,"stream": true}'
from openai import OpenAIclient = OpenAI(api_key="YOUR_API_KEY",base_url="https://tokenhub-intl.tencentcloudmaas.com/v1",)stream = client.chat.completions.create(model="mimo-v2.5-pro",messages=[{"role": "user", "content": "Write a short poem about spring."}],max_tokens=2048,stream=True,)for chunk in stream:if chunk.choices and chunk.choices[0].delta.content:print(chunk.choices[0].delta.content, end="", flush=True)
import OpenAI from "openai";const client = new OpenAI({apiKey: "YOUR_API_KEY",baseURL: "https://tokenhub-intl.tencentcloudmaas.com/v1",});const stream = await client.chat.completions.create({model: "mimo-v2.5-pro",messages: [{ role: "user", content: "Write a short poem about spring." }],max_tokens: 2048,stream: true,});for await (const chunk of stream) {const content = chunk.choices[0]?.delta?.content;if (content) process.stdout.write(content);}
import okhttp3.*;import okhttp3.sse.*;import org.json.*;OkHttpClient httpClient = new OkHttpClient();JSONObject body = new JSONObject();body.put("model", "mimo-v2.5-pro");body.put("max_tokens", 2048);body.put("stream", true);body.put("messages", new JSONArray().put(new JSONObject().put("role", "user").put("content", "Write a short poem about spring.")));Request request = new Request.Builder().url("https://tokenhub-intl.tencentcloudmaas.com/v1/chat/completions").addHeader("Authorization", "Bearer YOUR_API_KEY").addHeader("Content-Type", "application/json").post(RequestBody.create(body.toString(), MediaType.get("application/json"))).build();EventSources.createFactory(httpClient).newEventSource(request, new EventSourceListener() {@Overridepublic void onEvent(EventSource source, String id, String type, String data) {if ("[DONE]".equals(data)) return;try {JSONObject json = new JSONObject(data);JSONObject delta = json.getJSONArray("choices").getJSONObject(0).getJSONObject("delta");String content = delta.optString("content", "");if (!content.isEmpty()) System.out.print(content);} catch (JSONException ignored) {}}});
import ("bufio""bytes""encoding/json""fmt""net/http""strings")body := map[string]interface{}{"model": "mimo-v2.5-pro","messages": []map[string]string{{"role": "user", "content": "Write a short poem about spring."}},"max_tokens": 2048,"stream": true,}data, _ := json.Marshal(body)req, _ := http.NewRequest("POST","https://tokenhub-intl.tencentcloudmaas.com/v1/chat/completions",bytes.NewBuffer(data))req.Header.Set("Authorization", "Bearer YOUR_API_KEY")req.Header.Set("Content-Type", "application/json")resp, _ := http.DefaultClient.Do(req)defer resp.Body.Close()scanner := bufio.NewScanner(resp.Body)for scanner.Scan() {line := scanner.Text()if !strings.HasPrefix(line, "data: ") || line == "data: [DONE]" {continue}var chunk map[string]interface{}json.Unmarshal([]byte(strings.TrimPrefix(line, "data: ")), &chunk)choices := chunk["choices"].([]interface{})delta := choices[0].(map[string]interface{})["delta"].(map[string]interface{})if content, ok := delta["content"].(string); ok {fmt.Print(content)}}
system role message.system message (optionally along with identity and role descriptions), which can improve the accuracy of answers to time-related questions. A general template is as follows (replace {date} and {week} with the actual date and day of the week):You are a helpful AI assistant. Today's date: {date} {week}.curl https://tokenhub-intl.tencentcloudmaas.com/v1/chat/completions \\-H "Content-Type: application/json" \\-H "Authorization: Bearer YOUR_API_KEY" \\-d '{"model": "mimo-v2.5-pro","messages": [{"role": "system", "content": "You are a professional Python coding assistant. Answer only Python-related questions concisely and clearly."},{"role": "user", "content": "How do I read a CSV file?"}],"max_tokens": 2048}'
from openai import OpenAIclient = OpenAI(api_key="YOUR_API_KEY",base_url="https://tokenhub-intl.tencentcloudmaas.com/v1",)response = client.chat.completions.create(model="mimo-v2.5-pro",messages=[{"role": "system","content": "You are a professional Python coding assistant. Answer only Python-related questions concisely and clearly.",},{"role": "user", "content": "How do I read a CSV file?"},],max_tokens=2048,)print(response.choices[0].message.content)
import OpenAI from "openai";const client = new OpenAI({apiKey: "YOUR_API_KEY",baseURL: "https://tokenhub-intl.tencentcloudmaas.com/v1",});const response = await client.chat.completions.create({model: "mimo-v2.5-pro",messages: [{role: "system",content: "You are a professional Python coding assistant. Answer only Python-related questions concisely and clearly.",},{ role: "user", content: "How do I read a CSV file?" },],max_tokens: 2048,});console.log(response.choices[0].message.content);
JSONObject body = new JSONObject();body.put("model", "mimo-v2.5-pro");body.put("max_tokens", 2048);body.put("messages", new JSONArray().put(new JSONObject().put("role", "system").put("content", "You are a professional Python coding assistant. Answer only Python-related questions concisely and clearly.")).put(new JSONObject().put("role", "user").put("content", "How do I read a CSV file?")));// ... The request code is the same as above.
body := map[string]interface{}{"model": "mimo-v2.5-pro","messages": []map[string]string{{"role": "system", "content": "You are a professional Python coding assistant. Answer only Python-related questions concisely and clearly."},{"role": "user", "content": "How do I read a CSV file?"},},"max_tokens": 2048,}// ... The request code is the same as the quick start.
messages array to enable multi-turn conversations with context memory.content without writing back reasoning_content, which effectively reduces token consumption. Once a tool call appears in the historical messages, it is recommended to fully pass back reasoning_content to maintain optimal results. For details, see Multi-turn Tool Call: Passing Back reasoning_content in this document.curl https://tokenhub-intl.tencentcloudmaas.com/v1/chat/completions \\-H "Content-Type: application/json" \\-H "Authorization: Bearer YOUR_API_KEY" \\-d '{"model": "mimo-v2.5-pro","messages": [{"role": "user", "content": "My name is Xiao Ming, and I like playing basketball."},{"role": "assistant", "content": "Hello, Xiao Ming! Playing basketball is a great sport."},{"role": "user", "content": "Do you still remember my name and hobbies?"}],"max_tokens": 2048}'
from openai import OpenAIclient = OpenAI(api_key="YOUR_API_KEY",base_url="https://tokenhub-intl.tencentcloudmaas.com/v1",)# Maintaining Conversation Historyconversation = [{"role": "system", "content": "You are a friendly AI assistant."},]def chat(user_input):conversation.append({"role": "user", "content": user_input})response = client.chat.completions.create(model="mimo-v2.5-pro",messages=conversation,max_tokens=2048,)reply = response.choices[0].message.content# In pure conversation scenarios, write back only content, not reasoning_content.conversation.append({"role": "assistant", "content": reply})return replyprint(chat("My name is Xiao Ming, and I like playing basketball."))print(chat("Do you still remember my name and hobbies?"))
import OpenAI from "openai";const client = new OpenAI({apiKey: "YOUR_API_KEY",baseURL: "https://tokenhub-intl.tencentcloudmaas.com/v1",});const conversation = [{ role: "system", content: "You are a friendly AI assistant." },];async function chat(userInput) {conversation.push({ role: "user", content: userInput });const response = await client.chat.completions.create({model: "mimo-v2.5-pro",messages: conversation,max_tokens: 2048,});const reply = response.choices[0].message.content;conversation.push({ role: "assistant", content: reply });return reply;}console.log(await chat("My name is Xiao Ming, and I like playing basketball."));console.log(await chat("Do you still remember my name and hobbies?"));
JSONArray messages = new JSONArray();messages.put(new JSONObject().put("role", "system").put("content", "You are a friendly AI assistant."));messages.put(new JSONObject().put("role", "user").put("content", "My name is Xiao Ming, and I like playing basketball."));messages.put(new JSONObject().put("role", "assistant").put("content", "Hello, Xiao Ming! Playing basketball is a great sport."));messages.put(new JSONObject().put("role", "user").put("content", "Do you still remember my name and hobbies?"));JSONObject body = new JSONObject();body.put("model", "mimo-v2.5-pro");body.put("messages", messages);body.put("max_tokens", 2048);// ... The request code is the same as above.
body := map[string]interface{}{"model": "mimo-v2.5-pro","messages": []map[string]string{{"role": "system", "content": "You are a friendly AI assistant."},{"role": "user", "content": "My name is Xiao Ming, and I like playing basketball."},{"role": "assistant", "content": "Hello, Xiao Ming! Playing basketball is a great sport."},{"role": "user", "content": "Do you still remember my name and hobbies?"},},"max_tokens": 2048,}// ... The request code is the same as the quick start.
tool_calls (including the function name and parameters).role: tool message.tool_choice supports only auto. If any other value is passed in, this field is removed, and the model behavior is equivalent to auto.tools.function.name) can only consist of a-z, A-Z, 0-9, underscores (_), and hyphens (-), with a maximum length of 64.reasoning_content along with tool_calls. In subsequent turns, it is recommended to return the full content to maintain optimal performance. Missing content does not cause an error, but it may affect model performance.# Round 1: Send the question + tool definitioncurl https://tokenhub-intl.tencentcloudmaas.com/v1/chat/completions \\-H "Content-Type: application/json" \\-H "Authorization: Bearer YOUR_API_KEY" \\-d '{"model": "mimo-v2.5-pro","messages": [{"role": "user", "content": "What is the weather like in Beijing today?"}],"tools": [{"type": "function","function": {"name": "get_weather","description": "Obtain weather information for a specified city","parameters": {"type": "object","properties": {"city": {"type": "string", "description": "City name, such as Beijing"}},"required": ["city"]}}}],"tool_choice": "auto"}'# Round 2: Pass the tool execution result back (replace tool_call_id and reasoning_content with the actual values returned in Round 1)curl https://tokenhub-intl.tencentcloudmaas.com/v1/chat/completions \\-H "Content-Type: application/json" \\-H "Authorization: Bearer YOUR_API_KEY" \\-d '{"model": "mimo-v2.5-pro","messages": [{"role": "user", "content": "What is the weather like in Beijing today?"},{"role": "assistant", "content": "", "reasoning_content": "The user asks about the weather in Beijing, so the get_weather tool needs to be called to obtain real-time data.", "tool_calls": [{"id": "call_xxx", "type": "function", "function": {"name": "get_weather", "arguments": "{\\"city\\": \\"Beijing\\"}"}}]},{"role": "tool", "tool_call_id": "call_xxx", "content": "Sunny, temperature 28°C, humidity 50%"}],"tools": [{"type": "function", "function": {"name": "get_weather", "description": "Obtain weather information for a specified city", "parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}}}]}'
from openai import OpenAIclient = OpenAI(api_key="YOUR_API_KEY",base_url="https://tokenhub-intl.tencentcloudmaas.com/v1",)# Define toolstools = [{"type": "function","function": {"name": "get_weather","description": "Obtain weather information for a specified city","parameters": {"type": "object","properties": {"city": {"type": "string", "description": "City name, such as Beijing"}},"required": ["city"],},},}]# Round 1: Send the questionmessages = [{"role": "user", "content": "What is the weather like in Beijing today?"}]response = client.chat.completions.create(model="mimo-v2.5-pro",messages=messages,tools=tools,max_tokens=2048,)assistant_message = response.choices[0].message# The model initiates a tool callif response.choices[0].finish_reason == "tool_calls":tool_call = assistant_message.tool_calls[0]print(f"Model called tool: {tool_call.function.name}, parameters: {tool_call.function.arguments}")# Execute the tool (simulated return here)tool_result = "Sunny, temperature 28°C, humidity 50%"# Round 2: Pass back the complete assistant message (including reasoning_content) and the tool resultmessages.append(assistant_message)messages.append({"role": "tool","tool_call_id": tool_call.id,"content": tool_result,})final_response = client.chat.completions.create(model="mimo-v2.5-pro",messages=messages,tools=tools,max_tokens=2048,)print(final_response.choices[0].message.content)
import OpenAI from "openai";const client = new OpenAI({apiKey: "YOUR_API_KEY",baseURL: "https://tokenhub-intl.tencentcloudmaas.com/v1",});const tools = [{type: "function",function: {name: "get_weather",description: "Obtain weather information for a specified city",parameters: {type: "object",properties: {city: { type: "string", description: "City name, such as Beijing" },},required: ["city"],},},},];// Round 1const messages = [{ role: "user", content: "What is the weather like in Beijing today?" }];const response1 = await client.chat.completions.create({model: "mimo-v2.5-pro",messages,tools,max_tokens: 2048,});const assistantMsg = response1.choices[0].message;if (response1.choices[0].finish_reason === "tool_calls") {const toolCall = assistantMsg.tool_calls[0];console.log(`Tool call: ${toolCall.function.name}, parameters: ${toolCall.function.arguments}`);const toolResult = "Sunny, temperature 28°C, humidity 50%";// Pass back assistantMsg as is (including reasoning_content). Do not manually trim fields.messages.push(assistantMsg);messages.push({ role: "tool", tool_call_id: toolCall.id, content: toolResult });const response2 = await client.chat.completions.create({model: "mimo-v2.5-pro",messages,tools,max_tokens: 2048,});console.log(response2.choices[0].message.content);}
JSONObject toolFunc = new JSONObject().put("name", "get_weather").put("description", "Obtain weather information for a specified city").put("parameters", new JSONObject().put("type", "object").put("properties", new JSONObject().put("city", new JSONObject().put("type", "string").put("description", "City name"))).put("required", new JSONArray().put("city")));JSONArray tools = new JSONArray().put(new JSONObject().put("type", "function").put("function", toolFunc));JSONObject body = new JSONObject();body.put("model", "mimo-v2.5-pro");body.put("messages", new JSONArray().put(new JSONObject().put("role", "user").put("content", "What is the weather like in Beijing today?")));body.put("tools", tools);// ... Send the request, parse tool_calls and reasoning_content, execute the tool, and construct the second-round request.
body := map[string]interface{}{"model": "mimo-v2.5-pro","messages": []map[string]string{{"role": "user", "content": "What is the weather like in Beijing today?"},},"tools": []map[string]interface{}{{"type": "function","function": map[string]interface{}{"name": "get_weather","description": "Obtain weather information for a specified city","parameters": map[string]interface{}{"type": "object","properties": map[string]interface{}{"city": map[string]string{"type": "string", "description": "City name"},},"required": []string{"city"},},},}},}// ... Send the request, parse tool_calls and reasoning_content, and construct the second-round request.
reasoning_content field and is not mixed with content.Field | Type | Default Value | Value Range | Description |
thinking.type | string | "enabled" | "enabled" / "disabled" | enabled: Enable deep thinking, and the response returns reasoning_content; disabled: Disable thinking and answer directly, with faster response and lower cost. |
thinking is not a standard OpenAI parameter. When the OpenAI Python SDK is used, it must be passed through extra_body. For the Node.js SDK, it can be passed as a top-level parameter.temperature and top_p cannot be customized. Even if they are passed in, the recommended default values 1.0 and 0.95 are forcibly used.max_tokens limits the total length of the thinking content and the final answer. When the thinking process is long, the available space for the final answer is compressed. It is recommended to set a sufficiently large value (≥ 2048 recommended) to avoid answer truncation.# Disable thinking: Answer directly, suitable for low-latency scenarios such as simple Q&A and format conversion.curl https://tokenhub-intl.tencentcloudmaas.com/v1/chat/completions \\-H "Content-Type: application/json" \\-H "Authorization: Bearer YOUR_API_KEY" \\-d '{"model": "mimo-v2.5-pro","messages": [{"role": "user", "content": "Explain what machine learning is in one sentence."}],"max_tokens": 1024,"thinking": {"type": "disabled"}}'
from openai import OpenAIclient = OpenAI(api_key="YOUR_API_KEY",base_url="https://tokenhub-intl.tencentcloudmaas.com/v1",)# Enable thinking (default behavior, explicitly declared here)response = client.chat.completions.create(model="mimo-v2.5-pro",messages=[{"role": "user", "content": "Solve the equation x^2 - 5x + 6 = 0"}],max_tokens=4096,extra_body={"thinking": {"type": "enabled"}},)msg = response.choices[0].message# Obtain the reasoning process (a field exclusive to thinking mode)reasoning = getattr(msg, "reasoning_content", None)if reasoning:print("=== Reasoning Process ===")print(reasoning)print("=== Final Answer ===")print(msg.content)# Disable thinkingfast_response = client.chat.completions.create(model="mimo-v2.5-pro",messages=[{"role": "user", "content": "Explain what machine learning is in one sentence"}],max_tokens=1024,extra_body={"thinking": {"type": "disabled"}},)print(fast_response.choices[0].message.content)
import OpenAI from "openai";const client = new OpenAI({apiKey: "YOUR_API_KEY",baseURL: "https://tokenhub-intl.tencentcloudmaas.com/v1",});const response = await client.chat.completions.create({model: "mimo-v2.5-pro",messages: [{ role: "user", content: "Solve the equation x^2 - 5x + 6 = 0" }],max_tokens: 4096,// @ts-ignore - thinking is an extended fieldthinking: { type: "enabled" },});const msg = response.choices[0].message;const reasoning = (msg as any).reasoning_content;if (reasoning) {console.log("=== Reasoning Process ===");console.log(reasoning);}console.log("=== Final Answer ===");console.log(msg.content);
JSONObject body = new JSONObject();body.put("model", "mimo-v2.5-pro");body.put("max_tokens", 4096);body.put("thinking", new JSONObject().put("type", "enabled"));body.put("messages", new JSONArray().put(new JSONObject().put("role", "user").put("content", "Solve the equation x^2 - 5x + 6 = 0")));// ... Send the requesttry (Response response = httpClient.newCall(request).execute()) {JSONObject result = new JSONObject(response.body().string());JSONObject message = result.getJSONArray("choices").getJSONObject(0).getJSONObject("message");String reasoning = message.optString("reasoning_content", "");String content = message.getString("content");System.out.println("Reasoning Process: " + reasoning);System.out.println("Final Answer: " + content);}
body := map[string]interface{}{"model": "mimo-v2.5-pro","max_tokens": 4096,"thinking": map[string]string{"type": "enabled"},"messages": []map[string]string{{"role": "user", "content": "Solve the equation x^2 - 5x + 6 = 0"},},}// ... Send the request and parse the reasoning_content and content fields from the response.
reasoning_content field. Accessing it directly as a property will cause an error, so you must read it using a safe value retrieval method:getattr(msg, "reasoning_content", None)(msg as any).reasoning_contentreasoning_content, and the final answer is returned in content. Tokens consumed by thinking are included in the total usage.completion_tokens. Currently, usage.completion_tokens_details.reasoning_tokens is always 0, so thinking token usage cannot be separately itemized:{"id": "2b92b0964c9b4335bffad7c2f75cfe9e","choices": [{"index": 0,"message": {"role": "assistant","reasoning_content": "This is a quadratic equation. First, try factoring: (x-2)(x-3) = 0, so x = 2 or x = 3.","content": "The solutions to the equation x² - 5x + 6 = 0 are: **x = 2** or **x = 3**","tool_calls": null},"finish_reason": "stop"}],"model": "mimo-v2.5-pro","object": "chat.completion","usage": {"prompt_tokens": 25,"completion_tokens": 120,"total_tokens": 145,"completion_tokens_details": {"reasoning_tokens": 0},"prompt_tokens_details": {"cached_tokens": 0}}}
reasoning_content is not returned.reasoning_content and content are both returned as incremental deltas, and delta.reasoning_content always appears before delta.content. They must be handled separately:from openai import OpenAIclient = OpenAI(api_key="YOUR_API_KEY",base_url="https://tokenhub-intl.tencentcloudmaas.com/v1",)stream = client.chat.completions.create(model="mimo-v2.5-pro",messages=[{"role": "user", "content": "Analyze the advantages and challenges of quantum computing"}],max_tokens=4096,stream=True,extra_body={"thinking": {"type": "enabled"}},)print("=== Reasoning Process (Real-Time) ===")answer_started = Falsefor chunk in stream:if not chunk.choices:continuedelta = chunk.choices[0].deltareasoning_delta = getattr(delta, "reasoning_content", None)if reasoning_delta:print(reasoning_delta, end="", flush=True)if delta.content:if not answer_started:print("\\n\\n=== Final Answer (Real-Time) ===")answer_started = Trueprint(delta.content, end="", flush=True)
import OpenAI from "openai";const client = new OpenAI({apiKey: "YOUR_API_KEY",baseURL: "https://tokenhub-intl.tencentcloudmaas.com/v1",});const stream = await client.chat.completions.create({model: "mimo-v2.5-pro",messages: [{ role: "user", content: "Analyze the advantages and challenges of quantum computing" }],max_tokens: 4096,stream: true,// @ts-ignorethinking: { type: "enabled" },});let answerStarted = false;process.stdout.write("=== Reasoning Process (Real-Time) ===\\n");for await (const chunk of stream) {const delta = chunk.choices[0]?.delta;if (!delta) continue;const reasoning = (delta as any).reasoning_content;if (reasoning) process.stdout.write(reasoning);if (delta.content) {if (!answerStarted) {process.stdout.write("\\n\\n=== Final Answer (Real-Time) ===\\n");answerStarted = true;}process.stdout.write(delta.content);}}
reasoning_content field in assistant messages that contain tool_calls in each subsequent request to maintain optimal model performance. In practice, omitting this field on the TokenHub side does not cause API errors, but Xiaomi officially recommends returning it to avoid incomplete context caused by missing historical reasoning content.reasoning_content is missing, the model context will be incomplete. Even if no error is reported directly, issues such as degraded instruction-following capability and increased hallucinations may occur. When the OpenAI SDK is used, it is recommended to append the assistant message object returned in the response directly to messages as is, without manually rebuilding or trimming fields.assistant message carries content, reasoning_content, and tool_calls simultaneously):{"model": "mimo-v2.5-pro","messages": [{"role": "user", "content": "What's the weather like in Beijing today?"},{"role": "assistant","content": "","reasoning_content": "The user asks about the weather in Beijing, so the get_weather tool needs to be called to obtain real-time data.","tool_calls": [{"id": "call_xxx","type": "function","function": {"name": "get_weather", "arguments": "{\\"city\\": \\"Beijing\\"}"}}]},{"role": "tool", "tool_call_id": "call_xxx", "content": "Sunny, temperature 28°C, humidity 50%"},{"role": "user", "content": "What about tomorrow?"}]}
reasoning_content pass-back logic, so no additional handling is required. If you develop your own Agent application, make sure to handle it according to the format described above.response_format to json_object ensures that the model outputs a valid JSON string, making it suitable for scenarios that require structured data, such as data extraction, form filling, and classification labeling.system or user message to return only JSON and fully define the fields, hierarchy, and data types. Otherwise, the output may not meet expectations.response_format supports only {"type": "json_object"} and does not support json_schema. If strict schema validation is required, it is recommended to perform secondary validation on the business side using libraries such as jsonschema and design a retry fallback.max_tokens to a reasonable value. If the value is too small, the JSON output may be truncated and cannot be parsed.curl https://tokenhub-intl.tencentcloudmaas.com/v1/chat/completions \\-H "Content-Type: application/json" \\-H "Authorization: Bearer YOUR_API_KEY" \\-d '{"model": "mimo-v2.5-pro","messages": [{"role": "system", "content": "Return only JSON without any explanation, comments, or Markdown code blocks. Format: {\\"cities\\": [{\\"name\\": string, \\"province\\": string, \\"population\\": number}]}"},{"role": "user", "content": "Return information about three Chinese cities."}],"max_tokens": 2048,"response_format": {"type": "json_object"}}'
import jsonfrom openai import OpenAIclient = OpenAI(api_key="YOUR_API_KEY",base_url="https://tokenhub-intl.tencentcloudmaas.com/v1",)response = client.chat.completions.create(model="mimo-v2.5-pro",messages=[{"role": "system","content": ("Return only JSON without any explanation, comments, or Markdown code blocks.\\n"'Format: {"cities": [{"name": string, "province": string, "population": number}]}\\n'"Fill unknown fields with null."),},{"role": "user", "content": "Return information about three Chinese cities."},],max_tokens=2048,response_format={"type": "json_object"},)try:result = json.loads(response.choices[0].message.content)print(json.dumps(result, ensure_ascii=False, indent=2))except json.JSONDecodeError as e:print(f"JSON parsing failed: {e}")print(f"Original content: {response.choices[0].message.content}")
import OpenAI from "openai";const client = new OpenAI({apiKey: "YOUR_API_KEY",baseURL: "https://tokenhub-intl.tencentcloudmaas.com/v1",});const response = await client.chat.completions.create({model: "mimo-v2.5-pro",messages: [{role: "system",content:'Return only JSON without any explanation, comments, or Markdown code blocks. Format: {"cities": [{"name": string, "province": string, "population": number}]}',},{ role: "user", content: "Return information about three Chinese cities." },],max_tokens: 2048,response_format: { type: "json_object" },});const result = JSON.parse(response.choices[0].message.content);console.log(JSON.stringify(result, null, 2));
JSONObject body = new JSONObject();body.put("model", "mimo-v2.5-pro");body.put("max_tokens", 2048);body.put("response_format", new JSONObject().put("type", "json_object"));body.put("messages", new JSONArray().put(new JSONObject().put("role", "system").put("content", "Return only JSON without any explanation.")).put(new JSONObject().put("role", "user").put("content", "Return information about three Chinese cities.")));// ... Send the request and parse the returned JSON string.
body := map[string]interface{}{"model": "mimo-v2.5-pro","max_tokens": 2048,"response_format": map[string]string{"type": "json_object"},"messages": []map[string]string{{"role": "system", "content": "Return only JSON without any explanation."},{"role": "user", "content": "Return information about three Chinese cities."},},}// ... Send the request
/v1/messages, and the authentication request header is x-api-key (not Authorization: Bearer).max_tokens is a required parameter.content array, the text block comes first and the thinking block comes last, which is the opposite of the Claude convention. When reading reasoning content, filter by the type field instead of relying on index positions.curl https://tokenhub-intl.tencentcloudmaas.com/v1/messages \\-H "Content-Type: application/json" \\-H "x-api-key: YOUR_API_KEY" \\-H "anthropic-version: 2023-06-01" \\-d '{"model": "mimo-v2.5-pro","max_tokens": 2048,"system": "You are a professional technical assistant. Answer concisely and accurately.","messages": [{"role": "user", "content": "Introduce the advantages of the MoE architecture."}]}'
# pip install anthropicfrom anthropic import Anthropicclient = Anthropic(api_key="YOUR_API_KEY",base_url="https://tokenhub-intl.tencentcloudmaas.com",)message = client.messages.create(model="mimo-v2.5-pro",max_tokens=2048,system="You are a professional technical assistant. Answer concisely and accurately.",messages=[{"role": "user", "content": "Introduce the advantages of the MoE architecture."}],)print(message.content[0].text)
// npm install @anthropic-ai/sdkimport Anthropic from "@anthropic-ai/sdk";const client = new Anthropic({apiKey: "YOUR_API_KEY",baseURL: "https://tokenhub-intl.tencentcloudmaas.com",});const message = await client.messages.create({model: "mimo-v2.5-pro",max_tokens: 2048,system: "You are a professional technical assistant. Answer concisely and accurately.",messages: [{ role: "user", content: "Introduce the advantages of the MoE architecture." }],});console.log(message.content[0].text);
import okhttp3.*;import org.json.*;OkHttpClient httpClient = new OkHttpClient();JSONObject body = new JSONObject();body.put("model", "mimo-v2.5-pro");body.put("max_tokens", 2048);body.put("system", "You are a professional technical assistant. Answer concisely and accurately.");body.put("messages", new JSONArray().put(new JSONObject().put("role", "user").put("content", "Introduce the advantages of the MoE architecture.")));Request request = new Request.Builder().url("https://tokenhub-intl.tencentcloudmaas.com/v1/messages").addHeader("x-api-key", "YOUR_API_KEY").addHeader("anthropic-version", "2023-06-01").addHeader("Content-Type", "application/json").post(RequestBody.create(body.toString(), MediaType.get("application/json"))).build();try (Response response = httpClient.newCall(request).execute()) {JSONObject result = new JSONObject(response.body().string());System.out.println(result.getJSONArray("content").getJSONObject(0).getString("text"));}
body := map[string]interface{}{"model": "mimo-v2.5-pro","max_tokens": 2048,"system": "You are a professional technical assistant. Answer concisely and accurately.","messages": []map[string]string{{"role": "user", "content": "Introduce the advantages of the MoE architecture."},},}data, _ := json.Marshal(body)req, _ := http.NewRequest("POST","https://tokenhub-intl.tencentcloudmaas.com/v1/messages",bytes.NewBuffer(data))req.Header.Set("x-api-key", "YOUR_API_KEY")req.Header.Set("anthropic-version", "2023-06-01")req.Header.Set("Content-Type", "application/json")// ... Send the request and read the reply from content[0].text.
/v1/responses, and the authentication method is the same as that for Chat Completions.input to pass conversation content and max_output_tokens to control output length, corresponding to messages and max_tokens in Chat Completions. For complete field descriptions and compatibility scope, see OpenAI Response Protocol Field Descriptions and Responses API Compatibility Mode Descriptions.curl https://tokenhub-intl.tencentcloudmaas.com/v1/responses \\-H "Content-Type: application/json" \\-H "Authorization: Bearer YOUR_API_KEY" \\-d '{"model": "mimo-v2.5-pro","input": "Introduce the advantages of the MoE architecture.","max_output_tokens": 2048}'
from openai import OpenAIclient = OpenAI(api_key="YOUR_API_KEY",base_url="https://tokenhub-intl.tencentcloudmaas.com/v1",)response = client.responses.create(model="mimo-v2.5-pro",input="Introduce the advantages of the MoE architecture.",max_output_tokens=2048,)print(response.output_text)
import OpenAI from "openai";const client = new OpenAI({apiKey: "YOUR_API_KEY",baseURL: "https://tokenhub-intl.tencentcloudmaas.com/v1",});const response = await client.responses.create({model: "mimo-v2.5-pro",input: "Introduce the advantages of the MoE architecture.",max_output_tokens: 2048,});console.log(response.output_text);
JSONObject body = new JSONObject();body.put("model", "mimo-v2.5-pro");body.put("input", "Introduce the advantages of the MoE architecture.");body.put("max_output_tokens", 2048);Request request = new Request.Builder().url("https://tokenhub-intl.tencentcloudmaas.com/v1/responses").addHeader("Authorization", "Bearer YOUR_API_KEY").addHeader("Content-Type", "application/json").post(RequestBody.create(body.toString(), MediaType.get("application/json"))).build();// ... Send the request and read the text content from the output array.
body := map[string]interface{}{"model": "mimo-v2.5-pro","input": "Introduce the advantages of the MoE architecture.","max_output_tokens": 2048,}data, _ := json.Marshal(body)req, _ := http.NewRequest("POST","https://tokenhub-intl.tencentcloudmaas.com/v1/responses",bytes.NewBuffer(data))req.Header.Set("Authorization", "Bearer YOUR_API_KEY")req.Header.Set("Content-Type", "application/json")// ... Send the request and read the text content from the output array.
Writing back | MiMo Series Models | OpenAI / Claude / GLM, etc |
Thinking Capability Switch | Controlled by thinking.type (enabled/disabled), enabled by default. | Typically controlled by switching the model or using a separate reasoning parameter. |
Reasoning Process Field | Returned in a separate reasoning_content field, not embedded in content | Most models do not expose the reasoning process. |
Accessing Reasoning Fields via OpenAI SDK | Must use getattr / as any | - |
Sampling Parameters in Thinking Mode | temperature and top_p cannot be customized and are forced to 1.0 / 0.95. | Typically can be freely configured. |
temperature Range | 0-1.5, default 1.0 | Typically 0-2 |
top_p Range | 0.01-1.0, default 0.95 | Typically 0-1 |
Writeback for Multi-turn Tool Calls | When tool calls are involved, it is recommended to write back reasoning_content (no error is reported if it is missing). | Typically only content need to be written back. |
tool_choice | Only auto is supported. | Typically supports none/required/specified functions. |
Structured Output | Only json_object is supported. | Most support json_schema |
Context Window | 1M tokens | Typically 128K tokens |
Maximum Output | 128K tokens | Typically 16K tokens |
Multimodal Input | Not supported. Text input only. | Some models support images/videos. |
Parameter / Practice | Recommendation | Description |
max_tokens | 2048-4096 for general tasks; 8192 or higher recommended for complex reasoning. | Thinking content and the final answer share the token quota. A value that is too small will cause the answer to be truncated. |
thinking.type | Keep enabled for complex reasoning, code generation, and Agent tasks; switch to disabled for simple Q&A and format conversion. | Disabling thinking can significantly reduce latency and cost. |
stream | Enable streaming when thinking is enabled. | Thinking takes a long time. Streaming can avoid timeouts and present the reasoning process in real time. |
temperature | Adjust as needed when thinking is disabled (1.2-1.5 for creative writing, 0.2-0.5 for code generation); no configuration is required when thinking is enabled. | Value range: 0-1.5. In thinking mode, it is forced to 1.0. |
top_p | Use either this parameter or temperature. Adjusting both at the same time is not recommended. | Value range: 0.01-1.0, default 0.95. |
System Prompt | Declare the model identity and current date. | Improve accuracy for time-related questions. For the template, refer to "General Invocation Examples > System Prompt" in this document. |
Multi-turn conversation | For pure conversations, write back only content; for tool calls, it is recommended to write back reasoning_content in full. | The former saves tokens, while the latter is the official best practice (no error is reported if it is missing). |
Accessing Reasoning Fields via SDK | In Python, use getattr(msg, "reasoning_content", None); in Node.js, use (msg as any).reasoning_content | This field is not defined in the OpenAI SDK type definitions. |
Context Caching | No configuration is required, and it takes effect automatically. | Implicit caching is automatically enabled. For cache hits, see usage.prompt_tokens_details.cached_tokens. |
Limit | Description |
Sampling Parameters in Thinking Mode | When thinking is enabled, customizing temperature and top_p is not supported. If these parameters are passed in, the actual effective values are 1.0 and 0.95. |
Multi-turn Tool Calls | When thinking is enabled and tool calls exist in the history, it is recommended to fully return reasoning_content; missing it does not cause an error, but may affect instruction following and output quality. |
tool_choice | Only auto is supported. If other values are passed in, this field is ignored. |
Tool Function Name | Only a-z, A-Z, 0-9, underscores, and hyphens are allowed, with a length of 1 to 64 characters. |
Structured Output | response_format supports only json_object and does not support json_schema. |
Timeout Risk | When thinking is enabled, the response time is longer. It is recommended to use it with stream=true to avoid timeouts. |
finish_reason | In addition to stop/length/tool_calls/content_filter, the model returns repetition_truncation when repetition is detected. |
Protocol Differences | The Anthropic Messages protocol uses x-api-key for authentication and requires max_tokens; the Responses protocol uses input and max_output_tokens, with field naming different from Chat Completions. |
フィードバック