Five required and one structural decision
Every Messages API request carries five fields the API actually needs and one structural decision you make on top. Required: model, max_tokens, and messages. Optional but constantly used: system and temperature. The structural decision: do you want a single response (non-streaming) or a stream of events.
Why max_tokens is yours, not the model's
Unlike some APIs, Anthropic requires you to declare an output budget per call. This is a billing safeguard and a latency knob. Set it generously enough that legitimate completions are not truncated, but tight enough that a runaway model cannot cost you more than you budgeted. The output token budget is a real billing line, not a recommendation.
Messages, not chat
The messages array is a list of {role, content} objects with role in ['user', 'assistant']. There is no system role inside the array — the system prompt is its own top-level field. Roles must alternate (no two user messages back-to-back); if you need to inject extra context, put it inside the user turn or in the system prompt.