Chat
OpenAI-compliant chat completion operations.
Stream a conversation turn using the OpenAI Chat Completion format. This endpoint translates the request into an NLX conversation turn and streams back the app's response.
Standard OpenAI-style authentication. Your NLX API Key should be passed here.
The unique key identifying the AI app deployment.
The unique key identifying the specific channel. Must include the language code suffix (e.g., -en-US, -es-MX).
xxxxxxxx-en-USUsed to pass the session identifier. Expected format: "nlx:{conversationId}". If the conversationId is omitted (e.g., just "nlx"), a new UUID will be generated.
nlx:550e8400-e29b-41d4-a716-446655440000If set, partial message deltas will be sent using Server-Sent Events. This API is optimized for streaming.
trueServer-sent events stream. The response is streamed as a series of JSON objects prefixed with "data: ".
Bad Request
Unauthorized - Invalid Bearer Token
POST /v1/{deploymentKey}/{channelKey}/chat/completions HTTP/1.1
Host: apps.nlx.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 114
{
"model": "nlx:550e8400-e29b-41d4-a716-446655440000",
"messages": [
{
"role": "system",
"content": "text"
}
],
"stream": true
}{
"id": "text",
"object": "chat.completion.chunk",
"created": 1,
"model": "text",
"system_fingerprint": "text",
"choices": [
{
"index": 1,
"delta": {
"role": "system",
"content": "text"
},
"logprobs": {},
"finish_reason": "stop"
}
]
}Last updated

