Create a thread.
POST /threads
Authorizations
Request Body
object
A list of messages to start the thread with.
object
The role of the entity that is creating the message. Allowed values include:
user
: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.assistant
: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.
The text contents of the message.
An array of content parts with a defined type, each can be of type text
or images can be passed with image_url
or image_file
. Image types are only supported on Vision-compatible models.
References an image File in the content of a message.
object
Always image_file
.
object
The File ID of the image in the message content. Set purpose="vision"
when uploading the File if you need to later display the file content.
Specifies the detail level of the image if specified by the user. low
uses fewer tokens, you can opt in to high resolution using high
.
References an image URL in the content of a message.
object
The type of the content part.
object
The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.
Specifies the detail level of the image. low
uses fewer tokens, you can opt in to high resolution using high
. Default value is auto
The text content that is part of a message.
object
Always text
.
Text content to be sent to the model
A list of files attached to the message, and the tools they should be added to.
object
The ID of the file to attach to the message.
The tools to add this file to.
object
The type of tool being defined: code_interpreter
object
The type of tool being defined: file_search
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
object
A set of resources that are made available to the assistant’s tools in this thread. The resources are specific to the type of tool. For example, the code_interpreter
tool requires a list of file IDs, while the file_search
tool requires a list of vector store IDs.
object
object
A list of file IDs made available to the code_interpreter
tool. There can be a maximum of 20 files associated with the tool.
object
The vector store attached to this thread. There can be a maximum of 1 vector store attached to the thread.
A helper to create a vector store with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread.
object
A list of file IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.
The default strategy. This strategy currently uses a max_chunk_size_tokens
of 800
and chunk_overlap_tokens
of 400
.
object
Always auto
.
object
Always static
.
object
The maximum number of tokens in each chunk. The default value is 800
. The minimum value is 100
and the maximum value is 4096
.
The number of tokens that overlap between chunks. The default value is 400
.
Note that the overlap must not exceed half of max_chunk_size_tokens
.
Set of 16 key-value pairs that can be attached to a vector store. This can be useful for storing additional information about the vector store in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
object
object
The vector store attached to this thread. There can be a maximum of 1 vector store attached to the thread.
A helper to create a vector store with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread.
object
A list of file IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.
The default strategy. This strategy currently uses a max_chunk_size_tokens
of 800
and chunk_overlap_tokens
of 400
.
object
Always auto
.
object
Always static
.
object
The maximum number of tokens in each chunk. The default value is 800
. The minimum value is 100
and the maximum value is 4096
.
The number of tokens that overlap between chunks. The default value is 400
.
Note that the overlap must not exceed half of max_chunk_size_tokens
.
Set of 16 key-value pairs that can be attached to a vector store. This can be useful for storing additional information about the vector store in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
object
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
object
Responses
200
OK
Represents a thread that contains messages.
object
The identifier, which can be referenced in API endpoints.
The object type, which is always thread
.
The Unix timestamp (in seconds) for when the thread was created.
A set of resources that are made available to the assistant’s tools in this thread. The resources are specific to the type of tool. For example, the code_interpreter
tool requires a list of file IDs, while the file_search
tool requires a list of vector store IDs.
object
object
A list of file IDs made available to the code_interpreter
tool. There can be a maximum of 20 files associated with the tool.
object
The vector store attached to this thread. There can be a maximum of 1 vector store attached to the thread.
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.