> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nebuly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI Assistants

The Nebuly SDK enables you to monitor all the requests made to the Assistants you have created using the OpenAI SDK or on the OpenAI platform.

### Assistant

In the code snippet below, we assume that you have already created an Assistant following the [OpenAI documentation](https://platform.openai.com/docs/assistants/overview/step-1-create-an-assistant). You can find your Assistant ID on your dedicated page on [OpenAI platform](https://platform.openai.com/assistants).

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    import nebuly
    nebuly.init(api_key="<YOUR_NEBULY_API_KEY>")

    import time
    import openai

    assistant_id = "<YOUR_ASSISTANT_ID>"

    client = openai.OpenAI(api_key="<YOUR_OPENAI_KEY>")

    assistant = client.beta.assistants.retrieve(assistant_id)

    # create new thread
    thread = client.beta.threads.create()

    # add message to thread
    message = client.beta.threads.messages.create(
        thread_id=thread.id,
        role="user",
        content="I need to solve the equation `3x + 11 = 14`. Can you help me?"
    )
    run = client.beta.threads.runs.create(
      thread_id=thread.id,
      assistant_id=assistant.id,
      instructions="Please address the user as Jane Doe. The user has a premium account."
    )

    while run.status != "completed":
        run = client.beta.threads.runs.retrieve(
            thread_id=thread.id,
            run_id=run.id
        )
        time.sleep(1)

    messages = client.beta.threads.messages.list(
      thread_id=thread.id,
      # Nebuly additional kwargs
      user_id="<USER_ID>"
    )
    ```
  </Tab>
</Tabs>

You can find a detailed explanation of the allowed nebuly additional keyword arguments below:

<ParamField path="user_id" type="string" required>
  An id or username uniquely identifying the end-user. We recommend hashing their username or email address, in order to avoid sending us any identifying information.
</ParamField>

<ParamField path="nebuly_tags" type="dict">
  Tag user interactions by adding key-value pairs using this parameter. Each key represents the tag name, and the corresponding value is the tag value.

  For example, if you want to tag an interaction with the model version used to reply to user input, provide it as an argument for nebuly\_tags, e.g. `{"version": "v1.0.0"}`. You have the flexibility to define custom tags, making them available as potential filters on the Nebuly platform.
</ParamField>

<ParamField path="nebuly_api_key" type="string">
  You can use this field to temporarily override the Nebuly API key for the selected model call. The interaction will be stored in the project associated with the provided API key.
</ParamField>
