Skip to main content
POST
/
messages
Create an Anthropic message
curl --request POST \
  --url https://api.sailresearch.com/v1/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "zai-org/GLM-5.2-FP8",
  "max_tokens": 300,
  "messages": [
    {
      "role": "user",
      "content": "Give me a short launch checklist for an API integration."
    }
  ]
}
'
import requests

url = "https://api.sailresearch.com/v1/messages"

payload = {
"model": "zai-org/GLM-5.2-FP8",
"max_tokens": 300,
"messages": [
{
"role": "user",
"content": "Give me a short launch checklist for an API integration."
}
]
}
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.2-FP8',
max_tokens: 300,
messages: [
{
role: 'user',
content: 'Give me a short launch checklist for an API integration.'
}
]
})
};

fetch('https://api.sailresearch.com/v1/messages', 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/messages",
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.2-FP8',
'max_tokens' => 300,
'messages' => [
[
'role' => 'user',
'content' => 'Give me a short launch checklist for an API integration.'
]
]
]),
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/messages"

payload := strings.NewReader("{\n \"model\": \"zai-org/GLM-5.2-FP8\",\n \"max_tokens\": 300,\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Give me a short launch checklist for an API integration.\"\n }\n ]\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/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"zai-org/GLM-5.2-FP8\",\n \"max_tokens\": 300,\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Give me a short launch checklist for an API integration.\"\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.sailresearch.com/v1/messages")

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.2-FP8\",\n \"max_tokens\": 300,\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Give me a short launch checklist for an API integration.\"\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "<string>",
      "cache_control": {
        "type": "ephemeral"
      }
    }
  ],
  "model": "<string>",
  "stop_sequence": "<string>",
  "usage": {
    "input_tokens": 123,
    "output_tokens": 123
  }
}
{
"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

Authorization
string
header
required

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

Headers

anthropic-idempotency-key
string

Anthropic-compatible idempotency header. Same semantics as Idempotency-Key; used on the /messages endpoint to match Anthropic's conventions.

Maximum string length: 255

Body

application/json
model
string
required
max_tokens
integer
required
Required range: x >= 1
messages
object[]
required
Minimum array length: 1
system

System prompt: a string, or an array of text blocks.

temperature
number
Required range: 0 <= x <= 1
top_p
number
Required range: 0 <= x <= 1
output_config
object
tools
object[]

Tool definitions the model may call. Responses include tool_use blocks; return outcomes as tool_result content blocks in a follow-up message.

tool_choice
object

Controls tool use: auto, any, tool, or none.

thinking
object

Extended thinking configuration; translated to the model's reasoning.

stream
boolean

When true, the response streams as Anthropic Server-Sent Events (message_start, content_block_delta, message_stop, …).

metadata
object

Optional string metadata. completion_window controls scheduling; completion_webhook/webhook_token configure completion webhooks.

context_management
object

Anthropic server-side context-editing config (Claude Code sends it automatically). Accepted for compatibility but ignored — Sail forwards the full context each turn.

Response

Anthropic-compatible message response. Returns a single JSON object by default, or an Anthropic Server-Sent Events stream when stream: true.

id
string
required
type
enum<string>
required
Available options:
message
role
enum<string>
required
Available options:
assistant
content
object[]
required
Minimum array length: 1
model
string
required
stop_reason
enum<string>
required
Available options:
end_turn,
max_tokens,
tool_use,
stop_sequence,
refusal
stop_sequence
string | null
required
usage
object
required