Skip to main content
The Infercom API uses standard HTTP response status codes to indicate whether an API request was successful or failed. When a request fails, the API responds with a JSON object containing details about the error.

The error envelope

Every error response uses the same shape. The error detail is nested inside an error object, and the response carries a request_id alongside it.
Example error response
Log request_id on every failed request. It is the field our support team needs to trace a request end to end. Include it in every report you open at support.infercom.ai.
/v1/messages uses the Anthropic error shape, not the envelope above. The body carries a top-level "type": "error", and error holds message and type only - there is no param or code. request_id is present on every status, though only some carry a req_ prefix - the 401 does not. See Anthropic SDK compatibility.
Three responses do not use this envelope, and one of them is not JSON at all. See Responses that do not use the envelope before you write your error handling.

Error categories

Use the following table to understand the various error categories.
If you are experiencing 500 or 503 errors, check the Infercom Status Page for any ongoing incidents or scheduled maintenance before contacting support.

Error code reference

Use the following table to understand and troubleshoot errors programmatically.

Responses that do not use the envelope

Three paths do not use this envelope. On two of them the body is still JSON, but error is a string instead of an object. On the third the body is not JSON at all. All three omit request_id. Handle all three shapes before you read error.message.

Malformed image data

Returned by vision requests when the API cannot decode the image. HTTP 400.

A forced tool_choice that the model does not satisfy

Returned by function calling requests when you force a specific function and the model produces no valid call. HTTP 400.
This body adds a field the envelope does not define, error_model_output. It carries the text the model produced instead of the tool call. Note also that error_type holds a sentence here, not a code such as invalid_request_error.

A retired model on /v1/chat/completions

Returned when the requested model has been deprecated and removed. HTTP 410. This response is not JSON. It is served as content-type: text/plain; charset=utf-8 with a plain sentence as the whole body:
Parsing this body as JSON raises a decode error. Check the response content-type, or catch the decode failure, before you read the body.
Official SDKs already survive this. The OpenAI Python SDK raises openai.APIStatusError with status_code 410 and the sentence in .body. The failure hits clients that call .json() on the raw response themselves - requests, for example, raises requests.exceptions.JSONDecodeError.
The same condition on /v1/responses and /v1/messages does return JSON.
Do not retry a 410. The condition is permanent. Change the model ID instead. See Deprecations for current replacements.

Defensive parsing