The Unified Chat API lets you interact with LLMs while automatically analyzing the emotional tone of both user and assistant messages using V2 EQ dimensions.
/v2/chat/completionsHeaders
x-api-key: YOUR_API_KEYContent-Type: application/json| Field | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | LLM model (gpt-4, gpt-4-turbo, gpt-3.5-turbo, claude-3-*, xai-grok) |
| emotion_model | string | Yes | Emotion model: emotion-v2 (recommended) or emotion-v1 |
| context_id | string | No | Session ID for emotional memory and trajectory tracking (max 128 bytes). Enables V2 advanced features. |
| messages | array | Yes | Conversation history. Each: {role: "system"|"user"|"assistant", content: string} |
| model_params | object | No | LLM parameters (temperature, max_tokens, top_p, frequency_penalty, presence_penalty) |
| emotion_model_params | object | No | V2 emotion options (sensitivity, includeSubEmotions) |
| stream | boolean | No | Stream results in chunks (default: false) |
| tools | array | No | Tool definitions for function calling |
curl -X POST https://api.kaikostudios.xyz/v2/chat/completions \
-H "x-api-key: $KAIKO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4",
"emotion_model": "emotion-v2",
"context_id": "chat-123",
"messages": [
{"role": "system", "content": "You are a helpful and empathetic assistant."},
{"role": "user", "content": "I am nervous about my interview tomorrow."}
],
"model_params": {
"temperature": 0.7,
"max_tokens": 500
},
"stream": false
}'{
"id": "chatcmpl-abc123def456",
"object": "chat.completion",
"created": 1757595153,
"model": "gpt-4",
"emotion_model": "emotion-v2",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "It's completely natural to feel nervous before an interview. Let me share some tips to help you feel more prepared..."
},
"finish_reason": "stop"
}
],
"emotions": {
"user": {
"category": "fear",
"text": "I am nervous about my interview tomorrow.",
"intensity": 0.72,
"intensityLevel": "moderate",
"valence": -0.45,
"arousal": 0.65,
"complexity": "simple",
"wonderIndex": 0.20,
"discoveryLevel": "normal",
"raw": {
"fear": 0.72,
"sadness": 0.15,
"joy": 0.05,
"anger": 0.03,
"love": 0.02,
"surprise": 0.03
}
},
"assistant": {
"category": "love",
"intensity": 0.68,
"valence": 0.72,
"arousal": 0.45,
"raw": {
"love": 0.68,
"joy": 0.45,
"fear": 0.02,
"sadness": 0.01,
"anger": 0.01,
"surprise": 0.03
}
}
},
"conversationMode": {
"mode": "emotional_support",
"confidence": 0.88,
"responseStrategy": {
"tone": "empathetic",
"approach": "validation_first"
}
},
"usage": {
"prompt_tokens": 85,
"completion_tokens": 120,
"analyse_tokens": 25
}
}| Field | Description |
|---|---|
| emotions.*.intensity | Strength of dominant emotion (0.0-1.0) |
| emotions.*.intensityLevel | critical, high, moderate, subtle, minimal |
| emotions.*.valence | Emotional tone (-1.0 to +1.0) |
| emotions.*.arousal | Energy level (0.0-1.0) |
| emotions.*.complexity | simple, layered, paradoxical, transcendent |
| emotions.*.wonderIndex | Curiosity level (0.0-1.0) |
| emotions.*.discoveryLevel | routine, normal, significant, breakthrough, transcendent |
| conversationMode.mode | Detected mode (emotional_support, crisis_intervention, etc.) |
| conversationMode.responseStrategy | Suggested tone and approach for response |
| Provider | Models |
|---|---|
| OpenAI | gpt-4, gpt-4-turbo, gpt-3.5-turbo, gpt-4o-mini |
| Anthropic | claude-3-opus, claude-3-sonnet, claude-3-haiku |
| XAI | xai-grok |
| Code | Meaning | When it happens |
|---|---|---|
| 400 | Bad Request | Invalid request body or missing required fields |
| 401 | Unauthorized | Missing/invalid API key |
| 404 | Not Found | Invalid model name or expired context_id |
| 413 | Payload Too Large | Too many messages or oversized input |
| 429 | Rate Limited | Exceeded quota; retry with backoff |
| 500 | Server Error | Unexpected error; contact support if persistent |
context_id for multi-turn conversations to enable trajectory tracking and emotional memory.context_id, emotions are evaluated per-call (stateless) but still include V2 EQ dimensions.conversationMode provides automatic response strategy recommendations.prompt_tokens, completion_tokens, and analyse_tokens.Next: see Emotion APIs for standalone V2 emotion analysis, or V2 EQ Dimensions for detailed explanations of each dimension.