Playground chat completion
curl --request POST \
--url https://ai.liara.ir/api/v1/{workspaceID}/playground/chat/completions \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"messages": [
{
"content": "<string>"
}
],
"stream": false,
"temperature": 123,
"max_tokens": 123,
"tools": [
{}
]
}
'import requests
url = "https://ai.liara.ir/api/v1/{workspaceID}/playground/chat/completions"
payload = {
"model": "<string>",
"messages": [{ "content": "<string>" }],
"stream": False,
"temperature": 123,
"max_tokens": 123,
"tools": [{}]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
messages: [{content: '<string>'}],
stream: false,
temperature: 123,
max_tokens: 123,
tools: [{}]
})
};
fetch('https://ai.liara.ir/api/v1/{workspaceID}/playground/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://ai.liara.ir/api/v1/{workspaceID}/playground/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([
'model' => '<string>',
'messages' => [
[
'content' => '<string>'
]
],
'stream' => false,
'temperature' => 123,
'max_tokens' => 123,
'tools' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://ai.liara.ir/api/v1/{workspaceID}/playground/chat/completions"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"stream\": false,\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"tools\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://ai.liara.ir/api/v1/{workspaceID}/playground/chat/completions")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"stream\": false,\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"tools\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ai.liara.ir/api/v1/{workspaceID}/playground/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"stream\": false,\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"tools\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{}This response has no body data.This response has no body data.This response has no body data.This response has no body data.Playground Chat
Playground chat completion
Creates a chat completion in the playground. Requires ai.operate or ai.manage permission.
Uses the same request/response format as the API key chat completion endpoint.
POST
/
api
/
v1
/
{workspaceID}
/
playground
/
chat
/
completions
Playground chat completion
curl --request POST \
--url https://ai.liara.ir/api/v1/{workspaceID}/playground/chat/completions \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"messages": [
{
"content": "<string>"
}
],
"stream": false,
"temperature": 123,
"max_tokens": 123,
"tools": [
{}
]
}
'import requests
url = "https://ai.liara.ir/api/v1/{workspaceID}/playground/chat/completions"
payload = {
"model": "<string>",
"messages": [{ "content": "<string>" }],
"stream": False,
"temperature": 123,
"max_tokens": 123,
"tools": [{}]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
messages: [{content: '<string>'}],
stream: false,
temperature: 123,
max_tokens: 123,
tools: [{}]
})
};
fetch('https://ai.liara.ir/api/v1/{workspaceID}/playground/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://ai.liara.ir/api/v1/{workspaceID}/playground/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([
'model' => '<string>',
'messages' => [
[
'content' => '<string>'
]
],
'stream' => false,
'temperature' => 123,
'max_tokens' => 123,
'tools' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://ai.liara.ir/api/v1/{workspaceID}/playground/chat/completions"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"stream\": false,\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"tools\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://ai.liara.ir/api/v1/{workspaceID}/playground/chat/completions")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"stream\": false,\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"tools\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ai.liara.ir/api/v1/{workspaceID}/playground/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"stream\": false,\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"tools\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{}This response has no body data.This response has no body data.This response has no body data.This response has no body data.Authorizations
Enter the token with the Bearer: prefix, e.g. "Bearer abcde12345"
Path Parameters
The workspace ID
Pattern:
^[a-f0-9]{24}$Body
application/json
Response
Successful response (non-streaming)
The response is of type object.
⌘I
