[适配请求] 建议 API 兼容 OpenAI 新规范中的 developer 角色 (It is recommended that the API be compatible with the developer role in the new OpenAI specification

#19
by xusu616 - opened

目前在使用 Android Studio (版本 panda1 patch) (算近的稳定版本,新版太多bug了) 时 接了 DeepSeek API 时,请求会直接报错返回 400

Please try again later.
Error: com.openai.errors.BadRequestException: 400: Failed to deserialize the JSON body into the target type: messages[0].role: unknown variant developer, expected one of system, user, assistant, tool, latest_reminder at line 1 column 2047

OpenAI 最近更新了 API 规范,引入了 developer 角色来取代原本的 system 角色(用于设置模型行为指令)。目前很多基于 Jetpack Compose 开发的最新工具链已经默认发送 role: "developer" 格式的 JSON 请求包

请求:

DeepSeek API 后端目前似乎只接受 system, user, assistant 这三个变体。建议后端进行兼容性适配:

自动映射:在收到 role: "developer" 时,后端自动将其识别并处理为 system 角色。

xusu616 changed discussion title from 建议 API 兼容 OpenAI 新规范中的 developer 角色 (It is recommended that the API be compatible with the developer role in the new OpenAI specification to [适配请求] 建议 API 兼容 OpenAI 新规范中的 developer 角色 (It is recommended that the API be compatible with the developer role in the new OpenAI specification

Sign up or log in to comment