", "data": { "message": "The `reasoning_content` in the thinking mode must be pa...

2026年04月24日 15:25 processing

错误信息

The `reasoning_content` in the thinking mode must be passed back to the API. (tid: 2026042406371259942704940918082) { "name": "APIError", "data": { "message": "The `reasoning_content` in the thinking mode must be passed back to the API. (tid: 2026042406371259942704940918082)", "statusCode": 400, "isRetryable": false, "responseHeaders": { "alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000", "content-length": "212", "content-type": "application/json; charset=utf-8", "date": "Fri, 24 Apr 2026 06:37:13 GMT", "via": "1.1 google", "x-aihubmix-request-id": "2026042406371259942704940918082" }, "responseBody": "{\"error\":{\"message\":\"The `reasoning_content` in the thinking mode must be passed back to the API. (tid: 2026042406371259942704940918082)\",\"type\":\"invalid_request_error\",\"param\":\"\",\"code\":\"invalid_request_error\"}}", "metadata": { "url": "https://aihubmix.com/v1/chat/completions" } } }

AI 解决方案

报错分析报告

1.错误翻译


原文:The `reasoning_content` in the thinking mode must be passed back to the API.
译文:思考模式中的`reasoning_content`必须回传给API。

2. 原因分析


  • 根本原因:调用AI Hub Mix聊天补全API时,处于思考模式但未将reasoning_content字段回传至服务端。

  • 发生位置:请求URL为https://aihubmix.com/v1/chat/completions的POST请求中,缺失必要参数reasoning_content(状态码400表示无效请求)。
  • 3.解决方案


    以Python requests库为例,修复时需将思考模式生成的reasoning_content加入请求体:
    import requests
    
    url = "https://aihubmix.com/v1/chat/completions"
    headers = {"Content-Type": "application/json"}
    payload = {
        "model": "your-model-name",
        "messages": [{"role": "user", "content": "你的问题"}],
        "thinking_mode": True,  # 启用思考模式
        "reasoning_content": "思考过程生成的推理内容"  # 关键:回传推理结果
    }
    
    response = requests.post(url, headers=headers, json=payload)
    print(response.json())
    

    4.️ 预防措施


  • 参数校验:调用API前对照文档确认必填字段(如思考模式下的reasoning_content),用工具(如Postman)预验证请求结构。

  • 日志追踪:记录API请求的完整 payload,便于快速定位缺失参数问题。
  • ---
    :修复核心是确保所有思考模式的输出都通过reasoning_content回传。