Create Chat Completion

post

Generates a model response for the given chat conversation.

Authorizations
AuthorizationstringRequired

Bearer token authentication. Use format "Bearer your-api-key"

Body
modelstringRequired

ID of the model to use.

Example: dmind/dmind-1
streamboolean | nullableOptional

If set, partial message deltas will be sent.

Default: false
max_tokensinteger | nullableOptional

The maximum number of tokens to generate in the chat completion.

Example: 16384
temperaturenumber | nullableOptional

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.

Default: 1Example: 0.6
top_pnumber | nullableOptional

An alternative to sampling with temperature, called nucleus sampling. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

Default: 1Example: 0.95
top_kinteger | nullableOptional

Limits the number of tokens to consider for each step. Use -1 for no limit.

Default: -1Example: -1
min_pnumber | nullableOptional

Minimum probability threshold for token sampling. Tokens with probability below this threshold are filtered out.

Default: 0Example: 0.1
frequency_penaltynumber | nullableOptional

Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.

Default: 0Example: 0
presence_penaltynumber | nullableOptional

Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.

Default: 0Example: 0
stopone of | nullableOptional

Up to 4 sequences where the API will stop generating further tokens.

stringOptional
or
string[]Optional
tool_choiceone of | nullableOptional

Controls which (if any) tool is called by the model.

string · enumOptionalPossible values:
or
logprobsboolean | nullableOptional

Whether to return log probabilities of the output tokens.

Default: false
top_logprobsinteger | nullableOptional

How many log probabilities to return per token.

Responses
200

OK

post
/v1/chat/completions
POST /v1/chat/completions HTTP/1.1
Host: brainchat.dmind.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 203

{
  "model": "dmind/dmind-1",
  "messages": [
    {
      "role": "user",
      "content": "hello"
    }
  ],
  "stream": false,
  "temperature": 0.6,
  "top_p": 0.95,
  "top_k": -1,
  "min_p": 0.1,
  "frequency_penalty": 0,
  "presence_penalty": 0,
  "max_tokens": 16384
}
{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1702685778,
  "model": "dmind/dmind-1",
  "system_fingerprint": "fp_44709d6fcb",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I assist you today?",
        "tool_calls": [
          {
            "id": "text",
            "type": "function",
            "function": {
              "name": "text",
              "arguments": "text"
            }
          }
        ]
      },
      "logprobs": {
        "content": [
          {
            "token": "text",
            "logprob": 1,
            "bytes": [
              1
            ],
            "top_logprobs": [
              {
                "token": "text",
                "logprob": 1,
                "bytes": [
                  1
                ]
              }
            ]
          }
        ]
      },
      "finish_reason": "stop"
    }
  ],
  "prompt_logprobs": {
    "content": [
      {
        "token": "text",
        "logprob": 1,
        "bytes": [
          1
        ]
      }
    ],
    "top_logprobs": []
  },
  "usage": {
    "prompt_tokens": 1,
    "completion_tokens": 1,
    "total_tokens": 1,
    "prompt_tokens_details": "text"
  }
}

Last updated