> ## 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.

# MindsDB

> Integrate MindsDB with Portkey for production-grade AI pipelines

MindsDB connects data sources and LLMs for AI automation. Portkey adds:

* **1600+ LLMs** — Access any provider through MindsDB
* **Observability** — Track costs, latency, and usage
* **Reliability** — Caching, routing, guardrails via [Configs](https://docs.portkey.ai/docs/product/ai-gateway/configs.md)

## Prerequisites

1. Install MindsDB via [Docker](https://docs.mindsdb.com/setup/self-hosted/docker) or [Docker Desktop](https://docs.mindsdb.com/setup/self-hosted/docker-desktop)
2. Install Portkey dependencies per [MindsDB instructions](https://docs.mindsdb.com/setup/self-hosted/docker#install-dependencies)
3. Get your [Portkey API key](https://app.portkey.ai/api-keys)

## Setup

**1. Create AI Engine**

```sql Using Config ID theme={"system"}
CREATE ML_ENGINE portkey_engine
FROM portkey
USING
    portkey_api_key = 'PORTKEY_API_KEY',
    config = 'pc-your-config-id';
```

```sql Using Provider Slug theme={"system"}
CREATE ML_ENGINE portkey_engine
FROM portkey
USING
    portkey_api_key = 'PORTKEY_API_KEY',
    provider = '@openai-prod';
```

> [!NOTE]
>
> Use [Configs](https://docs.portkey.ai/docs/product/ai-gateway/configs.md) to add guardrails, caching, conditional routing, and more.

**2. Create Model**

```sql theme={"system"}
CREATE MODEL portkey_model
PREDICT answer
USING
    engine = 'portkey_engine',
    temperature = 0.2;
```

**3. Query**

```sql theme={"system"}
SELECT question, answer
FROM portkey_model
WHERE question = 'Where is Stockholm located?';
```

Output:

```
+-----------------------------+--------------------------------------------------------------------------------+
| question                    | answer                                                                         |
+-----------------------------+--------------------------------------------------------------------------------+
| Where is Stockholm located? | Stockholm is the capital of Sweden, located on the south-central east coast... |
+-----------------------------+--------------------------------------------------------------------------------+
```

## Next Steps

> [card] [MindsDB Use Cases](https://docs.mindsdb.com/use-cases/overview)
>
> Explore MindsDB examples

> [card] [Portkey Configs](https://docs.portkey.ai/docs/product/ai-gateway/configs.md)
>
> Add routing, caching, guardrails

***

> [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

- [October](https://docs.portkey.ai/docs/changelog/2024/oct.md)
- [Integrations](https://docs.portkey.ai/docs/integrations/ecosystem.md)
- [Upgrade to Model Catalog](https://docs.portkey.ai/docs/support/upgrade-to-model-catalog.md)
- [Load Balancing](https://docs.portkey.ai/docs/product/ai-gateway/load-balancing.md)
- [Enforcing Policies with Start Hooks](https://docs.portkey.ai/docs/product/administration/enforce-policies-with-start-hooks.md)


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