# Dify plugin

The Liquid Inference plugin adds the exchange to [Dify](https://dify.ai) as a model provider. The source is [architect-xyz/liquid-dify-plugin](https://github.com/architect-xyz/liquid-dify-plugin).

The plugin is on the [Dify Marketplace](https://marketplace.dify.ai/plugins/architect-xyz/liquid).

## Before you start

- A Dify workspace where you can install plugins.
- A workspace with a balance and a `spend` key. See [API keys](https://inference.ai.exchange/docs/keys.md).

## 1. Install the plugin

In Dify, open **Settings**, then **Model Provider**. Find **Liquid Inference** and install it.

## 2. Add the key

Paste the `spend` key in **API Key**. Leave **API Base URL** empty. The plugin uses `https://router.inference.ai.exchange/v1`.

## 3. Choose a model

The list has `liquid.auto`, which lets the exchange choose the model for each request.

To use another model, choose **Add Model**. Enter the name that `GET /v1/models` returns. Set the context size and the features of the model. See [Market data](https://inference.ai.exchange/docs/market.md).

## Notes

- The plugin sends `X-Title: Dify` with each request. The receipts name Dify as the client.
- The exchange sets a cap on each request. It is in the `x-liquid-cap-usd` response header. To limit total spend, set a spending limit on the key. See [API keys](https://inference.ai.exchange/docs/keys.md).
- The plugin makes no payments. The exchange charges the balance of your workspace.

## Next steps

- [Dify](https://inference.ai.exchange/docs/connect-dify.md): set up Dify with no plugin.
- [Purchasing rules](https://inference.ai.exchange/docs/rules.md): models, strategy and limits, and presets.
- [Apps](https://inference.ai.exchange/docs/apps.md): the other plugins and tools.
