{"args":{"description":"[models] Error: API request failed with status code 400:...

2026年01月23日 09:36 状态: processing

🚨 错误信息

这是啥问题吗Run failed: req_id: 50c877f19c PluginInvokeError: {"args":{"description":"[models] Error: API request failed with status code 400: {\"error\":{\"message\":\"Unrecognized request argument supplied: chat_template_kwargs (tid: 2026012301293168017848783908907)\",\"type\":\"invalid_request_error\",\"param\":\"\",\"code\":null}}"},"error_type":"InvokeError","message":"[models] Error: API request failed with status code 400: {\"error\":{\"message\":\"Unrecognized request argument supplied: chat_template_kwargs (tid: 2026012301293168017848783908907)\",\"type\":\"invalid_request_error\",\"param\":\"\",\"code\":null}}"}

🤖 AI解决方案

错误翻译


plaintext
原文:Unrecognized request argument supplied: chat_template_kwargs
译文:提供了未识别的请求参数:chat_template_kwargs

原因分析


这个400错误表明你的代码向某个API(很可能是OpenAI或类似的大模型API)发送了一个请求,但请求参数中包含了API不支持的chat_template_kwargs参数。这通常发生在:
  • 使用了某个第三方库或框架的特定参数,但目标API不兼容该参数

  • 代码更新后使用了新版本的参数名,但API服务尚未更新

  • 参数名拼写错误或使用了错误的参数名
  • 解决方案


    你需要检查调用API的代码,并移除或修改chat_template_kwargs参数。

    如果使用OpenAI API(常见情况):

    python

    ❌ 错误示例(包含chat_template_kwargs)


    response = client.chat.completions.create(
    model="gpt-3.5-turbo",
    messages=[{"role": "user", "content": "Hello"}],
    chat_template_kwargs={"some_key": "some_value"} # ← 移除这一行
    )

    ✅ 正确示例


    response = client.chat.completions.create(
    model="gpt-3.5-turbo",
    messages=[{"role": "user", "content": "Hello"}]
    # 移除了chat_template_kwargs参数
    )

    如果你确实需要模板参数,请检查:

  • API文档确认正确的参数名

  • 可能需要使用response_format或其他标准参数
  • ️ 预防措施


  • API版本检查:确保你使用的库版本与API服务版本兼容,查看官方文档的参数列表

  • 参数验证:在开发环境中使用API沙箱或测试端点验证参数,避免生产环境直接调用

  • 查阅文档:访问对应API的官方文档,查看支持的参数列表和最新更新