{
"model": "glm-5.2",
"max_tokens": 1024,
"tools": [
{
"name": "get_weather",
"description": "获取指定城市的天气信息",
"input_schema": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "城市名称"
}
},
"required": [
"city"
]
}
}
],
"messages": [
{
"role": "user",
"content": "杭州今天天气怎么样?"
}
]
}curl --location '/v1/messages' \
--header 'Authorization: {{YOUR API KEY}}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"model": "glm-5.2",
"max_tokens": 1024,
"tools": [
{
"name": "get_weather",
"description": "获取指定城市的天气信息",
"input_schema": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "城市名称"
}
},
"required": [
"city"
]
}
}
],
"messages": [
{
"role": "user",
"content": "杭州今天天气怎么样?"
}
]
}'{
"id": "msg_e2898f19-fc0e-4cb3-bd9b-5b7dc4ea3bc9",
"type": "message",
"role": "assistant",
"model": "glm-5.2",
"content": [
{
"type": "thinking",
"thinking": "让我分析一下这个问题...",
"signature": ""
},
{
"type": "text",
"text": "你好!我是通义千问..."
}
],
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {
"input_tokens": 22,
"output_tokens": 223,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0
}
}