You can only set only one of thinking budget and thinking level. (request id: 20...

2026年03月25日 17:02 状态: processing

🚨 错误信息

You can only set only one of thinking budget and thinking level. (request id: 20260325165444615851968f2BEx4Uk)

🤖 AI解决方案

报错分析报告

1.错误翻译



原文:You can only set only one of thinking budget and thinking level.
译文:你只能设置thinking budget和thinking level中的一个(不能同时设置两者)。

2.原因分析


  • 根本原因:同时配置了互斥参数thinking budgetthinking level,违反API单参数设置规则。

  • 发生位置:API请求参数构造阶段,系统检测到两者共存后触发限制。
  • 3.解决方案


    python

    修复后的代码示例(二选一保留参数)


    from openai import OpenAI

    client = OpenAI()

    response = client.chat.completions.create(
    model="your-model-name",
    messages=[{"role": "user", "content": "需要分析的问题"}],
    thinking_budget=2000 # 仅保留此参数(或替换为thinking_level="medium")
    )

    4. 预防措施


  • ✅ 查阅API文档明确互斥参数列表,避免同时传递冲突配置;

  • ✅ 用参数校验库(如Pydantic的mutually_exclusive装饰器)预拦截非法组合。
  • ---
    :修复核心是删除其中一个参数,确保仅传thinking budgetthinking level之一。