创建 GLM-5.3 对话补全
curl --request POST \
--url https://www.anyfast.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "glm-5.3",
"messages": [
{
"role": "user",
"content": "Reply with exactly OK."
}
],
"max_tokens": 128
}
'import requests
url = "https://www.anyfast.ai/v1/chat/completions"
payload = {
"model": "glm-5.3",
"messages": [
{
"role": "user",
"content": "Reply with exactly OK."
}
],
"max_tokens": 128
}
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: 'glm-5.3',
messages: [{role: 'user', content: 'Reply with exactly OK.'}],
max_tokens: 128
})
};
fetch('https://www.anyfast.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://www.anyfast.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([
'model' => 'glm-5.3',
'messages' => [
[
'role' => 'user',
'content' => 'Reply with exactly OK.'
]
],
'max_tokens' => 128
]),
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://www.anyfast.ai/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"glm-5.3\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Reply with exactly OK.\"\n }\n ],\n \"max_tokens\": 128\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://www.anyfast.ai/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"glm-5.3\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Reply with exactly OK.\"\n }\n ],\n \"max_tokens\": 128\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.anyfast.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 \"model\": \"glm-5.3\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Reply with exactly OK.\"\n }\n ],\n \"max_tokens\": 128\n}"
response = http.request(request)
puts response.read_body{
"id": "20260819113252725deddc07234b73",
"object": "chat.completion",
"created": 1787110376,
"model": "glm-5.3",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"reasoning_content": "用户要求只返回一个简短的固定结果,因此最终回答应为 OK。",
"content": "OK"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 17,
"completion_tokens": 91,
"completion_tokens_details": {
"reasoning_tokens": 88
},
"prompt_tokens_details": {
"cached_tokens": 0
},
"total_tokens": 108
}
}{
"error": {
"message": "该模型始终思考,不支持关闭思考;请使用 low、high 或 max。",
"type": "upstream_error",
"param": "",
"code": "1210"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"type": "<string>",
"param": "<string>"
}
}Zhipu
glm-5.3
根据对话消息生成 GLM-5.3 响应。GLM-5.3 始终开启思考;thinking.type 只能为 enabled,reasoning_effort 只能为 low、high 或 max。
POST
/
v1
/
chat
/
completions
创建 GLM-5.3 对话补全
curl --request POST \
--url https://www.anyfast.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "glm-5.3",
"messages": [
{
"role": "user",
"content": "Reply with exactly OK."
}
],
"max_tokens": 128
}
'import requests
url = "https://www.anyfast.ai/v1/chat/completions"
payload = {
"model": "glm-5.3",
"messages": [
{
"role": "user",
"content": "Reply with exactly OK."
}
],
"max_tokens": 128
}
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: 'glm-5.3',
messages: [{role: 'user', content: 'Reply with exactly OK.'}],
max_tokens: 128
})
};
fetch('https://www.anyfast.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://www.anyfast.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([
'model' => 'glm-5.3',
'messages' => [
[
'role' => 'user',
'content' => 'Reply with exactly OK.'
]
],
'max_tokens' => 128
]),
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://www.anyfast.ai/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"glm-5.3\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Reply with exactly OK.\"\n }\n ],\n \"max_tokens\": 128\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://www.anyfast.ai/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"glm-5.3\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Reply with exactly OK.\"\n }\n ],\n \"max_tokens\": 128\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.anyfast.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 \"model\": \"glm-5.3\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Reply with exactly OK.\"\n }\n ],\n \"max_tokens\": 128\n}"
response = http.request(request)
puts response.read_body{
"id": "20260819113252725deddc07234b73",
"object": "chat.completion",
"created": 1787110376,
"model": "glm-5.3",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"reasoning_content": "用户要求只返回一个简短的固定结果,因此最终回答应为 OK。",
"content": "OK"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 17,
"completion_tokens": 91,
"completion_tokens_details": {
"reasoning_tokens": 88
},
"prompt_tokens_details": {
"cached_tokens": 0
},
"total_tokens": 108
}
}{
"error": {
"message": "该模型始终思考,不支持关闭思考;请使用 low、high 或 max。",
"type": "upstream_error",
"param": "",
"code": "1210"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"type": "<string>",
"param": "<string>"
}
}授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
请求体
application/json
模型 ID,必须为 glm-5.3。
可用选项:
glm-5.3 示例:
"glm-5.3"
按时间顺序排列的完整对话消息。
Minimum array length:
1Show child attributes
Show child attributes
示例:
[
{
"role": "system",
"content": "你是一名资深软件工程师。"
},
{
"role": "user",
"content": "请设计一个可靠的分布式任务队列。"
}
]
省略此字段时仍默认开启思考;GLM-5.3 不接受 disabled。
Show child attributes
Show child attributes
推理强度:low 为轻量推理,high 为增强推理,max 为深度推理。
可用选项:
low, high, max 为 true 时通过 SSE 流式返回响应增量。
是否启用采样;为 false 时忽略 temperature 和 top_p。
采样温度。通常只调整 temperature 或 top_p 其中一个。
必填范围:
0 <= x <= 1示例:
1
核采样阈值,AnyFast 接受 0 到 1。
必填范围:
0 <= x <= 1示例:
0.95
最大生成 Token 数,智谱建议不小于 1024。
必填范围:
1 <= x <= 131072开启流式响应时,是否流式返回 Function Call。
模型可使用的 Function 或 MCP 工具定义。
Show child attributes
Show child attributes
工具选择策略。
可用选项:
auto 最多四个停止词。
Maximum array length:
4选择普通文本或 JSON 对象输出。
Show child attributes
Show child attributes
客户端提供的唯一请求 ID。
Required string length:
6 - 64不含敏感信息的终端用户标识。
Required string length:
6 - 128此页面对您有帮助吗?
⌘I