- 起步
- 介绍
- 导言
- 身份验证
- 发出请求
- 参数详情
- 音频(Audio)
- 聊天(Chat)
- 自动补全(Completions)
- 嵌入(Embeddings)
- 微调(Fine-tuning)
- 图像(Images)
- 模型(Models)
- 文件(Files)
- 审查(Moderations)
- 助手测试版(AssistantsBeta)
- 线程数(Threads)
- 留言(Messages)
- 运行(Runs)
- 已弃用-音频(Audio)
- English
- Authentication
- Making requests
- Streaming
- Debugging requests
- Backward compatibility
- Administration
- Introduction
- Batch
- Models
- Invites
- Chat
- Users
- Projects
- Project users
- Project service accounts
- Project API keys
- Audit logs
- Usage
- Project rate limits
- Completions
- Uploads
- Images
- Embeddings
- Audio
- Files
- Fine-tuning
- Moderations
- Assistants (v1)
- Threads (v1)
- Messages (v1)
- Runs (v1)
创建线程并运行
POST
https://api.openai.com/v1/threads/runs
Request
Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.Example:
Authorization: Bearer ********************
Body Params application/json
assistant_id
string
required
thread
object
required
messages
array [object {4}]
optional
metadata
object
optional
model
string
optional
instructions
string
optional
tools
array[string]
optional
metadata
string
optional
Example
{
"assistant_id": "asst_IgmpQTah3ZfPHCVZjTqAY8Kv",
"thread": {
"messages": [
{
"role": "user",
"content": "Explain deep learning to a 5 year old."
}
]
}
}
Request samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.openai.com/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."}
]
}
}'
Responses
🟢200成功
application/json
Body
id
string
required
object
string
required
created_at
integer
required
assistant_id
string
required
thread_id
string
required
status
string
required
started_at
null
required
expires_at
integer
required
cancelled_at
null
required
failed_at
null
required
completed_at
null
required
last_error
null
required
model
string
required
instructions
string
required
tools
array[string]
required
file_ids
array[string]
required
metadata
object
required
Example
{
"id": "string",
"object": "string",
"created_at": 0,
"assistant_id": "string",
"thread_id": "string",
"status": "string",
"started_at": null,
"expires_at": 0,
"cancelled_at": null,
"failed_at": null,
"completed_at": null,
"last_error": null,
"model": "string",
"instructions": "string",
"tools": [
"string"
],
"file_ids": [
"string"
],
"metadata": {}
}
Modified at 2024-12-13 09:12:13