400 Function tools with reasoning_effort are not supported for gpt-5.6-sol in /v...

2026年09月17日 16:50 11.85 秒 success

错误信息

Prompt is too long · automatic compaction failed: API Error: 400 Function tools with reasoning_effort are not supported for gpt-5.6-sol in /v1/chat/completions. To use function tools, use /v1/responses or set reasoning_effort to 'none'. (request id: 20260917084945652595166c14228f5W2lvEm9S)

AI 解决方案

原文:Prompt is too long · automatic compaction failed: API Error: 400 Function tools with reasoning_effort are not supported for gpt-5.6-sol in /v1/chat/completions. To use function tools, use /v1/responses or set reasoning_effort to 'none'.
译文:提示词过长 · 自动压缩失败:API 错误:400 在 /v1/chat/completions 接口中,gpt-5.6-sol 不支持带有 reasoning_effort 的功能工具。若要使用功能工具,请改用 /v1/responses 接口,或将 reasoning_effort 设为 'none'。

🎯 原因分析


该错误表明请求同时使用了功能工具(Function Tools)和推理强度(reasoning_effort)参数,而 gpt-5.6-sol 模型在 /v1/chat/completions 接口下不支持这种组合。API 服务端严格校验了参数兼容性,同时提示当前上下文过长,自动压缩机制未能生效。

💡 解决方案


根据您的实际需求,二选一修复:

方案一:移除 reasoning_effort 参数(推荐在 /v1/chat/completions 中使用)

# 修复后的代码
response = client.chat.completions.create(
    model="gpt-5.6-sol",
    messages=messages,
    tools=[...],  # 保留功能工具
    # 移除或注释掉 reasoning_effort 相关参数
)

方案二:改用 /v1/responses 接口(支持全功能)

# 修复后的代码
response = client.responses.create(
    model="gpt-5.6-sol",
    messages=messages,
    tools=[...],
    reasoning={"effort": "medium"},  # 按规范设置推理强度
)

🛡️ 预防措施


  • 🔧 参数互查:调用 API 前,查阅对应模型的官方文档,确认功能工具与推理参数的兼容性列表,避免盲目混用。

  • 📝 上下文管控:针对 "Prompt is too long" 现象,建议对历史消息进行手动摘要或截断,避免依赖不稳定的自动压缩机制。