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/assistant \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"assistant_id": "65940acff94777010aa6b796",
"conversation_id": "<string>",
"model": "glm-4-assistant",
"messages": [
{
"role": "user",
"content": "你好"
}
],
"stream": true,
"request_id": "<string>",
"user_id": "<string>",
"do_sample": true,
"attachments": [
{}
],
"metadata": {},
"extra_parameters": {
"translate": {
"from": "<string>",
"to": "<string>"
}
}
}'
{
"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,
"total_tokens": 123
}
}
与AI
助手进行对话,支持流式和同步模式。
curl --request POST \
--url https://open.bigmodel.cn/api/paas/v4/assistant \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"assistant_id": "65940acff94777010aa6b796",
"conversation_id": "<string>",
"model": "glm-4-assistant",
"messages": [
{
"role": "user",
"content": "你好"
}
],
"stream": true,
"request_id": "<string>",
"user_id": "<string>",
"do_sample": true,
"attachments": [
{}
],
"metadata": {},
"extra_parameters": {
"translate": {
"from": "<string>",
"to": "<string>"
}
}
}'
{
"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,
"total_tokens": 123
}
}
使用以下格式进行身份验证:Bearer <your api key>
业务处理成功
The response is of type object
.