v6

latestSwagger 2.02026-07-1340109191.2 KB

Creates a new assistant thread and immediately starts a run using that new thread.

post/threads/runs

Request body

assistant_idstring required

The ID of the assistant for which the thread should be created.

modelstring nullable

The overridden model that the assistant should use to run the thread.

instructionsstring nullable

The overridden system instructions the assistant should use to run the thread.

parallel_tool_callsboolean

Whether to enable parallel function calling during tool use.

streamboolean

If true, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a data: [DONE] message.

temperaturenumber float nullable

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.

top_pnumber float nullable

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

We generally recommend altering this or temperature but not both.

max_prompt_tokensinteger nullable

The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status incomplete. See incomplete_details for more info.

max_completion_tokensinteger nullable

The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status incomplete. See incomplete_details for more info.

{"stackTrail":"components:schemas:AssistantsApiToolChoiceOption","oasType":"schema","type":"unknown"}
{"stackTrail":"components:schemas:AssistantsApiResponseFormatOption","oasType":"schema","type":"unknown"}
metadataobject nullable

A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.

Response

Information about the newly created thread.

idstring required

The identifier, which can be referenced in API endpoints.

object'thread.run' required

The object type, which is always 'thread.run'.

thread_idstring required

The ID of the thread associated with this run.

assistant_idstring required

The ID of the assistant associated with the thread this run was performed against.

status'queued' | 'in_progress' | 'requires_action' | 'cancelling' | 'cancelled' | 'failed' | 'completed' | 'expired' required

Possible values for the status of an assistant thread run.

modelstring required

The ID of the model to use.

instructionsstring required

The overridden system instructions used for this assistant thread run.

created_atinteger required

The Unix timestamp, in seconds, representing when this object was created.

expires_atinteger nullable required

The Unix timestamp, in seconds, representing when this item expires.

started_atinteger nullable required

The Unix timestamp, in seconds, representing when this item was started.

completed_atinteger nullable required

The Unix timestamp, in seconds, representing when this completed.

cancelled_atinteger nullable required

The Unix timestamp, in seconds, representing when this was cancelled.

failed_atinteger nullable required

The Unix timestamp, in seconds, representing when this failed.

incomplete_details'max_completion_tokens' | 'max_prompt_tokens' required

The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run.

temperaturenumber float nullable

The sampling temperature used for this run. If not set, defaults to 1.

top_pnumber float nullable

The nucleus sampling value used for this run. If not set, defaults to 1.

max_prompt_tokensinteger nullable required

The maximum number of prompt tokens specified to have been used over the course of the run.

max_completion_tokensinteger nullable required

The maximum number of completion tokens specified to have been used over the course of the run.

{"stackTrail":"components:schemas:AssistantsApiToolChoiceOption","oasType":"schema","type":"unknown"}
parallel_tool_callsboolean required

Whether to enable parallel function calling during tool use.

{"stackTrail":"components:schemas:AssistantsApiResponseFormatOption","oasType":"schema","type":"unknown"}
metadataobject nullable required

A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.