> ## Documentation Index
> Fetch the complete documentation index at: https://docs.portkey.ai/docs/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.

Portkey provides a proxy to Milvus - you can log your Milvus requests and manage auth for Qdrant clusters on Portkey.

## Portkey SDK Integration with Milvus

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

### 1. Install the Portkey SDK

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

> [tab] NodeJS
>
> ```sh theme={"system"}
> npm install --save portkey-ai
> ```

> [tab] Python
>
> ```sh theme={"system"}
> pip install portkey-ai
> ```

### 2. Create a New Integration

To use Milvus with Portkey, get your Milvus API key and create a new Milvus integration on Portkey.

> [tab] NodeJS SDK
>
> ```js theme={"system"}
> import Portkey from 'portkey-ai'
>
> const portkey = new Portkey({
>     apiKey: "PORTKEY_API_KEY", // defaults to process.env["PORTKEY_API_KEY"]
>     provider:"@PROVIDER" // Your Milvus provider slug
> })
> ```

> [tab] Python SDK
>
> ```python theme={"system"}
> from portkey_ai import Portkey
>
> portkey = Portkey(
>     api_key="PORTKEY_API_KEY",  # Replace with your Portkey API key
>     provider="@PROVIDER"   # Replace with your Milvus provider slug
> )
> ```

> [tab] OpenAI Python SDK
>
> ```python theme={"system"}
> from openai import OpenAI
>
> from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders
>
> client = OpenAI(
>     api_key="MILVUS_API_KEY",
>     base_url=PORTKEY_GATEWAY_URL,
>     default_headers=createHeaders(
>         api_key="PORTKEY_API_KEY",
>         provider="milvus",
>         custom_host="MILVUS_HOST" # Replace with your Milvus host example: https://in03-34d7b37f7ee12c7.serverless.gcp-us-west1.cloud.zilliz.com
>     )
> )
> ```

> [tab] OpenAI Node SDK
>
> ```js theme={"system"}
> import OpenAI from "openai";
>
> import { PORTKEY_GATEWAY_URL, createHeaders } from "portkey-ai";
>
> const client = new OpenAI({
>   apiKey: "MILVUS_API_KEY",
>   baseURL: PORTKEY_GATEWAY_URL,
>   defaultHeaders: createHeaders({
>     provider: "milvus",
>     apiKey: "PORTKEY_API_KEY",
>     customHost: "MILVUS_HOST" // Replace with your Milvus host example: https://in03-34d7b37f7ee12c7.serverless.gcp-us-west1.cloud.zilliz.com
>   }),
> });
> ```

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

> [tab] Python
>
> ```python theme={"system"}
> from portkey_ai import Portkey
>
> portkey = Portkey(
>     api_key="PORTKEY_API_KEY",  # Replace with your Portkey API key
>     provider="@MILVUS_PROVIDER",
>     custom_host="MILVUS_HOST" # Replace with your Milvus host example: https://in03-34d7b37f7ee12c7.serverless.gcp-us-west1.cloud.zilliz.com
> )
>
> response = portkey.post(
>     url="v2/vectordb/collections/list", # Replace with the endpoint you want to call
> )
>
> print(response)
> ```

> [tab] NodeJS
>
> ```javascript theme={"system"}
> import Portkey from 'portkey-ai';
>
> // Initialize the Portkey client
> const portkey = new Portkey({
>   apiKey: "PORTKEY_API_KEY", // Replace with your Portkey API key
>   provider:"@MILVUS_PROVIDER", // Add your Milvus provider slug
>   customHost="MILVUS_HOST" // Replace with your Milvus host example: https://in03-34d7b37f7ee12c7.serverless.gcp-us-west1.cloud.zilliz.com
> });
>
> response = portkey.post(
>     url="v2/vectordb/collections/list", # Replace with the endpoint you want to call
> )
>
> print(response)
> ```

> [tab] OpenAI NodeJS
>
> ```javascript theme={"system"}
> import OpenAI from 'openai'; // We're using the v4 SDK
> import { PORTKEY_GATEWAY_URL, createHeaders } from 'portkey-ai'
>
> const openai = new OpenAI({
>   apiKey: 'MILVUS_API_KEY', // defaults to process.env["OPENAI_API_KEY"],
>   baseURL: PORTKEY_GATEWAY_URL,
>   defaultHeaders: createHeaders({
>     provider:"@MILVUS_PROVIDER",
>     apiKey: "PORTKEY_API_KEY", // defaults to process.env["PORTKEY_API_KEY"]
>     customHost: "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] OpenAI Python
>
> ```python theme={"system"}
> from openai import OpenAI
> from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders
>
> openai = OpenAI(
>     api_key='MILVUS_API_KEY',
>     base_url=PORTKEY_GATEWAY_URL,
>     default_headers=createHeaders(
>         provider="milvus",
>         api_key="PORTKEY_API_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] cURL
>
> ```sh theme={"system"}
> curl --location --request POST 'https://api.portkey.ai/v1/v2/vectordb/collections/list' \
> --header 'x-portkey-custom-host: https://in03-34d7b37f7de12c7.serverless.gcp-us-west1.cloud.zilliz.com' \
> --header 'x-portkey-provider: MILVUS_PROVIDER' \
> --header 'x-portkey-api-key: PORTKEY_API_KEY'
> ```

***

> [card] [Portkey is now PRISMA AIRS AI Gateway. See it in action.](https://www.paloaltonetworks.in/ai-security/ai-gateway?utm_source=portkey\&utm_medium=referral\&utm_campaign=prisma_airs\&utm_content=docs_nav#contact)
>
> Contact Us


## Related topics

- [January](https://docs.portkey.ai/docs/changelog/2025/jan.md)
- [Enterprise Gateway](https://docs.portkey.ai/docs/changelog/enterprise.md)
- [Enterprise Components](https://docs.portkey.ai/docs/product/enterprise-offering/components.md)
- [Cache (Simple & Semantic)](https://docs.portkey.ai/docs/product/ai-gateway/cache-simple-and-semantic.md)
- [April](https://docs.portkey.ai/docs/changelog/2025/apr.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.