Clatter LabsHelp Center

What does 400 invalid_request mean on the Model API?

TroubleshootingUpdated

The request body isn't valid for POST /v1/chat/completions. Check the required fields and the field types.

Code: invalid_request · HTTP status: 400

The body is missing something required or a field has the wrong shape. Fix the request; sending it again unchanged gives the same error.

Common causes#

  • model or messages is missing
  • messages isn't an array of objects with a role and content
  • a tool message has no tool_call_id
  • a number is out of range, such as temperature above 2 or top_p of 0
  • more than 4 stop sequences

How to fix it#

  1. Read error.message and error.param: they name the field that failed.
  2. Compare your body with the Create a chat completion reference.
  3. Send a minimal body (model plus one user message). If that works, add your other fields back one at a time.

Should my code retry?#

Don't retry automatically: a 400 is a problem in the request, not on our side.

The error body uses the OpenAI shape, so OpenAI SDKs raise it as an exception you can catch:

{"error": {"message": "...", "type": "...", "code": "invalid_request", "param": null}}

Every response also carries an X-Request-Id. Keep it in your logs; it's the quickest way for support to find a request.

See the full list in the Model API reference.

Still need help?#

We usually reply within the first hour, and always within 24 hours. A full support team is with you.

Related articles

Still need help?

Tried the steps above and still stuck? Email us. We usually reply within the first hour, and always within 24 hours. A full support team is with you.

Infrastructure questions, or permanent deletion of your data
infrastructure@clatterlabs.xyz
For deleting your whole account or the data of one service.