Experimental
Chat completions

Generate a completion (OpenAI-compatible, non-streaming)

warn Limited OpenAI Chat Completions API compatibility. Supports basic chat completion with standard message roles and JSON responses. Not supported: OpenAI-style streaming, tool calls, stop sequences, logprobs, and most request parameters.

Creates a chat completion response from a list of messages comprising a conversation.

post/v1/experimental/replicas/{replicaUUID}/chat/completions

Request

  • Base URL: https://api.sensay.io
  • URL: https://api.sensay.io/v1/experimental/replicas/{replicaUUID}/chat/completions
  • Auth: API key in header X-ORGANIZATION-SECRET and API key in header X-USER-ID and API key in header X-USER-ID-TYPE

Path parameters

replicaUUIDstring uuid required

The replica unique identifier (UUID)

Example:03db5651-cb61-4bdf-9ef0-89561f7c9c53

Headers

X-API-Versionstring
Example:2025-03-25
Content-Encoding'gzip'

Content encoding for request body compression. Optional - when used, client is responsible for gzipping and sending binary data.

Request body

storeboolean

When set to false, historical messages are not used in the context, and the message is not appended to the conversation history.

source'discord' | 'embed' | 'web'

The place where the conversation is happening, which informs where the message should be saved in the chat history if store is true.

Example request

{
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "How did you handle the immense pressure during the Civil War?"
    }
  ],
  "store": true,
  "source": "web"
}

Response

Chat completion response in OpenAI compatible format

idstring required

A unique identifier for the chat completion.

createdinteger required

The Unix timestamp (in seconds) of when the chat completion was created.

object'chat.completion' required

The object type, which is always "chat.completion"

modelstring required

The model used for the chat completion.

Example response

{
  "id": "chatcmpl-abc123",
  "created": 1677858242,
  "object": "chat.completion",
  "model": "o1",
  "choices": [
    {
      "message": {
        "role": "assistant",
        "content": "During the Civil War, I faced tremendous pressure..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 56,
    "completion_tokens": 31,
    "total_tokens": 87
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.