"data: {\"id\":\"chatcmpl_abc123\",\"object\":\"chat.completion.chunk\",\"created\":1702648800,\"model\":\"pet-advisor-1\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"\"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl_abc123\",\"object\":\"chat.completion.chunk\",\"created\":1702648800,\"model\":\"pet-advisor-1\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"Before\"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl_abc123\",\"object\":\"chat.completion.chunk\",\"created\":1702648800,\"model\":\"pet-advisor-1\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\" adopting\"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl_abc123\",\"object\":\"chat.completion.chunk\",\"created\":1702648800,\"model\":\"pet-advisor-1\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\" a\"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl_abc123\",\"object\":\"chat.completion.chunk\",\"created\":1702648800,\"model\":\"pet-advisor-1\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\" cat\"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl_abc123\",\"object\":\"chat.completion.chunk\",\"created\":1702648800,\"model\":\"pet-advisor-1\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"...\"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl_abc123\",\"object\":\"chat.completion.chunk\",\"created\":1702648800,\"model\":\"pet-advisor-1\",\"choices\":[{\"index\":0,\"delta\":{},\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n"{
"type": "https://petstoreapi.com/errors/bad-request",
"title": "Bad Request",
"status": 400,
"detail": "Invalid value for parameter 'status'. Must be one of: available, pending, sold.",
"instance": "/pets"
}{
"type": "https://petstoreapi.com/errors/unauthorized",
"title": "Unauthorized",
"status": 401,
"detail": "Authentication is required to access this resource. Please provide a valid OAuth 2.0 token."
}{
"type": "https://petstoreapi.com/errors/validation-error",
"title": "Validation Error",
"status": 422,
"detail": "The request body contains validation errors.",
"instance": "/pets",
"errors": [
{
"field": "name",
"message": "Pet name is required",
"code": "required_field"
},
{
"field": "status",
"message": "Invalid status value",
"code": "invalid_format"
}
]
}{
"type": "https://petstoreapi.com/errors/rate-limit-exceeded",
"title": "Too Many Requests",
"status": 429,
"detail": "Rate limit exceeded. Please wait 60 seconds before making another request."
}Create Chat Completion
Creates a model response for a chat conversation with the Pet Adoption Advisor AI. Supports streaming responses using Server-Sent Events (SSE).
Pet Adoption Advisor
Our AI assistant helps users:
- Get personalized pet recommendations
- Learn about pet care and adoption process
- Answer questions about specific pets
- Provide breed information and compatibility advice
Streaming Mode
When stream: true, the response is sent as Server-Sent Events (SSE), with each token delivered incrementally. This provides a better user experience for longer responses.
Stream Format
Each chunk is sent as:
data: {"id":"chatcmpl_abc","object":"chat.completion.chunk","choices":[{"delta":{"content":"Hello"},"index":0}]}
The stream ends with:
data: [DONE]
Non-Streaming Mode
When stream: false or omitted, returns a complete response object.
"data: {\"id\":\"chatcmpl_abc123\",\"object\":\"chat.completion.chunk\",\"created\":1702648800,\"model\":\"pet-advisor-1\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"\"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl_abc123\",\"object\":\"chat.completion.chunk\",\"created\":1702648800,\"model\":\"pet-advisor-1\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"Before\"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl_abc123\",\"object\":\"chat.completion.chunk\",\"created\":1702648800,\"model\":\"pet-advisor-1\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\" adopting\"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl_abc123\",\"object\":\"chat.completion.chunk\",\"created\":1702648800,\"model\":\"pet-advisor-1\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\" a\"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl_abc123\",\"object\":\"chat.completion.chunk\",\"created\":1702648800,\"model\":\"pet-advisor-1\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\" cat\"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl_abc123\",\"object\":\"chat.completion.chunk\",\"created\":1702648800,\"model\":\"pet-advisor-1\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"...\"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl_abc123\",\"object\":\"chat.completion.chunk\",\"created\":1702648800,\"model\":\"pet-advisor-1\",\"choices\":[{\"index\":0,\"delta\":{},\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n"{
"type": "https://petstoreapi.com/errors/bad-request",
"title": "Bad Request",
"status": 400,
"detail": "Invalid value for parameter 'status'. Must be one of: available, pending, sold.",
"instance": "/pets"
}{
"type": "https://petstoreapi.com/errors/unauthorized",
"title": "Unauthorized",
"status": 401,
"detail": "Authentication is required to access this resource. Please provide a valid OAuth 2.0 token."
}{
"type": "https://petstoreapi.com/errors/validation-error",
"title": "Validation Error",
"status": 422,
"detail": "The request body contains validation errors.",
"instance": "/pets",
"errors": [
{
"field": "name",
"message": "Pet name is required",
"code": "required_field"
},
{
"field": "status",
"message": "Invalid status value",
"code": "invalid_format"
}
]
}{
"type": "https://petstoreapi.com/errors/rate-limit-exceeded",
"title": "Too Many Requests",
"status": 429,
"detail": "Rate limit exceeded. Please wait 60 seconds before making another request."
}Authorizations
Bearer token authentication using JWT (JSON Web Token). Include the token in the Authorization header as: Authorization: Bearer <token>
Body
A list of messages comprising the conversation so far
1Show child attributes
Show child attributes
ID of the model to use
PET_ADVISOR_1, PET_ADVISOR_TURBO If true, partial message deltas will be sent via Server-Sent Events
Maximum number of tokens to generate
1 <= x <= 4096Sampling temperature between 0 and 2
0 <= x <= 2Response
Successful response. Format depends on the stream parameter.
Streaming response (when stream=true). Each line contains a JSON chunk prefixed with 'data: '