Errors and rate limits

HTTP errors

Our API follows a predictable HTTP error code format:

  • 400 - Invalid request: there was an issue with the format or content of your request.
  • 401 - Unauthorized: there's an issue with your API key.
  • 403 - Forbidden: your API key does not have permission to use the specified resource.
  • 404 - Not found: the requested resource was not found.
  • 409 - Conflict: Resource already exists on the path.
  • 429 - Your account has hit a rate limit.
  • 500 - An unexpected error has occurred.
  • 502 - Bad Gateway: The API is temporarily unavailable.
  • 503 - The API is temporarily unavailable.

When receiving a streaming response via SSE, it's possible that an error can occur after returning a 200 response, in which case error handling wouldn't follow these standard mechanisms.

Error shapes

Errors are always returned as JSON, with a top-level error object that always includes a type and message value. For example:

Error typeRequiredDescription
errorYesThe top-level error object.
typeYesA string representing the error type.
codeYesA string representing the detailed error code.
messageYesA string representing the error message.
{  
  "error": {  
    "type": "bad_request",
    "code": "invalid_argument",
    "message": "Invalid 'temperature': decimal above maximum value. "  
  }  
}

List of possible error codes

Below is a list of all the possible error code that the gateway can return. The Retryable column describes whether the client can attempt the same request again and expect a successful response.

Authentication

CodeRetryableDescription
missing_api_keyNoClient did not provide an API key for a secured endpoint.
invalid_api_keyNoClient provided an API key but it was malformed or otherwise invalid for the API.
unauthorizedNoClient was authenticated but lacks permission for target resource.

Client errors

CodeRetryableDescription
rate_limit_exceededYes*The client has exceeded their allocated quota and must wait before making new requests.
invalid_requestNoRequest from client could not be parsed due to size, format or content type issues.
invalid_argumentNoRequest from client is missing fields or contains fields that is not compatible with the called API or model.
not_foundNoRequested endpoint does not exist.
unknown_modelNoClient provided model name could not be found.
invalid_content_mediaNoRequest attached media content could not be processed.
unavailable_content_mediaNoRemote media content referenced by request could not be accessed.
unsafe_contentNoThe request was denied during safety pre-processing of content.
unknown_appNoFailed to find a GIP app with the request provided ID.
invalid_appNoThe requested GIP app is invalid and cannot be used.
unsupported_interfaceNoThe requested inference API (e.g. chat) is not available for target model.

* Retryable after backing off for rate limit quota to reset.

Gateway internal errors

CodeRetryableDescription
unknown_workspaceNoThe workspace of the provided API key could not be retrieved.
failed_requestNoAn unexpected error was encountered when building the model request or parsing the response.
internal_errorNoUnexpected internal gateway error.

Model server errors

CodeRetryableDescription
model_server_errorYesModel responded with a server error.
model_overloadedYesModel is currently overloaded and could not handle the request.
model_unavailableNoThe gateway could not reach the model due to network, configuration or other issues.
model_timeoutYesRequest to model server timed out.
stream_errorYesAn error was encountered while streaming a response from the model to the client.
stream_terminatedYesThe model stream was unexpectedly terminated from the model's side.