The API will accept a prompt that leaves no room for the answer
Anthropic's context-window docs have a short section on overflow that is worth reading twice. If the input alone is bigger than the model's window, the request fails with a 400 invalid_request_error,