What does 400 invalid_request mean on the Model API?
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#
modelormessagesis missingmessagesisn't an array of objects with aroleandcontent- a
toolmessage has notool_call_id - a number is out of range, such as
temperatureabove 2 ortop_pof 0 - more than 4
stopsequences
How to fix it#
- Read
error.messageanderror.param: they name the field that failed. - Compare your body with the Create a chat completion reference.
- Send a minimal body (
modelplus oneusermessage). 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?#
- General support: support@clatterlabs.com or team@clatterlabs.xyz
- Infrastructure questions, or permanent deletion of your data (your whole account or one service): infrastructure@clatterlabs.xyz
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.