DMXAPI: Unsupported value: 'reasoning_effort' does not support 'none' with this ...

2026年09月29日 22:11 21.68 秒 success

错误信息

DMXAPI: Unsupported value: 'reasoning_effort' does not support 'none' with this model. Supported values are: 'low', 'medium', 'high', and 'xhigh'. (request id: 20260929221139162702508C8IaVFrT)

AI 解决方案

原文:Unsupported value: 'reasoning_effort' does not support 'none' with this model. Supported values are: 'low', 'medium', 'high', and 'xhigh'.
译文:不支持的值:当前模型不支持将'reasoning_effort'设置为'none',支持的值为'low'、'medium'、'high'和'xhigh'。

🎯 原因分析


在调用DMXAPI的模型时,参数 reasoning_effort 被错误地设置为 'none',而当前使用的模型不支持该取值,仅支持指定的四个枚举值。

💡 解决方案


将 reasoning_effort 参数的值修改为模型支持的 'low'、'medium'、'high' 或 'xhigh' 之一即可:

# 修复后的代码
# 修改前
# response = client.chat.completions.create(
#     model="your_model_name",
#     messages=[{"role": "user", "content": "Hello"}],
#     reasoning_effort='none'  # ❌ 不支持的值
# )

# 修改后,根据你的需求选择合适的推理强度
response = client.chat.completions.create(
    model="your_model_name",
    messages=[{"role": "user", "content": "Hello"}],
    reasoning_effort='medium'  # ✅ 使用支持的值,如'low'/'medium'/'high'/'xhigh'
)

🛡️ 预防措施


  • 参数校验:调用API前,先查阅官方文档确认参数支持的取值范围,避免使用非法枚举值。

  • 自动化检查:可使用静态类型检查工具(如 mypy、pylint)或自定义参数校验逻辑,在请求发送前拦截无效参数。