2027 setup guide · LLM app platforms

Dify with an OpenAI-compatible API

Dify treats a model provider as workspace infrastructure. Get the provider, default models and request metadata right, or every app in the workspace inherits the gap.

Abstract illustration of a workflow builder connected to model providers
Illustration: one workspace, several model providers. Plugsky Editorial Team.

Dify is a workspace for building chatbots, workflows, agents and retrieval apps. A model provider is installed once and then shared by every app in that workspace. That is convenient for a team and dangerous for a pilot: one missing embedding model or one wrong base URL can break apps that nobody edited.

Dify's OpenAI-API-compatible plugin is the path for endpoints that are not OpenAI but follow the same request shape. It supports chat models plus embedding, rerank, speech-to-text and text-to-speech types, which is broader than a chat-only integration. The setup is short; the selection work is in model types, default models and the metadata you send to the gateway.

Dify provider fields, checked 23 November 2026
FieldWhat to enterWhat to check
TypeLLM, embedding, rerank, STT or TTSThe plugin treats each type differently; a chat model ID will not work as an embedding model.
NameA label your team will recogniseUse a name that includes the provider and the environment, not just the model.
API keyA Plugsky keyWorkspace keys are shared; use separate keys for development and production.
URLhttps://api.plugsky.com/v1The root of the compatible API; check the resolved path for non-chat types.
Model nameA published model IDDify does not validate the name against the provider until a request runs.
LimitsContext window and max tokensUnderstating the window truncates prompts; overstating it produces provider errors.

Install the provider once, then scope the keys

In Dify, open Integrations, then Model Provider, and install the OpenAI-API-compatible plugin from the marketplace. Add a credential with the model type, a display name, the API key and the base URL. Dify validates the credential before making the provider available, but validation is not a full compatibility test; it does not prove that a given model supports tools, vision or streaming.

Dify's documentation is explicit that API keys grant workspace-wide model access and that only the workspace owner and admins can manage providers. Treat the key as production infrastructure. Create a separate key for a pilot workspace, and do not let a departmental app share the key that a customer-facing app uses.

Custom models are a second path. They are useful when the model is new or fine-tuned and the provider card does not list it. A custom model relies on its own key, and deleting its only key removes the model, so document the mapping before the person who added it leaves.

Set every default model, including the boring ones

Dify apps and nodes that do not choose a model fall back to workspace defaults. The defaults cover system reasoning, embeddings, rerank, speech-to-text and text-to-speech. When a default is empty, the features that rely on it stop working. A text-to-speech node fails without a TTS default even if the chat model is perfect.

Map the defaults to the apps you actually run. A RAG app needs an embedding model and, if you use it, a rerank model. A voice app needs STT and TTS. A workflow that only calls an LLM needs the reasoning default. Do not fill every slot with the same chat model; the model types are not interchangeable.

Check the embedding dimension before you index documents. Changing the embedding model after a knowledge base is built usually requires reindexing, and a dimension mismatch surfaces as a retrieval error rather than a model error.

Use request metadata to attribute spend

The compatible plugin can send request metadata, disabled by default. When enabled, every LLM request carries the Dify app ID and the Dify end-user ID, so a gateway can attribute traffic and spend per app. Dify's marketplace entry notes that the app ID is present only when the call runs inside a Dify app, and that Dify does not expose a workflow run ID to model plugins.

That is enough to answer 'which app spent this?' but not 'which workflow step spent this?'. If you need step-level attribution, encode it in the model name, a request header your gateway accepts, or a separate provider credential per workflow. Do not assume the plugin sends an execution ID it does not have.

Turn the metadata on before a pilot, not after the first bill. Retrofitting attribution means replaying logs that were never written.

What to check before you publish an app

Run the app, not just the provider test. A chat app should stream, call a tool if the workflow uses one, and handle an image if the prompt accepts one. A RAG app should retrieve from the knowledge base and cite the retrieved chunk. A workflow should fail visibly when a model returns an error, rather than returning an empty string.

Check the non-chat types separately. The marketplace entry warns that for embedding, rerank, STT and TTS the plugin appends an API version internally, so a full endpoint path can produce a duplicated segment. Enter the base URL and inspect the resolved request path in the gateway log.

Test the provider in the same context as the app. A model that answers a chat prompt can still fail a workflow node because the node sends a different message shape or expects a JSON output. Build a one-node workflow that calls the model and returns the raw text, then add the app logic. When something breaks, that node tells you whether the provider or the app is at fault.

Finally, test a key rotation. Replace the workspace key, confirm that apps still run, and confirm that the old key is rejected. A provider that only works with one key is a single point of failure.

When a competitor wins

Dify Cloud wins when the team wants a managed workspace and does not need a private model boundary. A direct OpenAI or Anthropic provider wins when you only use one vendor and do not need the compatible plugin. A self-hosted Dify install with a local model wins when data cannot leave the network at all.

Plugsky wins when Dify is one workspace among several tools that need the same OpenAI-compatible endpoint, one bill and one audit trail. The flat monthly plans suit multi-app workspaces where usage is hard to forecast, and the private VPC and air-gapped options cover teams that cannot use a public API. The limit is catalogue size: 39 public model IDs, so confirm the chat, embedding and rerank models your apps need are all present.

Verdict

Install the OpenAI-API-compatible plugin, use a dedicated key per environment, and fill every default model your apps depend on. Turn on request metadata before the pilot and verify the resolved path for non-chat model types.

Choose Plugsky when Dify needs a predictable monthly bill and an endpoint that can move from shared API to private deployment without changing the app configuration. Choose a native provider or Dify Cloud when the workspace is the only consumer and managed hosting is the priority.

Frequently asked questions

Does Dify support OpenAI-compatible APIs?

Yes, through the OpenAI-API-compatible plugin. It supports LLM, embedding, rerank, speech-to-text and text-to-speech model types.

Why did my Dify app stop working after I changed a model?

Check the workspace default models first. Apps and nodes that do not select a model fall back to the defaults, and an empty default disables the dependent feature.

Can Dify attribute spend per app?

The compatible plugin can send the Dify app ID and end-user ID as request metadata when enabled. A gateway can use those headers to attribute traffic and spend per app.

Does Dify send a workflow run ID to the model provider?

Dify's marketplace documentation says it does not expose a workflow run ID to model plugins. Use app-level attribution or add your own header if you need step-level detail.

Should I use one key for all Dify apps?

Use separate keys for development and production at minimum. Workspace keys are shared by every app, so a single key makes revocation and attribution harder.

Related

Sources

  1. Dify: model providers · 23 Nov 2026
  2. Dify Marketplace: OpenAI-API-compatible · 23 Nov 2026
  3. Plugsky API quickstart · 23 Nov 2026