System message must be at the beginning.: Claude Code
Quick fix
Change Claude Code's "model" from "opus" to "haiku" or another model family to avoid an OpenAI-compatible API 400 response.
Symptom
Section titled “Symptom”API Error: 400 System message must be at the beginning.When cc-switch proxies an OpenAI-compatible chat API, requests from Claude Code using the "opus" model family retain a system message that is not first. The backend requires role: system to be the first item in the messages array, so it rejects the request with 400.
In this issue, the "haiku" model family uses a different message-building path, where the system message happens to be first, so the session works normally. The issue suggests cc-switch should normalize system-message order when converting Anthropic requests to OpenAI Chat Completions, but the issue remains open.
In Claude Code's cc-switch configuration, change "model" from "opus" to "haiku", or use another model family.
Restart the Claude Code session and confirm that this 400 error no longer appears.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 1 real issues
(No FAQ yet)
Related problems
Section titled “Related problems”This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.