Create thread and run (v1)
POST
https://api.openai.com/v1/threads/runsCreate a thread and run it in one request.
Request
Header Params
Authorization
string
required
Example:
Bearer $OPENAI_API_KEY
Content-Type
string
required
Example:
application/json
OpenAI-Beta
string
required
Example:
assistants=v1
Example
{
"assistant_id": "asst_abc123",
"thread": {
"messages": [
{
"role": "user",
"content": "Explain deep learning to a 5 year old."
}
]
}
}
Request samples
Responses
Success(200)
HTTP Code: 200
Content Type : JSONapplication/json
Data Schema
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
usage
null
required
temperature
integer
required
Example
{
"id": "run_abc123",
"object": "thread.run",
"created_at": 1699076792,
"assistant_id": "asst_abc123",
"thread_id": "thread_abc123",
"status": "queued",
"started_at": null,
"expires_at": 1699077392,
"cancelled_at": null,
"failed_at": null,
"completed_at": null,
"last_error": null,
"model": "gpt-4-turbo",
"instructions": "You are a helpful assistant.",
"tools": [],
"file_ids": [],
"metadata": {},
"usage": null,
"temperature": 1
}
Last modified: a month ago