Responses
Response Format
Understanding the Messages API response structure and handling.
Response Structure
Response Fields
id
- Unique identifier for the completionobject
- Type of object returnedcreated
- Unix timestamp of when the completion was createdmodel
- Model used for completionchoices
- Array of completion choices:index
- Index of the choicemessage
- The completion message objectfinish_reason
- Why the completion stopped
usage
- Token usage statistics
Example Response
Streaming Responses
When streaming is enabled, the API sends chunks in the following format:
Last updated