Completions
Completions V1
deprecated
Post completions v1.
POST
/
ai
/
v1
/
chat
/
completions
Post completions v1
curl --request POST \
--url https://platform.ai.gloo.com/ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"role": "user",
"content": "Hello!"
}
],
"model": "us.meta.llama3-3-70b-instruct-v1:0",
"max_tokens": 1024,
"stream": false,
"temperature": 0.7,
"tools": [],
"tool_choice": "none"
}
'import requests
url = "https://platform.ai.gloo.com/ai/v1/chat/completions"
payload = {
"messages": [
{
"role": "user",
"content": "Hello!"
}
],
"model": "us.meta.llama3-3-70b-instruct-v1:0",
"max_tokens": 1024,
"stream": False,
"temperature": 0.7,
"tools": [],
"tool_choice": "none"
}
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: [{role: 'user', content: 'Hello!'}],
model: 'us.meta.llama3-3-70b-instruct-v1:0',
max_tokens: 1024,
stream: false,
temperature: 0.7,
tools: [],
tool_choice: 'none'
})
};
fetch('https://platform.ai.gloo.com/ai/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://platform.ai.gloo.com/ai/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' => [
[
'role' => 'user',
'content' => 'Hello!'
]
],
'model' => 'us.meta.llama3-3-70b-instruct-v1:0',
'max_tokens' => 1024,
'stream' => false,
'temperature' => 0.7,
'tools' => [
],
'tool_choice' => 'none'
]),
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://platform.ai.gloo.com/ai/v1/chat/completions"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello!\"\n }\n ],\n \"model\": \"us.meta.llama3-3-70b-instruct-v1:0\",\n \"max_tokens\": 1024,\n \"stream\": false,\n \"temperature\": 0.7,\n \"tools\": [],\n \"tool_choice\": \"none\"\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://platform.ai.gloo.com/ai/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello!\"\n }\n ],\n \"model\": \"us.meta.llama3-3-70b-instruct-v1:0\",\n \"max_tokens\": 1024,\n \"stream\": false,\n \"temperature\": 0.7,\n \"tools\": [],\n \"tool_choice\": \"none\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.ai.gloo.com/ai/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 \"role\": \"user\",\n \"content\": \"Hello!\"\n }\n ],\n \"model\": \"us.meta.llama3-3-70b-instruct-v1:0\",\n \"max_tokens\": 1024,\n \"stream\": false,\n \"temperature\": 0.7,\n \"tools\": [],\n \"tool_choice\": \"none\"\n}"
response = http.request(request)
puts response.read_body{
"id": "chatcmpl-d7007d2f",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "Hello. It's nice to meet you. Is there something I can help you with or would you like to chat?",
"refusal": null,
"role": "assistant",
"annotations": null,
"audio": null,
"function_call": null,
"tool_calls": null
}
}
],
"created": 1752600200,
"model": "us.meta.llama3-3-70b-instruct-v1:0",
"object": "chat.completion",
"service_tier": null,
"system_fingerprint": "fp",
"usage": {
"completion_tokens": 25,
"prompt_tokens": 1707,
"total_tokens": 1732,
"completion_tokens_details": null,
"prompt_tokens_details": null
}
}{
"detail": "Model is required."
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}This endpoint has been deprecated. Use the Completions V2 API instead for better performance, auto-routing, and lower costs.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Messages to send to the LLM
Show child attributes
Show child attributes
Model to use for generating responses
Max tokens to use for generating responses
Required range:
x >= 1024Stream response as soon as tokens are generated by the model.
Temperature to use for generating responses
Required range:
0 <= x <= 1List of tools you want the LLM to leverage.
Show child attributes
Show child attributes
Which tool your LLM should use among the list.
Available options:
none, auto, required Response
Non-streaming successful response
The response is of type Response Post-Completions · object.
⌘I
Post completions v1
curl --request POST \
--url https://platform.ai.gloo.com/ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"role": "user",
"content": "Hello!"
}
],
"model": "us.meta.llama3-3-70b-instruct-v1:0",
"max_tokens": 1024,
"stream": false,
"temperature": 0.7,
"tools": [],
"tool_choice": "none"
}
'import requests
url = "https://platform.ai.gloo.com/ai/v1/chat/completions"
payload = {
"messages": [
{
"role": "user",
"content": "Hello!"
}
],
"model": "us.meta.llama3-3-70b-instruct-v1:0",
"max_tokens": 1024,
"stream": False,
"temperature": 0.7,
"tools": [],
"tool_choice": "none"
}
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: [{role: 'user', content: 'Hello!'}],
model: 'us.meta.llama3-3-70b-instruct-v1:0',
max_tokens: 1024,
stream: false,
temperature: 0.7,
tools: [],
tool_choice: 'none'
})
};
fetch('https://platform.ai.gloo.com/ai/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://platform.ai.gloo.com/ai/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' => [
[
'role' => 'user',
'content' => 'Hello!'
]
],
'model' => 'us.meta.llama3-3-70b-instruct-v1:0',
'max_tokens' => 1024,
'stream' => false,
'temperature' => 0.7,
'tools' => [
],
'tool_choice' => 'none'
]),
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://platform.ai.gloo.com/ai/v1/chat/completions"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello!\"\n }\n ],\n \"model\": \"us.meta.llama3-3-70b-instruct-v1:0\",\n \"max_tokens\": 1024,\n \"stream\": false,\n \"temperature\": 0.7,\n \"tools\": [],\n \"tool_choice\": \"none\"\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://platform.ai.gloo.com/ai/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello!\"\n }\n ],\n \"model\": \"us.meta.llama3-3-70b-instruct-v1:0\",\n \"max_tokens\": 1024,\n \"stream\": false,\n \"temperature\": 0.7,\n \"tools\": [],\n \"tool_choice\": \"none\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.ai.gloo.com/ai/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 \"role\": \"user\",\n \"content\": \"Hello!\"\n }\n ],\n \"model\": \"us.meta.llama3-3-70b-instruct-v1:0\",\n \"max_tokens\": 1024,\n \"stream\": false,\n \"temperature\": 0.7,\n \"tools\": [],\n \"tool_choice\": \"none\"\n}"
response = http.request(request)
puts response.read_body{
"id": "chatcmpl-d7007d2f",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "Hello. It's nice to meet you. Is there something I can help you with or would you like to chat?",
"refusal": null,
"role": "assistant",
"annotations": null,
"audio": null,
"function_call": null,
"tool_calls": null
}
}
],
"created": 1752600200,
"model": "us.meta.llama3-3-70b-instruct-v1:0",
"object": "chat.completion",
"service_tier": null,
"system_fingerprint": "fp",
"usage": {
"completion_tokens": 25,
"prompt_tokens": 1707,
"total_tokens": 1732,
"completion_tokens_details": null,
"prompt_tokens_details": null
}
}{
"detail": "Model is required."
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
