API Error Codes

The SambaNova Cloud API uses standard HTTP response status codes to indicate the success or failure of API requests.

If a request fails, the response body provides a JSON object with details about the error. Details include an error code, the property (if applicable) causing the error, and a helpful error message, as shown in the example response below.

{
  "error": {
    "message": "Decimal above maximum value. Expected a value between 0 and 1, but got 100 instead.",
    "type": "invalid_request_error",
    "param": "top_p",
    "code": "decimal_above_max_value"
  }
}

Error code reference

Use the list of error codes described below to help you debug and programmatically address errors in your application.

HTTP 400 errors

HTTP 400 Bad Request errors occur when the server is unable to understand the client’s request. These are most often due to invalid syntax or values.
The source of the error can be determined from the error code in the response body. Possible error codes are:

  • context_length_exceeded: Occurs when the total number of input and output tokens exceeds the context length supported by the model.

  • invalid_type: Occurs when the value provided for a parameter is of a different type than expected (e.g., an int is expected, but a float is provided).

  • decimal_above_max_value: Occurs when the value provided for a parameter exceeds the maximum value for it.

  • decimal_below_min_value: Occurs when the value provided for a parameter is below the minimum value for it.

  • integer_above_max_value: Occurs when the value provided for a parameter exceeds the maximum value for it.

  • model_not_found: Occurs when an incorrect model ID is provided.

HTTP 401 errors

The HTTP 401 Unauthorized error occurs when a request lacks valid authentication credentials to fulfill the client’s request. The invalid_authentication error code in the response body is described below.

invalid_authentication: Occurs when an unauthorized/invalid API key is provided. Generate a valid API key from the SambaNova Cloud portal

HTTP 408 errors

HTTP 408 Request Timeout errors occur when a request sent by the client times out before being fulfilled. The request_timeout error code in the response body is described below.

request_timeout: Requests may time out due to a large volume of requests on the service. To minimize occurrence of such situations, it is recommended to upgrade to higher tier offerings.

HTTP 429 errors

HTTP 429 Too Many Requests errors occur when the client has sent too many requests in a given amount of time, exceeding the rate limit. The insufficient_quota error code in the response body is described below.

insufficient_quota: Access to the SambaNova Cloud API may be rate limited depending on your subscription tier. To minimize occurrence of such situations, it is recommended to upgrade to higher tier offerings.

2 Likes