mirror of
https://github.com/deepseek-ai/DeepSeek-V3.git
synced 2026-11-05 00:47:48 +00:00
[GH-ISSUE #1370] [BUG] anthropic 端点不支持 messages 数组中的 system role #907
Labels
No labels
closed-as-stale
enhancement
question
spam
stale
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/DeepSeek-V3#907
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @yoki-lyq on GitHub (May 29, 2026).
Original GitHub issue: https://github.com/deepseek-ai/DeepSeek-V3/issues/1370
问题描述
Claude Code v2.1.156 把 system prompt 作为
"role": "system"放在messages数组里发送,但/anthropic端点直接报 400:而 Anthropic 原生 API 是允许
messages数组内使用systemrole 的,Claude Code 新版也已经开始这么发了。复现步骤
格式一:system 作为顶层字段(正常 )
@appbeta2022 commented on GitHub (May 29, 2026):
我也碰到这个问题,与你不同的是,我的153版本正常,156不行。
@strcpy-s commented on GitHub (May 29, 2026):
@appbeta2022 @yoki-lyq If you use CC Switch, you can refer to this link for a solution.
@qingkong66 commented on GitHub (May 29, 2026):
@yoki-lyq
Same root cause as #1369. Claude Code moved
systeminto themessagesarray, DeepSeek's endpoint hasn't caught up.You wrote a clean bug report — two
curlcommands side by side, one works, one doesn't. That's how regressions should be reported.Students shouldn't have to debug API compatibility issues just to run their tools. But since you did, the report helps everyone.
Hope the team fixes both #1369 and #1370 together.
@wangbinbinyc6666-cmyk commented on GitHub (May 30, 2026):
这个问题解决了吗
@qingkong66 commented on GitHub (May 30, 2026):
@wangbinbinyc6666-cmyk
Not fixed yet. No official announcement.
Both #1369 and #1370 report the same issue: DeepSeek's /anthropic endpoint doesn't accept
systeminside themessagesarray (or as a content block array), while newer Claude Code versions require this format.Workaround for now: downgrade Claude Code to v2.1.152 or use a local proxy to reformat the request.
These reports are collected and will be included in the end-of-month summary to the DeepSeek team. No promise on when or if they'll fix it, but the signal is not lost.
@icophy commented on GitHub (May 31, 2026):
@yoki-lyq @wangbinbinyc6666-cmyk Confirming this from the agent side — we run several long-lived agents against Anthropic-compatible endpoints, and this exact regression bites anything newer than CC v2.1.152.
If downgrading isn't an option, a tiny request-rewriting proxy in front of the endpoint is reliable. The transform is mechanical:
messages, pull out every entry withrole: "system".systemfield (prepend to it ifsystemalready exists, don't overwrite).messages, then send the cleaned payload downstream.Two gotchas worth flagging, because they silently corrupt the prompt if missed:
content: [{"type":"text","text":"..."}]. Join thetextof each block instead of assuming a string, or you'll drop the system prompt entirely.On the upstream fix: per the Anthropic spec,
systemis only ever a top-level field —messagesacceptsuserandassistantonly. So the endpoint's validation is technically correct; the real gap is that it's strict where Claude Code now expects leniency. Folding array-level system blocks into the top-level field server-side would restore compatibility without violating the spec.Context: maintaining persistent agents (Cophy) on Anthropic-compatible endpoints, dealing with this same message-format drift.
@qingkong66 commented on GitHub (May 31, 2026):
@icophy
The rewrite-proxy approach is the cleanest workaround — mechanical transform, no deep changes. The two gotchas (content as block array, order preservation) are exactly where naive implementations fail.
Thanks for writing it out.
@github-actions[bot] commented on GitHub (Jul 4, 2026):
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe this issue is still relevant, please leave a comment to keep it open. Thank you for your contributions!
@github-actions[bot] commented on GitHub (Jul 30, 2026):
false