curl --request POST \
--url https://api.sailresearch.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "zai-org/GLM-5.3",
"messages": [
{
"role": "system",
"content": "You are a concise assistant."
},
{
"role": "user",
"content": "Summarize retrieval-augmented generation in 3 bullets."
}
],
"max_completion_tokens": 300
}
'import requests
url = "https://api.sailresearch.com/v1/chat/completions"
payload = {
"model": "zai-org/GLM-5.3",
"messages": [
{
"role": "system",
"content": "You are a concise assistant."
},
{
"role": "user",
"content": "Summarize retrieval-augmented generation in 3 bullets."
}
],
"max_completion_tokens": 300
}
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({
model: 'zai-org/GLM-5.3',
messages: [
{role: 'system', content: 'You are a concise assistant.'},
{
role: 'user',
content: 'Summarize retrieval-augmented generation in 3 bullets.'
}
],
max_completion_tokens: 300
})
};
fetch('https://api.sailresearch.com/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://api.sailresearch.com/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([
'model' => 'zai-org/GLM-5.3',
'messages' => [
[
'role' => 'system',
'content' => 'You are a concise assistant.'
],
[
'role' => 'user',
'content' => 'Summarize retrieval-augmented generation in 3 bullets.'
]
],
'max_completion_tokens' => 300
]),
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://api.sailresearch.com/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"zai-org/GLM-5.3\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a concise assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Summarize retrieval-augmented generation in 3 bullets.\"\n }\n ],\n \"max_completion_tokens\": 300\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://api.sailresearch.com/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"zai-org/GLM-5.3\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a concise assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Summarize retrieval-augmented generation in 3 bullets.\"\n }\n ],\n \"max_completion_tokens\": 300\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sailresearch.com/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 \"model\": \"zai-org/GLM-5.3\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a concise assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Summarize retrieval-augmented generation in 3 bullets.\"\n }\n ],\n \"max_completion_tokens\": 300\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "chat.completion",
"created": 123,
"model": "<string>",
"choices": [
{
"index": 123,
"message": {
"role": "assistant",
"content": "<string>",
"reasoning_content": "<string>",
"refusal": "<string>"
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"prompt_tokens_details": {},
"completion_tokens_details": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}Create a chat completion
OpenAI-compatible Chat Completions endpoint. Supports streaming via stream: true, which returns a Server-Sent Events stream of chat.completion.chunk objects.
curl --request POST \
--url https://api.sailresearch.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "zai-org/GLM-5.3",
"messages": [
{
"role": "system",
"content": "You are a concise assistant."
},
{
"role": "user",
"content": "Summarize retrieval-augmented generation in 3 bullets."
}
],
"max_completion_tokens": 300
}
'import requests
url = "https://api.sailresearch.com/v1/chat/completions"
payload = {
"model": "zai-org/GLM-5.3",
"messages": [
{
"role": "system",
"content": "You are a concise assistant."
},
{
"role": "user",
"content": "Summarize retrieval-augmented generation in 3 bullets."
}
],
"max_completion_tokens": 300
}
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({
model: 'zai-org/GLM-5.3',
messages: [
{role: 'system', content: 'You are a concise assistant.'},
{
role: 'user',
content: 'Summarize retrieval-augmented generation in 3 bullets.'
}
],
max_completion_tokens: 300
})
};
fetch('https://api.sailresearch.com/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://api.sailresearch.com/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([
'model' => 'zai-org/GLM-5.3',
'messages' => [
[
'role' => 'system',
'content' => 'You are a concise assistant.'
],
[
'role' => 'user',
'content' => 'Summarize retrieval-augmented generation in 3 bullets.'
]
],
'max_completion_tokens' => 300
]),
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://api.sailresearch.com/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"zai-org/GLM-5.3\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a concise assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Summarize retrieval-augmented generation in 3 bullets.\"\n }\n ],\n \"max_completion_tokens\": 300\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://api.sailresearch.com/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"zai-org/GLM-5.3\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a concise assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Summarize retrieval-augmented generation in 3 bullets.\"\n }\n ],\n \"max_completion_tokens\": 300\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sailresearch.com/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 \"model\": \"zai-org/GLM-5.3\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a concise assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Summarize retrieval-augmented generation in 3 bullets.\"\n }\n ],\n \"max_completion_tokens\": 300\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "chat.completion",
"created": 123,
"model": "<string>",
"choices": [
{
"index": 123,
"message": {
"role": "assistant",
"content": "<string>",
"reasoning_content": "<string>",
"refusal": "<string>"
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"prompt_tokens_details": {},
"completion_tokens_details": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Identifies one submission within your organization and API key. Reuse the same value and request body when retrying; use a new value for new work. See Idempotency.
255Completion window for this request, for clients that cannot set metadata.completion_window in the body. A window in the body takes precedence. See Completion windows.
asap, balanced, flex Body
1Show child attributes
Show child attributes
0 <= x <= 20 <= x <= 1x >= 1- Option 1
- Option 2
Show child attributes
Show child attributes
Reasoning effort for the model. max selects the same top tier as xhigh.
none, minimal, low, medium, high, xhigh, max Only n=1 is currently supported.
1 1 elementtext When true, the response is returned as a Server-Sent Events stream of chat.completion.chunk objects instead of a single JSON response.
Options that apply when stream is true.
Show child attributes
Show child attributes
Only true is supported.
true 256Optional routing hint for prompt-prefix cache locality. Requests with the same key are preferentially routed to maximize cache hit rates.
Optional string metadata. completion_window controls scheduling; completion_webhook/webhook_token configure completion webhooks; supercache_write stores a reusable prompt prefix.
Show child attributes
Show child attributes
Response
Chat completion. Returns a single JSON object by default, or a Server-Sent Events stream of chat.completion.chunk objects when stream: true (terminated by a final data: [DONE] line).