Serverless AI Text Conversation

AI powered conversational service that generates responses to user messages, supporting conversation history and context.

Endpoint

Generate conversational AI responses with context and history

POSThttps://api.xtartapp.com/text/conversation

*Authentication

You must use a Bearer token provided by the dashboard to use for authentication. Add the token to the Authorization header.

Request body

NameTypeRequiredMaxDescription
askstringYes1000The user input message.
behaviorstringNo-Custom behavior instruction for the assistant (defaults to 'You are a helpful AI assistant.')
historyarray of objectsNo25Previous conversation history between user and assistant.
history[].rolestringYes-The role of the message sender (user or assistant)
history[].contentstringYes500The message content.
contextstringNo25000Optional context information that helps the assistant generate better responses (max 25 000 characters).
languagestringNo-The language code for the assistant response.

Response

NameTypeDescription
dataobjectThe assistant response data.
data.responsestringThe assistant response text.
metadataobjectMetadata about the execution process.
metadata.costnumberThe cost of the execution request.

Errors

{
   "error": "string", 
   "code": "string"
}
HTTP StatusError CodeMessage
400INVALID_PAYLOADOccurs when the payload is invalid.
400INVALID_REQUESTThe request is invalid.
400TEXT_CONVERSATION_ERRORCould not generate response | parsing error.
400HARM_CONTENTThe content is harmful and cannot be processed.
400INSUFFICIENT_BALANCEThe user has insufficient balance.
400INPUT_TOO_LONGThe input text exceeds the maximum length.
401UNAUTHORIZEDThe token is invalid.
429TOO_MANY_REQUESTSThe request limit has been reached.