Skip to main content

Responses API 思考模式

思考模式允许模型展示其推理过程,帮助用户理解AI是如何得出答案的。gpt-5 模型支持原生的思考推理模式。
重要提示:根据内容安全管理政策,必须同时设置 "effort""summary": "detailed" 参数才能开启思考过程展示功能。

快速开始

只需要替换 <API-KEY> 为你的实际API密钥即可运行。
curl -X POST "https://model-api.skyengine.com.cn/v1/responses" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <API-KEY>" \
  -d '{
    "model": "gpt-5-2025-08-07",
    "input": "请解决这个数学问题:一个圆的面积是78.54平方厘米,求这个圆的周长。请详细说明解题思路。",
    "reasoning": {
      "effort": "medium",
      "summary": "detailed"
    }
  }'

gpt-5 模型的思考模式实现

gpt-5 模型内置推理能力,通过 reasoning 参数控制推理强度和思考过程展示:
{
  "model": "gpt-5-2025-08-07",
  "input": "your question here",
  "reasoning": {
    "effort": "medium",  // low, medium, high
    "summary": "detailed"  // 必需参数:开启思考过程展示
  }
}
响应会包含 reasoning 字段,展示模型的推理摘要。

响应结果示例

{
  "id": "resp_01be82131ec287250068fdf7cd8d6c81969af11dab7e4218fe",
  "object": "response",
  "created_at": 1761474509,
  "status": "completed",
  "model": "gpt-5-2025-08-07",
  "output": [
    {
      "id": "rs_01be82131ec287250068fdf7ce17a081968ba0933d6ff8baf0",
      "type": "reasoning",
      "summary": [
        {
          "type": "summary_text",
          "text": "**Calculating circle properties**\n\nI'm laying out the steps for calculating the radius and circumference of a circle with an area of 78.54 cm². I'll use the formula A = πr², which gives me the radius, r = sqrt(A/π). So, with A plugged in, I find r to be 5 cm. \n\nNext, I calculate the circumference as C = 2πr, getting about 31.416 cm. I'll also explore an alternative formula for circumference, but it involves a lot of detailed computation that I just need to clarify and keep organized."
        },
        {
          "type": "summary_text",
          "text": "**Reviewing calculations for circumference**\n\nI'm comparing earlier calculations where I found the product Aπ to be 246.3, but the correct value should be 246.741264. Then, using 2√(Aπ), I calculate 2 * 15.712, which gives me about 31.424. This is slightly different from the exact value of 31.416 using r = 5 cm and π = 3.1416. \n\nI realize that the discrepancies in rounding might affect the results, and I'm clarifying that while A = 78.54 is technically equal to 25 * 3.1416, the algebraic relations hold true if I use the same π value consistently."
        }
      ]
    },
    {
      "id": "msg_01be82131ec287250068fdf7e0476c8196b7f3201011b0453d",
      "type": "message",
      "status": "completed",
      "content": [
        {
          "type": "output_text",
          "text": "解题思路:\n- 用到两个公式:\n  1) 面积公式 A = πr²\n  2) 周长公式 C = 2πr\n- 由面积求半径:r = √(A/π)\n  代入 A = 78.54,取 π ≈ 3.1416,\n  r = √(78.54 / 3.1416) = √25 = 5(厘米)\n- 求周长:C = 2πr = 2 × 3.1416 × 5 = 31.416(厘米)\n\n结论:该圆的周长约为31.416厘米(可记为31.42厘米)。此外,可写成 C = 10π 厘米。"
        }
      ],
      "role": "assistant"
    }
  ],
  "reasoning": {
    "effort": "medium",
    "summary": "detailed"
  },
  "usage": {
    "input_tokens": 38,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 2348,
    "output_tokens_details": {
      "reasoning_tokens": 2176
    },
    "total_tokens": 2386
  }
}

参数说明

推理参数

  • reasoning.effort - 推理强度
    • "low" - 快速推理
    • "medium" - 平衡推理(推荐)
    • "high" - 深度推理
  • reasoning.summary - 思考过程展示控制(必需参数
    • "detailed" - 展示详细的思考过程和推理步骤
注意:根据内容安全管理政策,必须设置 "summary": "detailed" 才能开启思考模式功能。

通用参数

  • max_tokens - 最大生成token数(建议2000以上用于思考模式)
  • temperature - 控制输出的随机性

应用场景

  1. 数学问题解决 - 展示计算步骤和推理过程
  2. 逻辑推理 - 显示逻辑分析的每个环节
  3. 复杂决策 - 说明考虑的因素和权衡过程
  4. 代码调试 - 展示问题分析和解决思路
  5. 学术研究 - 提供详细的论证过程

注意事项

  1. 必需参数: 必须设置 "summary": "detailed" 参数才能开启思考模式
  2. Token消耗: 思考模式通常消耗更多token,包括推理token
  3. 响应时间: 启用思考可能增加响应时间
  4. 内容质量: 思考过程有助于提高回答质量和可信度
  5. 隐私考虑: 思考内容可能包含敏感的推理过程

最佳实践

  1. 问题类型: 复杂问题更适合使用思考模式
  2. 参数设置: 根据问题复杂度选择合适的reasoning.effort
  3. 必需配置: 始终包含 "summary": "detailed" 参数
  4. 结果解析: 合理处理思考内容和最终答案的分离
  5. Token管理: 考虑思考模式的额外token消耗