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

# Milvus

[Milvus](https://milvus.io/) is an open-source vector database built for GenAI applications.
It is built to be performant and scale to tens of billions of vectors with minimal performance loss.

Obiguard provides a proxy to Milvus, allowing you to use virtual keys and observability features.

## Obiguard SDK Integration with Milvus

Obiguard provides a consistent API to interact with models from various providers. To integrate Milvus with Obiguard:

### 1. Install the Obiguard SDK

Add the Obiguard SDK to your application to interact with Milvus through Obiguard's gateway.

<Tabs>
  <Tab title="Python SDK">
    ```sh theme={null}
    pip install obiguard
    ```
  </Tab>
</Tabs>

### 2. Initialize Obiguard with a Virtual Key

To use Milvus with Obiguard, get your Milvus API key from here, then add it to Obiguard to create your [Milvus virtual key](/virtual-keys#using-virtual-keys).

<Tabs>
  <Tab title="Python SDK">
    ```python theme={null}
    from obiguard import Obiguard

    client = Obiguard(
      obiguard_api_key="vk-obg***",  # Your Obiguard virtual key
    )
    ```
  </Tab>

  <Tab title="OpenAI Python SDK">
    ```python theme={null}
    from openai import OpenAI

    from obiguard import OBIGUARD_GATEWAY_URL, createHeaders

    client = OpenAI(
      base_url=OBIGUARD_GATEWAY_URL,
      default_headers=createHeaders(
        obiguard_api_key="vk-obg***",  # Your Obiguard virtual key
        provider="milvus",
        custom_host="MILVUS_HOST" # Replace with your Milvus host example: https://in03-34d7b37f7ee12c7.serverless.gcp-us-west1.cloud.zilliz.com
      )
    )
    ```
  </Tab>
</Tabs>

### 3. Use the Obiguard SDK to interact with Milvus

<Tabs>
  <Tab title="Python SDK">
    ```python theme={null}
    from obiguard import Obiguard

    client = Obiguard(
      obiguard_api_key="vk-obg***",  # Your Obiguard virtual key
      custom_host="MILVUS_HOST" # Replace with your Milvus host example: https://in03-34d7b37f7ee12c7.serverless.gcp-us-west1.cloud.zilliz.com
    )

    response = client.post(
      url="v2/vectordb/collections/list", # Replace with the endpoint you want to call
    )

    print(response)
    ```
  </Tab>

  <Tab title="OpenAI Python">
    ```python theme={null}
    from openai import OpenAI
    from obiguard import OBIGUARD_GATEWAY_URL, createHeaders

    openai = OpenAI(
      api_key='MILVUS_API_KEY',
      base_url=OBIGUARD_GATEWAY_URL,
      default_headers=createHeaders(
        provider="milvus",
        obiguard_api_key="vk-obg***",  # Your Obiguard virtual key
        custom_host="MILVUS_HOST" # Replace with your Milvus host example: https://in03-34d7b37f7ee12c7.serverless.gcp-us-west1.cloud.zilliz.com
      )
    )

    response = openai.post(
      url="v2/vectordb/collections/list", # Replace with the endpoint you want to call
    )

    print(response)
    ```
  </Tab>

  <Tab title="cURL">
    ```sh theme={null}
    curl --location --request POST 'https://gateway.obiguard.ai/v1/v2/vectordb/collections/list' \
      -H 'x-obiguard-custom-host: https://in03-34d7b37f7de12c7.serverless.gcp-us-west1.cloud.zilliz.com' \
      -H "x-obiguard-api-key: $OBIGUARD_API_KEY" \
    ```
  </Tab>
</Tabs>
