Skip to content

Dify

Dify is an LLM app platform that calls any OpenAI-compatible API as a model provider. Register MirAPI once, then add the models your apps need — Dify does not auto-discover them, so you add each model by its exact catalogue name.

Element Value
Base URL https://api.mirapi.ai/v1
API key A MirAPI key (sk-...) created in the console
Model deepseek-chat (added per model)
  1. In Dify, open Settings → Model Provider.
  2. Click Add model provider and choose OpenAI-API-compatible.
  3. Fill in the provider:
Provider name: MirAPI
Base URL: https://api.mirapi.ai/v1
API key: sk-...

Dify appends /chat/completions itself, so leave the base URL as https://api.mirapi.ai/v1 — do not add the endpoint path. Dify sends the key in the Authorization: Bearer header, which is what MirAPI’s OpenAI-compatible endpoints expect.

Dify does not list MirAPI models automatically. Add each model under the provider, using the exact id from the catalogue (GET /v1/models):

Model name: deepseek-chat
Model type: LLM
  • Use the id exactly as returned by GET /v1/models. Skip the vendor/ prefix — it only exists for browsing the console catalogue and is not part of the API model name.
  • Take the context size from the model’s context_length on the models page.

MirAPI endpoints map to Dify model types as follows:

Dify model type MirAPI endpoint Typical use
LLM /v1/chat/completions Chat and completion apps
Text Embedding /v1/embeddings Knowledge-base retrieval (RAG)
Rerank /v1/rerank Re-scoring retrieval candidates

Save and test each model from the provider list before wiring it into an app.

  1. Create or open an app that uses the MirAPI model.
  2. Open the debug panel and send:
Reply with exactly: connected to MirAPI
  1. The output should contain connected to MirAPI.
  • 401 — Dify is sending a missing or invalid key; check the provider’s API key field.
  • 403 with a valid key — the model is not on your key’s allowlist, the balance is exhausted, or the key hit a quota or IP limit. Top up to restore an empty balance immediately.
  • 429 — you hit a rate limit; retry with exponential backoff. The gateway does not retry for you and sends no Retry-After header.
  • Billing is per token for chat, per image, or per second of video. Usage and spend are in the console billing log and the /api/log/token detail endpoint — see Billing & top-ups.