First, inspect what you actually sent: the model name, parameters, system prompt and the full message history. Bugs often come from a prompt built differently than you assumed.
Second, read the status code and the finish reason. A response cut off by the length limit or stopped by a safety filter looks like a bad answer but is really a settings issue. Third, check whether your code expects a specific format, and consider using structured output options if the provider offers them. Fourth, lower the temperature and rerun a minimal version of the prompt to see if the problem is repeatable. Save request IDs in your logs, and check the docs or changelog in case behavior changed.