Authorizations
使用以下格式进行身份验证:Bearer <your api key>
Body
application/json
普通对话模型请求,支持纯文本对话和工具调用
Response
业务处理成功
The response is of type object
.
curl --request POST \
--url https://open.bigmodel.cn/api/paas/v4/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "glm-4.5",
"messages": [
{
"role": "system",
"content": "你是一个有用的AI助手。"
},
{
"role": "user",
"content": "请介绍一下人工智能的发展历程。"
}
],
"temperature": 0.6,
"max_tokens": 1024,
"stream": false
}'
{
"id": "<string>",
"request_id": "<string>",
"created": 123,
"model": "<string>",
"choices": [
{
"index": 123,
"message": {
"role": "assistant",
"content": "<string>",
"reasoning_content": "<string>",
"audio": {
"id": "<string>",
"data": "<string>",
"expires_at": "<string>"
},
"tool_calls": [
{
"function": {
"name": "<string>",
"arguments": {}
},
"mcp": {
"id": "<string>",
"type": "mcp_list_tools",
"server_label": "<string>",
"error": "<string>",
"tools": [
{
"name": "<string>",
"description": "<string>",
"annotations": {},
"input_schema": {
"type": "object",
"properties": {},
"required": [
"<any>"
],
"additionalProperties": true
}
}
],
"arguments": "<string>",
"name": "<string>",
"output": {}
},
"id": "<string>",
"type": "<string>"
}
]
},
"finish_reason": "<string>"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"prompt_tokens_details": {
"cached_tokens": 123
},
"total_tokens": 123
},
"video_result": [
{
"url": "<string>",
"cover_image_url": "<string>"
}
],
"web_search": [
{
"icon": "<string>",
"title": "<string>",
"link": "<string>",
"media": "<string>",
"publish_date": "<string>",
"content": "<string>",
"refer": "<string>"
}
],
"content_filter": [
{
"role": "<string>",
"level": 123
}
]
}
和 指定模型 对话,模型根据请求给出响应。支持多种模型,支持多模态(文本、图片、音频、视频、文件),流式和非流式输出,可配置采样,温度,最大令牌数,工具调用等。
curl --request POST \
--url https://open.bigmodel.cn/api/paas/v4/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "glm-4.5",
"messages": [
{
"role": "system",
"content": "你是一个有用的AI助手。"
},
{
"role": "user",
"content": "请介绍一下人工智能的发展历程。"
}
],
"temperature": 0.6,
"max_tokens": 1024,
"stream": false
}'
{
"id": "<string>",
"request_id": "<string>",
"created": 123,
"model": "<string>",
"choices": [
{
"index": 123,
"message": {
"role": "assistant",
"content": "<string>",
"reasoning_content": "<string>",
"audio": {
"id": "<string>",
"data": "<string>",
"expires_at": "<string>"
},
"tool_calls": [
{
"function": {
"name": "<string>",
"arguments": {}
},
"mcp": {
"id": "<string>",
"type": "mcp_list_tools",
"server_label": "<string>",
"error": "<string>",
"tools": [
{
"name": "<string>",
"description": "<string>",
"annotations": {},
"input_schema": {
"type": "object",
"properties": {},
"required": [
"<any>"
],
"additionalProperties": true
}
}
],
"arguments": "<string>",
"name": "<string>",
"output": {}
},
"id": "<string>",
"type": "<string>"
}
]
},
"finish_reason": "<string>"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"prompt_tokens_details": {
"cached_tokens": 123
},
"total_tokens": 123
},
"video_result": [
{
"url": "<string>",
"cover_image_url": "<string>"
}
],
"web_search": [
{
"icon": "<string>",
"title": "<string>",
"link": "<string>",
"media": "<string>",
"publish_date": "<string>",
"content": "<string>",
"refer": "<string>"
}
],
"content_filter": [
{
"role": "<string>",
"level": 123
}
]
}
使用以下格式进行身份验证:Bearer <your api key>
普通对话模型请求,支持纯文本对话和工具调用
业务处理成功
The response is of type object
.