POST

/v1/chat/completions

Creates a model response for the given chat conversation.


Request Body

modelstring, required

ID of the model to use. See Model Endpoint compatibility.

messagesarray, required

A list of messages comprising the conversation so far.

[{ "role": "user", "content": "Hello" }]
temperaturenumber, optional

What sampling temperature to use, between 0 and 2. Defaults to 1.

Response Format

{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677652288,
  "model": "sastra-v1",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "Hello there, how may I assist you today?"
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 9,
    "completion_tokens": 12,
    "total_tokens": 21
  }
}