Using the API
API error codes
The SambaNova Cloud 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. These include:
-
Error code
- Identifies the type of error.
-
Parameter (if applicable)
- Specifies the property causing the error.
-
Error message
- Provides a clear explanation of the issue.
Error message
This error message indicates that a parameter value exceeded the allowed maximum. The top_p
parameter received a value of 100
, whereas it should be between 0
and 1
. The error type is invalid_request_error
, with the code decimal_above_max_value
.
Example error message
Error categories
Use the following table to understand the various error categories.
Error category | Description |
---|---|
HTTP 400 errors: Bad request | These errors occur when the server cannot process the client’s request due to invalid syntax or input values. |
HTTP 401 errors: Unauthorized | These errors occur when the client does not provide valid authentication credentials. |
HTTP 408 errors: Request timeout | These errors occur when a client’s request times out before being completed. |
HTTP 429 errors: Too many requests | These errors occur when the client exceeds the rate limit for their subscription tier. |
Error code reference
Use the following table to understand and troubleshoot errors programmatically.
Error category | Error code | Description |
---|---|---|
HTTP 400 | context_length_exceeded | Input and output tokens exceed the model’s supported context length. |
invalid_type | Parameter value is of a different type than expected (e.g., an int is required, but a float is provided). | |
decimal_above_max_value | Parameter value exceeds the allowed maximum. | |
decimal_below_min_value | Parameter value is below the allowed minimum. | |
integer_above_max_value | Parameter value exceeds the maximum allowed integer. | |
model_not_found | Provided model ID does not exist. | |
HTTP 401 | invalid_authentication | The API key provided is invalid or unauthorized. Generate a valid API key from the SambaNova Cloud portal. |
HTTP 408 | request_timeout | Request timed out due to high traffic. Consider upgrading to a higher subscription tier to avoid this. |
HTTP 429 | insufficient_quota | Rate-limited access due to subscription tier. Upgrade to a higher tier to increase quota. |