Generate a completion
Ask for a completion and stores the prompt in the chat history.
Replica chat supports two response formats: streamed and JSON. To switch between these formats, use the 'Accept' header, specifying either 'text/event-stream' for streaming or 'application/json' for JSON. The streamed response honours the Stream Protocol, allowing the use of a number of SDKs, including Vercel AI SDK.
The streamed variant is not specified in the OpenAPI Schema because it is not an OpenAPI endpoint.
Headers
-
X-API-Version
string Default value is
2025-03-25
.
Path parameters
-
replicaUUID
string(uuid) Required The UUID of the Replica
Body
-
content
string Required Content of the message must be between 1 and 10000 characters.
Minimum length is
1
, maximum length is10000
. -
skip_chat_history
boolean When set to true, historical messages are not used in the context, and the message is not appended to the conversation history, thus it is excluded from all future chat context.
Default value is
false
. -
source
string The place where the conversation is happening, which informs where the message should be saved in the chat history.
Values are
discord
,telegram
,embed
,web
, ortelegram_autopilot
. -
discord_data
object Discord information about the message
Additional properties are NOT allowed.
curl \
--request POST 'https://api.sensay.io/v1/replicas/03db5651-cb61-4bdf-9ef0-89561f7c9c53/chat/completions' \
--header "X-ORGANIZATION-SECRET: $API_KEY" \
--header "X-USER-ID: $API_KEY" \
--header "Content-Type: application/json" \
--header "X-API-Version: 2025-03-25" \
--data '{"content":"How did you handle the immense pressure during the Civil War?","skip_chat_history":false,"source":"discord","discord_data":{"channel_id":"string","channel_name":"string","author_id":"string","author_name":"string","message_id":"string","created_at":"string","server_id":"string","server_name":"string"}}'
# Headers
X-API-Version: 2025-03-25
# Payload
{
"content": "How did you handle the immense pressure during the Civil War?",
"skip_chat_history": false,
"source": "discord",
"discord_data": {
"channel_id": "string",
"channel_name": "string",
"author_id": "string",
"author_name": "string",
"message_id": "string",
"created_at": "string",
"server_id": "string",
"server_name": "string"
}
}
{
"content": "I handled the immense pressure during the Civil War by...",
"success": true
}
{"content"=>"I handled the immense pressure during the Civil War by...", "success"=>true}
{
"success": true,
"error": "string",
"fingerprint": "14fceadd84e74ec499afe9b0f7952d6b",
"request_id": "xyz1::reg1:reg1::ab3c4-1234567890123-0123456789ab"
}
{
"success": true,
"error": "string",
"fingerprint": "14fceadd84e74ec499afe9b0f7952d6b",
"request_id": "xyz1::reg1:reg1::ab3c4-1234567890123-0123456789ab"
}
{
"success": true,
"error": "string",
"request_id": "xyz1::reg1:reg1::ab3c4-1234567890123-0123456789ab"
}
{
"success": true,
"error": "string",
"fingerprint": "14fceadd84e74ec499afe9b0f7952d6b",
"request_id": "xyz1::reg1:reg1::ab3c4-1234567890123-0123456789ab"
}
{
"success": true,
"error": "string",
"fingerprint": "14fceadd84e74ec499afe9b0f7952d6b",
"request_id": "xyz1::reg1:reg1::ab3c4-1234567890123-0123456789ab",
"inner_exception": {
"name": "Server overheated",
"cause": "Request too complicated",
"stack": "Error: Server overheated due to an unexpected situation\n at Object.eval (eval at <anonymous>...",
"message": "The server overheated due to an unexpected situation"
}
}