创建线程并运行
开发中
POST
https://oapi.czl.net/v1/threads/runs
请求参数
Authorization
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token示例:
Authorization: Bearer ********************
Body 参数application/json
assistant_id
string
必需
thread
object
必需
messages
array [object {4}]
可选
metadata
object
可选
model
string
可选
instructions
string
可选
tools
array[string]
可选
metadata
string
可选
示例
{
"assistant_id": "asst_IgmpQTah3ZfPHCVZjTqAY8Kv",
"thread": {
"messages": [
{
"role": "user",
"content": "Explain deep learning to a 5 year old."
}
]
}
}
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://oapi.czl.net/v1/threads/runs' \
--header 'Content-Type: application/json' \
--data-raw '{
"assistant_id": "asst_IgmpQTah3ZfPHCVZjTqAY8Kv",
"thread": {
"messages": [
{"role": "user", "content": "Explain deep learning to a 5 year old."}
]
}
}'
返回响应
🟢200成功
application/json
Body
id
string
必需
object
string
必需
created_at
integer
必需
assistant_id
string
必需
thread_id
string
必需
status
string
必需
started_at
null
必需
expires_at
integer
必需
cancelled_at
null
必需
failed_at
null
必需
completed_at
null
必需
last_error
null
必需
model
string
必需
instructions
string
必需
tools
array[string]
必需
file_ids
array[string]
必需
metadata
object
必需
示例
{
"id": "run_3Qudf05GGhCleEg9ggwfJQih",
"object": "thread.run",
"created_at": 1699076792,
"assistant_id": "asst_IgmpQTah3ZfPHCVZjTqAY8Kv",
"thread_id": "thread_Ec3eKZcWI00WDZRC7FZci8hP",
"status": "queued",
"started_at": null,
"expires_at": 1699077392,
"cancelled_at": null,
"failed_at": null,
"completed_at": null,
"last_error": null,
"model": "gpt-4",
"instructions": "You are a helpful assistant.",
"tools": [],
"file_ids": [],
"metadata": {}
}
修改于 2024-01-08 06:38:13