How to list all threads in Azure OpenAI Assistant

Wang, Zheng 65 Reputation points
2024-03-25T19:27:46.68+00:00

From the documentation, I have seen that we can retrieve the thread information given the thread_id.
GET https://YOUR_RESOURCE_NAME.openai.azure.com/openai/threads/{thread_id}?api-version=2024-02-15-preview
But if we don't know the thread_id, how to list all the threads under this resource.

In OpenAI, I can see some solution to GET https://api.openai.com/v1/threads/

Any way to do that through Azure OpenAI API?

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
4,080 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Mohamed Hussein 710 Reputation points
    2024-11-18T01:13:36.3433333+00:00

    Following is working for me

    https://{{YourEndPoint}}.openai.azure.com/openai/threads?api-version=2024-05-01-preview

    User's image

    1 person found this answer helpful.
    0 comments No comments

  2. Aron D. Jacobsen (ADJ) 0 Reputation points
    2025-01-27T14:49:24.6233333+00:00

    This works for me:

    import requests
    
    endpoint = f"{AZURE_ENDPOINT}/openai/threads"
    
    # Define the headers
    headers = {
        'api-key': AZURE_API_KEY,
        'Content-Type': 'application/json',
    }
    
    # Define the parameters
    params = {
        'api-version': '2024-08-01-preview',
    }
    
    # Make the GET request
    response = requests.get(endpoint, headers=headers, params=params)
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.