Skip to main content
POST
/
v1
/
chat
/
completions
Create Chat Completion
curl --request POST \
  --url https://llm-gateway.heurist.xyz/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "messages": [
    {
      "content": "<string>"
    }
  ],
  "max_tokens": 1024,
  "temperature": 0.5,
  "stream": false
}
'
import requests

url = "https://llm-gateway.heurist.xyz/v1/chat/completions"

payload = {
"messages": [{ "content": "<string>" }],
"max_tokens": 1024,
"temperature": 0.5,
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [{content: '<string>'}],
max_tokens: 1024,
temperature: 0.5,
stream: false
})
};

fetch('https://llm-gateway.heurist.xyz/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://llm-gateway.heurist.xyz/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'messages' => [
[
'content' => '<string>'
]
],
'max_tokens' => 1024,
'temperature' => 0.5,
'stream' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://llm-gateway.heurist.xyz/v1/chat/completions"

payload := strings.NewReader("{\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"max_tokens\": 1024,\n \"temperature\": 0.5,\n \"stream\": false\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://llm-gateway.heurist.xyz/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"max_tokens\": 1024,\n \"temperature\": 0.5,\n \"stream\": false\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://llm-gateway.heurist.xyz/v1/chat/completions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"max_tokens\": 1024,\n \"temperature\": 0.5,\n \"stream\": false\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "object": "chat.completion",
  "created": 123,
  "model": "<string>",
  "choices": [
    {
      "message": {
        "role": "assistant",
        "content": "<string>"
      },
      "index": 123
    }
  ]
}
{
"error": 123,
"message": "<string>"
}
{
"error": 123,
"message": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Chat completion request parameters

model
enum<string>
required

ID of the model to use

Available options:
hermes-3-llama3.1-8b,
meta-llama/llama-3.3-70b-instruct,
mistralai/mistral-7b-instruct,
mistralai/mixtral-8x22b-instruct,
mistralai/mixtral-8x7b-instruct,
nvidia/llama-3.1-nemotron-70b-instruct,
qwen/qwen-2.5-coder-32b-instruct
messages
object[]
required

A list of messages comprising the conversation so far

max_tokens
integer
default:1024

The maximum number of tokens to generate

Example:

1024

temperature
number<float>

Sampling temperature between 0 and 1

Required range: 0 <= x <= 1
stream
boolean
default:false

Whether to stream back partial progress

Response

Successful completion response

id
string

Unique identifier for the completion

object
enum<string>
Available options:
chat.completion
created
integer

Unix timestamp of when the completion was created

model
string

Model ID used

choices
object[]