GaurGaur docs

Chat endpoint

Reference for the OpenAI-compatible chat endpoint at POST /v1/api/{consumer_slug}/chat/completions.

Streams a natural-language answer over a consumer's contracts. The endpoint is OpenAI-compatible, with one important extension covered under The delta object. For a guided walkthrough, see Chat.

Request

POST /v1/api/{consumer_slug}/chat/completions
Authorization: Bearer <api_key>
Content-Type: application/json

Path parameters

ParameterTypeDescription
consumer_slugstringThe slug of the consumer. The API key must authorize this consumer, and the consumer must have the chat protocol enabled.

Body

FieldTypeRequiredDescription
modelstringYesThe model identifier for the request.
messagesarrayYesThe conversation, oldest first.

Each message:

FieldTypeDescription
rolestringuser, assistant, or system.
contentstringThe message content.
{
  "model": "gaur-nlq-v1",
  "messages": [
    { "role": "user", "content": "Show me weekly revenue trends." }
  ]
}

Response

200 OK with content type text/event-stream. The body is a server-sent events stream. Each data: line is a JSON chunk shaped like an OpenAI chat completion chunk:

{
  "id": "chatcmpl-...",
  "object": "chat.completion.chunk",
  "created": 1769000000,
  "model": "gaur-nlq-v1",
  "choices": [
    { "index": 0, "delta": { "content": "Weekly " }, "finish_reason": null }
  ]
}

The stream ends with a chunk whose finish_reason is stop, then a final data: [DONE] line.

The delta object

choices[0].delta carries the streamed content. It has two relevant fields:

FieldStandard?Description
contentYesA chunk of the agent's natural-language narrative.
gaur_eventNoA Gaur extension object carrying everything else: query results, chart suggestions, progress, and context.

gaur_event is not part of the OpenAI schema. A strict OpenAI SDK deserializes chunks into typed objects and drops unknown fields, so it will discard gaur_event and leave you with narrative text only. No result rows, no chart suggestions. Parse the SSE stream yourself, or use your SDK's extra-fields accessor, to read delta.gaur_event.

gaur_event types

Each gaur_event is an object with a type field:

typeCarries
thinkingThe agent's progress and reasoning steps.
assistantA chunk of narrative text. Also surfaced as delta.content.
dataThe query result: rows and columns.
chart_suggestionA suggested chart for the result data.
context_stateThe objects and query the agent resolved for this turn.
questionnaireClarifying questions when the agent needs more input.
errorAn error that occurred during the turn.

For an error event, the text is also mirrored into delta.content.

Status codes

StatusMeaning
200Success. The stream begins.
400Invalid request body.
401Missing or invalid API key.
403The API key does not authorize this consumer.
502The natural-language request failed downstream.
500Internal server error.

Example

curl -N -X POST https://<base-url>/v1/api/analytics-app/chat/completions \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gaur-nlq-v1",
    "messages": [{ "role": "user", "content": "Top regions by revenue this quarter" }]
  }'

See Chat for stream-handling code that reads both delta.content and delta.gaur_event.

On this page