Dify
Dify is a platform for LLM apps and workflows. Its model providers are plugins. Install the OpenAI-API-compatible plugin, add the key and the endpoint, and Dify sends its requests to the exchange.
Before you start
- A workspace with a balance and a
spendkey. See API keys. - A Dify workspace where you can install plugins.
1. Install the plugin
OpenAI-API-compatible
2. Add the key and the endpoint
Choose Add Model and set the type to LLM. Dify adds /chat/completions to the endpoint URL.
sk-liquid-...
https://router.inference.ai.exchange/v1
The URL ends in /v1.
3. Set the model
Enter the model by name. To get the current names, use GET /v1/models. See Market data.
liquid.auto
Set the context size and the features of the model. Turn on function calling for an agent that uses tools.
Notes
- Dify sends
X-Title: Difywith each request. The receipts name Dify as the client. - The exchange sets a cap on each request. It is in the
x-liquid-cap-usdresponse header. To limit total spend, set a spending limit on the key. See API keys. - A workflow can make many requests. Set a spending limit on the key for the workflow.
- Use a preset for other purchasing rules. See Purchasing rules.
Troubleshooting
| Symptom | Cause and fix |
|---|---|
401 |
The key is wrong, revoked or expired. Paste it again. |
404 |
Keep /v1 at the end of the endpoint URL. |
model_not_found |
The model is not on the book. Use an exact name from GET /v1/models. |
| A request is refused for lack of funds. | The workspace balance cannot cover the cap. Add funds on the Credits page. |
See Errors for the error codes.
Next steps
- Dify plugin: the Liquid Inference plugin, which needs only the key.
- n8n: the same setup for workflow automation.
- Purchasing rules: models, strategy and limits, and presets.
- Errors: the error format and what each code means.