Skip to content

OpenAI-compatible providers: system prompt sent as 'developer' role causes deterministic 400 [1214] Incorrect role information (e.g. glm-5.3-flash via Console Go) #30

Description

@Tioit-Wang

摘要 / Summary

当使用 OpenAI 兼容提供商、且其上游网关不接受 developer 消息角色时,AI 的每一轮都会失败,报错如下:

400: {"message":"Error from provider (Console Go): Upstream request failed: [1214] Incorrect role information","type":"server_error","param":"","code":null}

本报告环境:提供商 aimom(base URL https://platform.aimom.net/v1,openai_compatible / chat_completions),模型 GLM-5.3-Flashglm-5.3-flash)。失败是确定性 100%,而同一提供商上的 deepseek-v4-flash 每次都成功。


根因(已通过直连 API 复现)/ Root cause (reproduced with direct API calls)

PI-Desktop 向该提供商发送请求时,把系统提示/指令放在 developer 角色里。而服务于 glm-5.3-flash 的上游路由(“Console Go”)不接受 developer 角色,返回 [1214] Incorrect role information。同一网关下不同模型表现不同,所以只有部分模型失败:

请求(直连 https://platform.aimom.net/v1/chat/completions) 结果
glm-5.3-flash + role: system HTTP 200 正常
glm-5.3-flash + role: developer(单独/首位/混排) HTTP 400 —— 与上述报错完全一致 [1214] Incorrect role information
glm-5.3-flash + 20 种参数变体(thinking / reasoning_effort / tools / stream_options / temperature / max_completion_tokens / tool_choice / n / penalties / user 等) 全部 HTTP 200(参数不是触发原因)
glm-5.3-flash + 其它消息结构变体(空 content 的 assistant、无 tool_calls 的 tool、system 不在首位、图片 content 等) 全部 HTTP 200,或报其它错误([1210])——从不是 1214
deepseek-v4-flash + role: developer HTTP 200(接受)
deepseek-v4-pro + role: developer HTTP 400 unknown variant 'developer'(同样拒绝,但文案不同)

应用侧证据(同一时间段,确定性):

  • glm-5.3-flash:每次尝试都报 1214(agent turn failedPROVIDER_ERRORretriable: falsephase: streamproviderStatus: 400streamMs: 1)。
  • deepseek-v4-flash:同一窗口内每次成功(providerStatus: 200)。
  • GET /v1/models 只返回极简元数据(id/object/created/owned_by/supported_endpoint_types)——没有任何字段声明支持 developer,因此该角色的选择来自客户端。

预期行为 / Expected behavior

  1. OpenAI 兼容适配器应把系统/指令消息用 role: "system" 发送(或按提供商/模型可配置,对严格的上游默认用 system);或
  2. 上游网关应在 GLM 路由上把 developer 映射为 system,或在 GLM chat 模板中接受 developer

复现步骤 / Repro (any project)

  1. 添加一个 OpenAI 兼容提供商,指向其上游拒绝 developer 的网关(如 https://platform.aimom.net/v1),模型 glm-5.3-flash
  2. 新建 Agent 会话(agent mode),发送任意消息。
  3. 该轮必然失败,报上面的 [1214] Incorrect role information 400;同一会话切到 deepseek-v4-flash 后立即成功。

建议修复 / Suggested fix

在 OpenAI 兼容 chat-completions 适配器中,对该提供商用 role: "system" 发送系统/开发者消息;或增加按提供商/模型的开关(如 supportsDeveloperRole: false / systemRole: "system")并应用到 glm-5.3-flash(以及任何上游不接受 developer 的模型,如 deepseek-v4-pro)。由于同一网关下有模型接受 developerdeepseek-v4-flash)有模型拒绝,按模型配置是最稳妥的方案。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions