curl --request POST \ --url http://localhost:8000/v1/messages \ --header 'Content-Type: application/json' \ --data '{ "messages": [ { "content": "Hello, summarize what you can do in one sentence.", "role": "user" } ]}'
import requests
url = "http://localhost:8000/v1/messages"
payload = { "messages": [
{
"content": "Hello, summarize what you can do in one sentence.",
"role": "user"
}
] }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [{content: 'Hello, summarize what you can do in one sentence.', role: 'user'}]
})
};
fetch('http://localhost:8000/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:8000/v1/messages"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"content\": \"Hello, summarize what you can do in one sentence.\",\n \"role\": \"user\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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))
}
{ "id": "msg_4b71d12c86d94e719c7e3984a7bb7941", "type": "message", "role": "assistant", "content": [ { "type": "text", "text": "I can answer questions, generate text, and help with coding tasks." } ], "stop_reason": "end_turn", "usage": { "input_tokens": 17, "output_tokens": 14, "cache_read_input_tokens": 0 }, "model": "zai-org/GLM-5.3"}
Generate a model response from a conversation using the Anthropic Messages API format. Supports streaming, function tool calls, and extended thinking.
POST
/
v1
/
messages
Messages
curl --request POST \ --url http://localhost:8000/v1/messages \ --header 'Content-Type: application/json' \ --data '{ "messages": [ { "content": "Hello, summarize what you can do in one sentence.", "role": "user" } ]}'
import requests
url = "http://localhost:8000/v1/messages"
payload = { "messages": [
{
"content": "Hello, summarize what you can do in one sentence.",
"role": "user"
}
] }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [{content: 'Hello, summarize what you can do in one sentence.', role: 'user'}]
})
};
fetch('http://localhost:8000/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:8000/v1/messages"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"content\": \"Hello, summarize what you can do in one sentence.\",\n \"role\": \"user\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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))
}
{ "id": "msg_4b71d12c86d94e719c7e3984a7bb7941", "type": "message", "role": "assistant", "content": [ { "type": "text", "text": "I can answer questions, generate text, and help with coding tasks." } ], "stop_reason": "end_turn", "usage": { "input_tokens": 17, "output_tokens": 14, "cache_read_input_tokens": 0 }, "model": "zai-org/GLM-5.3"}
Generate a model response from a conversation using the Anthropic Messages API format. Supports streaming, function tool calls, and extended thinking.When streaming mode is used (i.e., stream option is set to true), the response is in MIME type text/event-stream. Otherwise, the content type is application/json.
You can view the schema of the streamed sequence of chunk objects in streaming mode here.
Server-side tools are not supported in the Messages API. In tools, only custom/client function tools are used; non-custom tool types are ignored.
This API is currently in Beta.
While we strive to provide a stable and reliable experience, this feature is still under active development.
As a result, you may encounter unexpected behavior or limitations.
We encourage you to provide feedback to help us improve the feature before its official release.
Tool category. If missing, empty, or custom, it is converted to a function tool. Any non-empty value other than custom is treated as a server-side tool and skipped.
Reasoning token budget. Required when type=enabled; must not be provided when type=disabled or type=adaptive. If max_tokens is set, this must be smaller than max_tokens.