Chat
Base Path: /v1/chat
Process Chat Completion
Method: POST
Endpoint: https://api.tokensource.com/v1/chat
Description: Processes a chat completion request.
Request Body:
{
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What is the capital of France?"
}
],
"temperature": 0.7,
"max_tokens": 100,
"conversationExternalId": "uuid-123",
"objectiveId": 1,
"aiAssistantId": 1
}
Response (200 OK):
{
"status": 200,
"data": {
"completion": {
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1677652288,
"model": "gpt-3.5-turbo",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The capital of France is Paris."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 12,
"total_tokens": 21
}
},
"conversationId": "uuid-123",
"messageId": "uuid-456"
}
}
Response (400 Bad Request):
{
"status": 400,
"data": null,
"message": "Invalid model specified"
}
Last updated