Why this happens
- Unsupported parameter for the model: Some parameters (such as
frequency_penalty,logprobs, orresponse_format) are not supported by all models. Passing an unsupported parameter can return 400 or 422. - Parameter value out of range: Values like
temperaturemust fall within a valid range for the model (often 0–2). Out-of-range values are often rejected with HTTP 400 and anerror.messagethat names the parameter. - Malformed
messagespayload: Themessagesfield must be a list of message objects. Wrong types or invalid structure typically return HTTP 400 with a validation message in the response body. - Invalid
response_formator other structured-output settings: Requesting a format the model does not support can return an error response. Treat the status code and body as authoritative for your model.
What you can do
-
Check the error message body
- Many responses use an
errorobject with amessagefield (and sometimesparamorcode). Some layers return adetailfield instead. Read whichever field the response includes before troubleshooting.
- Many responses use an
-
Verify parameter support for your model
- Review Available models for the specific parameters and ranges each model accepts.
-
Validate your messages array
- Each message must have a
role(system,user, orassistant) and acontentstring. Tool call messages require additional fields. Consult the chat completions API reference for the correct schema.
- Each message must have a
-
Confirm the base URL
- Point your OpenAI-compatible client at
https://api.inference.wandb.ai/v1, nothttps://api.wandb.ai. The Multi-tenant Cloud API host does not serve Inference chat completions. For optional usage attribution, set theOpenAI-Projectheader toteam/projectas in the list models API reference.
- Point your OpenAI-compatible client at
-
Remove unsupported parameters
- If you are adapting code from another provider, remove any parameters that are not in the Serverless Inference API reference. Extra parameters that the model does not support can trigger 400 or 422 responses.
Server Errors