Chat
Base URL: https://app.neuroflash.com/api/digital-twin-service
Chat with an individual digital twin. The twin responds based on its demographic profile, personality, and perspective.
Chat With Twin
POST
/v1/workspaces/{workspace_id}/twins/{twin_id}/chat-completionsPath Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspace_id | string | Yes | |
twin_id | string | Yes |
Request Body
FieldTypeRequiredDescription
messagesarray<object>YesConversation history (at least one message required, last message must be from user)
rolestringYesRole: 'user' or 'assistant'contentstringYesMessage contentattachmentsobjectNoList of file IDs to attach to this message (user messages only)responseFormatobjectNoStructured output format using JSON schema. If null, uses default schema with 'answer' and 'reason' fields.temperatureobjectNoSampling temperature for response generationuseWebSearchobjectNoWeb search mode: 'never', 'auto', or 'always'useVerbalizedSamplingobjectNoGenerate 5 probability-weighted response options (tau=0.10). Mutually exclusive with custom responseFormat.Example
- cURL
- Python
- Node.js
- Go
curl -X POST "https://app.neuroflash.com/api/digital-twin-service/v1/workspaces/{workspace_id}/twins/{twin_id}/chat-completions" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"messages": [],
"responseFormat": {},
"temperature": {},
"useWebSearch": {},
"useVerbalizedSampling": {}
}'
import requests
response = requests.post(
f"https://app.neuroflash.com/api/digital-twin-service/v1/workspaces/{workspace_id}/twins/{twin_id}/chat-completions",
headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json"},
json={
"messages": [],
"responseFormat": {},
"temperature": {},
"useWebSearch": {},
"useVerbalizedSampling": {}
},
).json()
const response = await fetch(
`https://app.neuroflash.com/api/digital-twin-service/v1/workspaces/${workspaceId}/twins/${twinId}/chat-completions`,
{
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"messages": [],
"responseFormat": {},
"temperature": {},
"useWebSearch": {},
"useVerbalizedSampling": {}
}),
}
).then((r) => r.json());
body, _ := json.Marshal(map[string]any{
"messages": []any{},
"responseFormat": map[string]any{},
"temperature": map[string]any{},
"useWebSearch": map[string]any{},
"useVerbalizedSampling": map[string]any{},
})
req, _ := http.NewRequest("POST", "https://app.neuroflash.com/api/digital-twin-service/v1/workspaces/"+workspaceID+"/twins/"+twinID+"/chat-completions", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
Response:
{}