Anthropic SDK system prompts go in the top-level param
Migrating from OpenAI ChatCompletion API to Anthropic Messages API when existing code builds a messages array containing {role: 'system', content: ...}.
OpenAI accepts {role: 'system'} as the first messages item. Anthropic does not — system must be a top-level field: client.messages.create(system='...', messages=[...]). Passing {role: 'system'} inside messages returns a 400 whose error message says 'invalid role' without naming system specifically, which is confusing when you're carrying over OpenAI code verbatim. Separately: Anthropic's messages array must strictly alternate user/assistant — consecutive same-role messages error out.
For any OpenAI→Anthropic migration, first pass: pull every {role:'system'} into the top-level system param, then verify the remaining array strictly alternates user/assistant.