跳轉到主要內容

Documentation Index

Fetch the complete documentation index at: https://docs.aihubmix.com/llms.txt

Use this file to discover all available pages before exploring further.

推理設定

您可以使用 reasoning 參數設定推理行為:
curl -X POST https://aihubmix.com/v1/responses \
  -H "Authorization: Bearer YOUR_AIHUBMIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5",
    "input": "Plan a week-long trip to the US for me.",
    "reasoning": {
      "effort": "high"
    },
    "max_output_tokens": 5000
  }'

推理強度

effort 參數控制模型投入推理的運算資源量,實質上決定了推理強度。
推理強度說明
minimal基本推理,使用最少運算
low輕量推理,適合簡單問題
medium平衡推理,適合中等複雜度的問題
high深度推理,適合複雜問題

在對話中使用推理

推理功能也可以在多輪對話中使用:
import requests

url = "https://aihubmix.com/v1/responses"

headers = {
    "Authorization": "Bearer YOUR_AIHUBMIX_API_KEY",
    "Content-Type": "application/json",
}

data = {
    "model": "kimi-k2.5",
    "input": [
        {
            "type": "message",
            "role": "user",
            "content": [
                {
                    "type": "input_text",
                    "text": "What is your favorite animal?",
                }
            ],
        },
        {
            "type": "message",
            "role": "assistant",
            "id": "msg_123",
            "status": "completed",
            "content": [
                {
                    "type": "output_text",
                    "text": "I don't have a favorite animal.",
                    "annotations": []
                }
            ],
        },
        {
            "type": "message",
            "role": "user",
            "content": [
                {
                    "type": "input_text",
                    "text": "Why is the sky blue?",
                }
            ],
        },
    ],
    "reasoning": {
        "effort": "high"
    },
    "max_output_tokens": 5000,
}

response = requests.post(url, headers=headers, json=data)

print(response.status_code)
print(response.json())

包含推理資訊的回應

啟用推理後,API 傳回的結果會包含推理資料:
{
  "id": "resp_051e00420efb9e150069aff6a18418819591abb7ce5f8487ed",
  "object": "response",
  "created_at": 1773139617,
  "status": "completed",
  "background": false,
  "completed_at": 1773139621,
  "content_filters": [
    {
      "blocked": false,
      "source_type": "completion",
      "content_filter_raw": [],
      "content_filter_results": {},
      "content_filter_offsets": {
        "start_offset": 0,
        "end_offset": 1147,
        "check_offset": 0
      }
    }
  ],
  "error": null,
  "frequency_penalty": 0.0,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": 5000,
  "max_tool_calls": null,
  "model": "gpt-54",
  "output": [
    {
      "id": "rs_051e00420efb9e150069aff6a32f948195996db3ff98314ef2",
      "type": "reasoning",
      "summary": []
    },
    {
      "id": "msg_051e00420efb9e150069aff6a33d808195825716a666d8ba8b",
      "type": "message",
      "status": "completed",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "annotations": [],
          "logprobs": [],
          "text": "The sky looks blue because of how sunlight interacts with Earth’s atmosphere.\n\n1. **Sunlight isn’t just “white”**\nSunlight is made of many colors (red, orange, yellow, green, blue, violet), each with different wavelengths.\n\n2. **Air scatters short wavelengths more**\nAs sunlight passes through the atmosphere, it hits gas molecules and tiny particles.\n- Shorter wavelengths (blue, violet) are scattered in all directions much more than longer wavelengths (red, orange).\n- This effect is called **Rayleigh scattering**.\n\n3. **We see more blue than violet**\n- Our eyes are more sensitive to blue than to violet.\n- Some violet light is also absorbed higher in the atmosphere.\nSo the scattered light we perceive is mostly blue.\n\n4. **Why sunsets are red/orange**\nAt sunrise and sunset, sunlight passes through much more atmosphere.\n- Most of the blue light gets scattered out of the direct path.\n- The remaining light reaching your eyes from the Sun is richer in reds and oranges."
        }
      ]
    }
  ],
  "parallel_tool_calls": true,
  "presence_penalty": 0.0,
  "previous_response_id": null,
  "prompt_cache_key": null,
  "prompt_cache_retention": null,
  "reasoning": {
    "effort": "high",
    "summary": null
  },
  "safety_identifier": null,
  "service_tier": "default",
  "store": true,
  "temperature": 1.0,
  "text": {
    "format": {
      "type": "text"
    },
    "verbosity": "medium"
  },
  "tool_choice": "auto",
  "tools": [],
  "top_logprobs": 0,
  "top_p": 1.0,
  "truncation": "disabled",
  "usage": {
    "input_tokens": 35,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 267,
    "output_tokens_details": {
      "reasoning_tokens": 29
    },
    "total_tokens": 302
  },
  "user": null,
  "metadata": {}
}

使用建議

  1. 選擇合適的推理強度:複雜問題使用 high,簡單任務使用 low
  2. 考量 token 使用量:推理會增加 token 消耗。
  3. 善用串流輸出:對於較長的推理鏈,串流可以提升使用者體驗。
  4. 提供上下文:給模型足夠的上下文以實現有效推理。

最後更新:2026-06-01