Skip to main content
Messages

创建消息

在指定线程中创建一条消息。

POST
/threads/{thread_id}/messages
cURL
curl --request POST \
  --url 'https://dashscope.aliyuncs.com/api/v1/threads/{thread_id}/messages' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "role": "user",
  "content": "你是谁",
  "metadata": {}
}
'
{
  "id": "message_f1933671-19e1-4162-ad25-7326165123e1",
  "object": "thread.message",
  "created_at": 1711508433283,
  "thread_id": "thread_e99a9fe7-0433-426f-98ad-a5139c36579c",
  "incomplete_details": {},
  "completed_at": null,
  "incomplete_at": null,
  "assistant_id": "",
  "run_id": "",
  "file_ids": [],
  "role": "user",
  "content": [
    {
      "type": "text",
      "text": {
        "value": "你是谁",
        "annotations": []
      }
    }
  ],
  "metadata": {},
  "name": "",
  "plugin_call": {},
  "tool_calls": [],
  "status": "",
  "request_id": "b3ad40b9-f052-9665-a064-dab11c34625f"
}

Authorizations

string
header
required

DashScope API Key,在控制台 API Key 页面(https://bailian.console.aliyun.com/settings/apikey)获取。请求头格式:Authorization: Bearer $DASHSCOPE_API_KEY。

Path Parameters

string
required

message 所传入的 thread ID。

Body

application/json
string
required

message 的具体信息。

string

传入信息的角色。目前只支持 role = "user"。

object

其他相关信息。

Response

200-application/json
Managed Agent API
Flow Agent API
RAG API
Connector API
框架集成
  • 框架
Assistant API(下线中)