Skip to main content
This feature is currently marked as a “Beta” by OpenAI. Make sure to check our their How Assistants Work and Assistants Overview guides.

Assistants

Build assistants that can call models and use tools to perform tasks. Official OpenAI docs

create()

Create an assistant with a model and instructions. Official OpenAI Docs
example.ts

update()

Update an assistant. Official OpenAI Docs
example.ts

list()

List assistants. Official OpenAI Docs
example.ts

retrieve()

Retrieve an assistant. Official OpenAI Docs
example.ts

del()

Delete an assistant. Official OpenAI Docs
example.ts

Threads

Create threads that assistants can interact with. Official OpenAI docs

create()

Create a thread. Official OpenAI Docs
example.ts

createAndRun()

Create a thread and run it in one task.
example.ts

createAndRunUntilCompletion()

Create a thread and runs it in one task, and only returns when the run is completed by polling in the background using io.backgroundPoll().
example.ts

retrieve()

Retrieves a thread. Official OpenAI Docs
example.ts

update()

Modifies a thread. Official OpenAI Docs
example.ts

del()

Deletes a thread. Official OpenAI Docs
example.ts

Messages

Create messages within threads. Official OpenAI docs

list()

List messages in a thread.
example.ts
If you want to list all messages in a thread, you can use the listAll() helper:
example.ts
This will automatically paginate through all messages in the thread and return them as a single array.

create()

Create a message. Official OpenAI Docs
example.ts

retrieve()

Retrieve a message. Official OpenAI Docs
example.ts

update()

Update a message. Official OpenAI Docs
example.ts

Runs

Represents an execution run on a thread. Official OpenAI docs

list()

List all runs belonging to a thread.
example.ts

create()

Create a run. Official OpenAI Docs
example.ts

createAndWaitForCompletion()

Create a run and only return when the run is completed by polling in the background using io.backgroundPoll().
example.ts

waitForCompletion()

Wait for a run to complete by polling in the background using io.backgroundPoll().
example.ts

retrieve()

Retrieve a run. Official OpenAI Docs
example.ts

cancel()

Cancels a run that is in_progress. Official OpenAI Docs
example.ts

submitToolOutputs()

When a run has the status: "requires_action" and required_action.type is submit_tool_outputs, this endpoint can be used to submit the outputs from the tool calls once they’re all completed. All outputs must be submitted in a single request. Official OpenAI Docs
example.ts

list()

Returns all runs belonging to a thread. Official OpenAI Docs
example.ts