Endpoints

Chat completions

POSThttps://api.dheep.co.za/v1/chat/completions

Parameters

NameTypeDescription
modelrequiredstringModel id, e.g. dheep-chat.
messagesrequiredarrayConversation history. Each item has a role (system | user | assistant) and content.
temperaturenumber0–2. Lower is more deterministic. Defaults to 1.
max_tokensintegerMaximum tokens to generate in the completion.
streambooleanWhen true, partial deltas are sent as server-sent events.
stopstring | arrayUp to 4 sequences where generation stops.

Request

json
{
  "model": "dheep-chat",
  "messages": [
    { "role": "system", "content": "You are a concise assistant." },
    { "role": "user", "content": "Summarise the POPIA in two sentences." }
  ],
  "temperature": 0.4,
  "max_tokens": 300
}

Response

json
{
  "id": "chatcmpl_3f9a2c",
  "object": "chat.completion",
  "created": 1735689600,
  "model": "dheep-chat",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "..." },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 42,
    "completion_tokens": 118,
    "total_tokens": 160
  }
}

The usage block is what the portal charges against your monthly allowance.

Streaming

Set stream: true to receive server-sent events. Each event contains a delta; the stream ends with data: [DONE].

text
data: {"choices":[{"delta":{"content":"The"},"index":0}]}
data: {"choices":[{"delta":{"content":" POPIA"},"index":0}]}
data: [DONE]