List runs
GEThttps:/api.openai.com/v1/threads/{thread_id}/runs
Returns a list of runs belonging to a thread.
Path parameters
thread_id
string
Required
The ID of the thread the run belongs to.
Query parameters
limit
integer
Defaults: 20
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.order
string
Defaults: desc
Sort order by the
created_at
timestamp of the objects.asc
for ascending order anddesc
for descending order.after
string
A cursor for use in pagination.
after
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.before
string
A cursor for use in pagination.
before
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
Response
A list of run objects.
Example request
1 curl https://api.openai.com/v1/threads/thread_abc123/runs \2 -H "Authorization: Bearer $OPENAI_API_KEY" \3 -H "Content-Type: application/json" \4 -H "OpenAI-Beta: assistants=v2"
Example response
1 {2 "object": "list",3 "data": [4 {5 "id": "run_abc123",6 "object": "thread.run",7 "created_at": 1699075072,8 "assistant_id": "asst_abc123",9 "thread_id": "thread_abc123",10 "status": "completed",11 "started_at": 1699075072,12 "expires_at": null,13 "cancelled_at": null,14 "failed_at": null,15 "completed_at": 1699075073,16 "last_error": null,17 "model": "gpt-4o",18 "instructions": null,19 "incomplete_details": null,20 "tools": [21 {22 "type": "code_interpreter"23 }24 ],25 "tool_resources": {26 "code_interpreter": {27 "file_ids": [28 "file-abc123",29 "file-abc456"30 ]31 }32 },33 "metadata": {},34 "usage": {35 "prompt_tokens": 123,36 "completion_tokens": 456,37 "total_tokens": 57938 },39 "temperature": 1.0,40 "top_p": 1.0,41 "max_prompt_tokens": 1000,42 "max_completion_tokens": 1000,43 "truncation_strategy": {44 "type": "auto",45 "last_messages": null46 },47 "response_format": "auto",48 "tool_choice": "auto",49 "parallel_tool_calls": true50 },51 {52 "id": "run_abc456",53 "object": "thread.run",54 "created_at": 1699063290,55 "assistant_id": "asst_abc123",56 "thread_id": "thread_abc123",57 "status": "completed",58 "started_at": 1699063290,59 "expires_at": null,60 "cancelled_at": null,61 "failed_at": null,62 "completed_at": 1699063291,63 "last_error": null,64 "model": "gpt-4o",65 "instructions": null,66 "incomplete_details": null,67 "tools": [68 {69 "type": "code_interpreter"70 }71 ],72 "tool_resources": {73 "code_interpreter": {74 "file_ids": [75 "file-abc123",76 "file-abc456"77 ]78 }79 },80 "metadata": {},81 "usage": {82 "prompt_tokens": 123,83 "completion_tokens": 456,84 "total_tokens": 57985 },86 "temperature": 1.0,87 "top_p": 1.0,88 "max_prompt_tokens": 1000,89 "max_completion_tokens": 1000,90 "truncation_strategy": {91 "type": "auto",92 "last_messages": null93 },94 "response_format": "auto",95 "tool_choice": "auto",96 "parallel_tool_calls": true97 }98 ],99 "first_id": "run_abc123",100 "last_id": "run_abc456",101 "has_more": false102 }
Built with