Skip to main content
Invalid parameters on chat completion requests often surface as HTTP 422 (Unprocessable Entity) or HTTP 400 (Bad Request) depending on where validation runs. In both cases, read the response body before changing your request.

Why this happens

  • Unsupported parameter for the model: Some parameters (such as frequency_penalty, logprobs, or response_format) are not supported by all models. Passing an unsupported parameter can return 400 or 422.
  • Parameter value out of range: Values like temperature must fall within a valid range for the model (often 0–2). Out-of-range values are often rejected with HTTP 400 and an error.message that names the parameter.
  • Malformed messages payload: The messages field 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_format or 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

  1. Check the error message body
    • Many responses use an error object with a message field (and sometimes param or code). Some layers return a detail field instead. Read whichever field the response includes before troubleshooting.
  2. Verify parameter support for your model
    • Review Available models for the specific parameters and ranges each model accepts.
  3. Validate your messages array
    • Each message must have a role (system, user, or assistant) and a content string. Tool call messages require additional fields. Consult the chat completions API reference for the correct schema.
  4. Confirm the base URL
    • Point your OpenAI-compatible client at https://api.inference.wandb.ai/v1, not https://api.wandb.ai. The Multi-tenant Cloud API host does not serve Inference chat completions. For optional usage attribution, set the OpenAI-Project header to team/project as in the list models API reference.
  5. Remove unsupported parameters
    • If you are adapting code from another provider, remove any parameters that are not in the W&B Inference API reference. Extra parameters that the model does not support can trigger 400 or 422 responses.
For more information, see Serverless Inference and the chat completions API reference.
Server Errors