# Connect Dify

https://modelportal.ai/docs/integrations/dify

> Low-code platform that wires models into workflows, agents, and RAG apps.

## Use cases

Good for wiring models into visual workflows, agents and knowledge-base Q&A apps. After adding an OpenAI-compatible provider, pick this platform's models in any node.

## Tips

Workflows call models in bulk and unattended. Set a monthly spend limit on the key and watch the failure rate in [usage](/docs/usage?lang=en).

## If it cannot connect

1. Use `https://modelportal.ai/v1` as the API host, without `/chat/completions`.
2. The key starts with `mp-` (older keys: `key_`) and is not paused or revoked; `invalid_api_key` means the key cannot be used.
3. The model ID matches the [catalog](/catalog) and is in the key's allowed models.
4. `insufficient_balance` means the balance is too low; see [common errors](/docs/errors?lang=en) for more.

## Setup

1. Go to Settings → Model Provider and choose OpenAI-API-compatible.
2. Fill in the model name, API key, and API endpoint URL.
3. Save, then select the model inside your app.

## Settings

- API host：`https://modelportal.ai/v1`
- API key：`YOUR_API_KEY`
- Model：`MODEL_ID`

## FAQ

### What models does a knowledge base need?

Retrieval needs an embedding model, so also add a model tagged Embedding for embeddings.

### Am I charged when a workflow fails?

Failed model calls are free, but nodes that already succeeded in the workflow are billed normally.

