Sentient AI
Manage Responses
Understand and interpret API responses effectively while handling them efficiently.
All API endpoints return a structured JSON response, ensuring consistency and ease of integration. A successful request will receive an HTTP 200 OK status code, indicating that the request was processed correctly.
Each response contains key attributes that provide useful information about the request outcome, including the generated AI response, metadata, and any relevant flags.
Each response contains key attributes that provide useful information about the request outcome, including the generated AI response, metadata, and any relevant flags.
Fields
All endpoints include some common fields that provide essential details about the request and response. These fields help track the API request, model usage, and processing time.
Every field will follow JSON syntax and can be parsed using standard JSON parsing. These fields provide structured data to ensure consistency and easy integration with your application.
Common Response Fields
Field | Type | Description |
---|---|---|
success | boolean | Indicates whether the request was processed successfully. |
model | string | Specifies which AI model was used. |
created | integer | A Unix timestamp representing when the request was processed. |
latency | integer | The time taken to process the request. |
request_id | string | A unique identifier for tracking the request. |
data_transmitted | object | Contains details about the data size transmitted in the request. |
├─ inbound | integer | The size of the request payload in bytes. |
Example Response
Below is a sample JSON response from the /api/v1/chat/completions endpoint, demonstrating the structure of a typical response.
This sample JSON response is a result of request sent in step-2.
JSON
jsCode
jsCode
The latency value in the API response represents the time taken by our servers to process the request internally. However, this does not include other factors such as network delays, client-side processing, or additional execution time in your application.
In contrast, the overall execution time of your request includes:
In contrast, the overall execution time of your request includes:
- Network transmission time (sending the request & receiving the response)
- API latency (the time taken by our servers to process your request)
- Client-side processing (parsing the response, handling data, etc.)
Due to these factors, the overall execution time may be longer than the reported API latency.PreviousStep 2 - Make your First Request
NextEndpoints
On this Page
Managing the Response
Fields
Common Response Fields
Example Response
Response Snippet