Skip to main content
Threads

创建线程

创建一个新的线程(Thread)。

POST
/threads
cURL
curl --request POST \
  --url 'https://dashscope.aliyuncs.com/api/v1/threads' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "messages": [
    {
      "role": "user",
      "content": "你好"
    }
  ]
}
'
{
  "id": "thread_e99a9fe7-0433-426f-98ad-a5139c36579c",
  "object": "thread",
  "created_at": 1711448377850,
  "metadata": {},
  "request_id": "dd9489ec-dbdb-95d4-9ff8-cfe29b61db27"
}

Authorizations

string
header
required

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

Body

application/json
object[]

Thread 所传入的初始 message 列表。

object

与该 Thread 关联的 key/value 信息。

Response

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