": { "message": "Provider API error: Function tools with reasoning_effort are no...

2026年09月17日 22:24 13.67 秒 success

错误信息

{ "error": { "message": "Provider API error: Function tools with reasoning_effort are not supported for gpt-5.6-luna in /v1/chat/completions. To use function tools, use /v1/responses or set reasoning_effort to 'none'. (request id: 202609171422241372014568268d9d6bWPuswPK)", "type": "invalid_request_error", "param": "reasoning_effort", "code": null } }

AI 解决方案

🌐 错误翻译


原文:Provider API error: Function tools with reasoning_effort are not supported for gpt-5.6-luna in /v1/chat/completions. To use function tools, use /v1/responses or set reasoning_effort to 'none'.
译文:服务商API错误:在 /v1/chat/completions 接口中,gpt-5.6-luna 不支持同时使用函数工具和 reasoning_effort 参数。若要使用函数工具,请改用 /v1/responses 接口,或将 reasoning_effort 设置为 'none'。

🎯 原因分析


请求中同时使用了函数工具(Function Tools)和推理强度参数(reasoning_effort),但当前模型 gpt-5.6-luna 在 /v1/chat/completions 接口下不支持该组合。该参数与函数工具产生了参数冲突。

💡 解决方案


方案一:移除 reasoning_effort 参数(推荐)

# 修复后的代码 - 移除 reasoning_effort 或设为 'none'
response = client.chat.completions.create(
    model="gpt-5.6-luna",
    messages=[{"role": "user", "content": "查询天气"}],
    tools=weather_tool,  # 保留函数工具
    # 删除或修改以下行:
    # reasoning_effort="medium"  # ❌ 改为删除或设为 'none'
    reasoning_effort="none"  # ✅ 修正方案
)

方案二:改用 /v1/responses 接口

# 修复后的代码 - 改用 responses 接口
response = client.responses.create(
    model="gpt-5.6-luna",
    input=[{"role": "user", "content": "查询天气"}],
    tools=weather_tool,
    reasoning={"effort": "medium"}  # responses 接口使用不同字段名
)

🛡️ 预防措施


  • 查阅模型限制文档:使用特定模型前,务必查阅对应的 API 文档,明确参数兼容性矩阵,避免组合冲突参数

  • 参数验证前置:在客户端封装层增加参数校验,当检测到不兼容参数组合时提前报错,避免无效请求消耗配额