Conversations Beta
Execute conversations, with or without streaming.
Execute a conversation turn against a selected LLM provider.
POST /chat/conversation/execute
Executes a single conversation turn by persisting the inbound user message as an immutable ConversationRecord, invoking a concrete CognitiveInfrastructureLLMProvider (referenced by llm_provider_id), persisting the outbound assistant message as another immutable ConversationRecord, and returning the assistant output plus usage metadata. This endpoint is the runtime entry point for multi-provider chat orchestration. Governance can be enforced through the ConversationManagement container (organization boundary, allowed providers, memory strategy, etc.).
Authentication: Bearer token
Request body
Conversation execution request payload.
Responses
-
200OK. -
400Bad request (missing required fields or invalid identifiers). -
403Forbidden (provider not allowed by conversation governance or cross-organization access). -
500Something went wrong while performing this action.
curl -X POST https://api.sommatic.ai/chat/conversation/execute \
-H "Authorization: Bearer $SOMMATIC_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'const response = await fetch('https://api.sommatic.ai/chat/conversation/execute', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SOMMATIC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
});
const { success, message, result } = await response.json();import os
import requests
response = requests.post(
"https://api.sommatic.ai/chat/conversation/execute",
headers={
"Authorization": f"Bearer {os.environ['SOMMATIC_TOKEN']}",
},
json={},
)
data = response.json(){
"status": 200,
"success": true,
"message": "Operation completed successfully",
"result": {
"conversation_id": "c-4c3f0f2b7a1a4f7a9a1b2c3d4e5f6a7b",
"conversation_slug": "convo.ops.support.001",
"llm_provider_id": "llmprov-8f3c1a2b4d5e6f",
"llm_provider_slug": "llm.openai.gpt4_1",
"record_user_id": "rec-usr-001",
"record_assistant_id": "rec-asst-002",
"output": {
"text": "Here is a summary of the anomalies..."
},
"usage": {
"input_tokens": 123,
"output_tokens": 456,
"total_tokens": 579,
"latency_ms": 832
}
}
}{
"status": 400,
"success": false,
"message": "Please provide organization_id, conversation_id, llm_provider_id and message.text",
"result": null
}{
"status": 403,
"success": false,
"message": "Selected provider is not allowed for this conversation",
"result": null
}{
"status": 500,
"success": false,
"message": "Something went wrong while performing this action",
"result": null
}Execute a conversation turn against a selected LLM provider with SSE streaming.
POST /chat/conversation/execute/stream
Streaming variant of POST /chat/conversation/execute. Opens a persistent SSE connection and emits token chunks as they arrive from the LLM provider. The connection lifecycle:
- event: open — emitted immediately after context validation, before the first token. 2. event: chunk — emitted per token delta { text, index }. 3. event: done — emitted once after full response is persisted; payload is identical to the JSON response returned by the synchronous /execute endpoint.
- event: error — emitted on any failure; stream is then closed. The existing POST /chat/conversation/execute endpoint is unchanged. Both endpoints share the same business logic and produce the same persisted output.
Authentication: Bearer token
Request body
Conversation execution request payload (same shape as /execute).
Responses
-
200SSE stream (text/event-stream).
curl -X POST https://api.sommatic.ai/chat/conversation/execute/stream \
-H "Authorization: Bearer $SOMMATIC_TOKEN" \
-H "Content-Type: application/json" \
-d '{}' \
-Nconst response = await fetch('https://api.sommatic.ai/chat/conversation/execute/stream', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SOMMATIC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
});
const { success, message, result } = await response.json();import os
import requests
response = requests.post(
"https://api.sommatic.ai/chat/conversation/execute/stream",
headers={
"Authorization": f"Bearer {os.environ['SOMMATIC_TOKEN']}",
},
json={},
)
data = response.json(){
"status": 200,
"success": true,
"message": "Operation completed successfully",
"result": {}
}