Short answer. Install the OpenAI-API-compatible provider, set the base URL to
https://api.plugsky.com/v1, add the model ID and context length, and choose the correct model type. Use a Plugsky embedding model for the knowledge base and test the endpoint with curl before debugging Dify.
What Dify needs from a provider
Dify is model-agnostic: a chat app needs an LLM, a knowledge base needs an embedding model, retrieval can use a reranker, and voice apps need audio models. The OpenAI-API-compatible provider adds a service that speaks the OpenAI HTTP shape.
Compatibility is a shape, not a guarantee. A provider can accept /chat/completions and still differ on function calling, JSON mode, streaming usage or max_tokens. Test the features your app uses.
| Dify type | Powers | Plugsky option |
|---|---|---|
| LLM | Chat, agents, workflows | plugsky-pro, plugsky-lite, plugsky-plus |
| Text embedding | Knowledge base indexing | plugsky-embed, plugsky-embed-multilingual |
| Rerank | Reordering chunks | No dedicated rerank model listed; use fusion or a separate provider |
| Speech-to-text | Audio input | /v1/audio/transcriptions |
| Text-to-speech | Audio output | /v1/audio/speech |
Plugsky exposes an OpenAI-compatible API at https://api.plugsky.com/v1 with 39 models. Main text models have a 262,144-token context. New free accounts get 100 requests and 50,000 tokens per day; paid plans start at $8 per month.
Provider setup
In Dify, open Integrations → Model Provider and install OpenAI-API-compatible. Add a credential with the API key and base URL, then add a model:
- Base URL:
https://api.plugsky.com/v1. If the plugin appends/chat/completions, do not add a second/v1. A doubled path returns 404. - API key: a key starting with
sk-live-. Store it in Dify's credential store, not a prompt. - Model type: LLM for chat, text embedding for the knowledge base.
- Model name: the exact ID, such as
plugsky-pro. A display name with spaces will fail. - Context length: the published context, such as 262,144.
Before debugging Dify, prove the chat endpoint with the same values:
curl https://api.plugsky.com/v1/chat/completions \
-H "Authorization: Bearer $PLUGSKY_API_KEY" -H "Content-Type: application/json" \
-d '{"model":"plugsky-pro","messages":[{"role":"user","content":"Reply with ready."}]}'
If curl works and Dify fails, the problem is Dify's URL join, credential, model type or network path. If curl fails, fix the key, URL or model ID first.
Model IDs and limits
Use a model that matches the job. A large reasoning model is a poor choice for classifying 10,000 short tickets; a small model is poor for multi-document synthesis. Dify lets you set a different model per node, so a workflow can classify with Lite and write with Pro.
plugsky-liteandplugsky-micro: high-volume classification, routing and short answers. The free plan includes them.plugsky-proandplugsky-plus: general chat, RAG answers and drafting.plugsky-parse: vision and document parsing, 262,144-token context, 16,384 output tokens.
Do not copy a context length from a blog post. Model pages and plan limits change; test a long prompt before relying on the number.
Embeddings and the rerank gap
A Dify knowledge base needs an embedding model before it can retrieve. Add plugsky-embed as a text-embedding model, set the dimension to 2,048, and index a small test set first. If you switch to plugsky-embed-multilingual at 2,048 dimensions, re-index; old and new vectors are not comparable.
Reranking is optional. Plugsky's published list has no dedicated rerank model. Use hybrid or weighted retrieval, install a separate rerank provider, or rerank in your own service and pass ordered chunks into the workflow. Do not add a chat model as a reranker; the interface differs.
Chunking matters as much as the embedding. Start with a size that fits the documents and a small overlap, then test with real questions.
Build the RAG pipeline
Build the knowledge base before the chat app. Upload a representative set, wait for indexing, and inspect retrieved chunks for a handful of questions. If the right passage is not in the top results, the answer prompt cannot fix it.
- Create the knowledge base: choose the embedding model, chunk settings and retrieval method.
- Test retrieval: ask questions whose answers you know. Check chunk text, score and metadata.
- Add citations: keep the source name and a stable ID so a reviewer can open the original.
- Constrain the answer: answer only from retrieved context and say when it is insufficient.
- Evaluate: use questions with expected sources; measure retrieval and support.
For the same pipeline in Python, see the RAG API tutorial. Dify adds orchestration; it does not remove the need to evaluate retrieval.
Agent tools and self-host notes
Dify agents and workflows can call tools. Before enabling one, confirm the model supports the function-calling shape Dify sends. Some compatible models return tool calls in a different field or require a particular tool_choice. Test one tool with a simple schema.
For self-hosted Dify, the network path is the usual failure. A container cannot reach localhost on your laptop; use host.docker.internal on Docker Desktop or the service name on a Compose network. For a cloud provider, use the public HTTPS base URL and allow outbound TLS. If Dify runs in a private subnet, add an egress rule rather than disabling TLS verification.
Keep the API key in the credential store, restrict who can edit providers, and separate development and production keys. A workspace key is shared across apps.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| 401 Unauthorized | Wrong, revoked or other-workspace key | Re-run curl; create a new key |
| 404 Not Found | Base URL includes /v1 twice | Use https://api.plugsky.com/v1 |
| Model not found | Display name used instead of model ID | Use the exact ID; check the plan |
| Context length error | More tokens than the model accepts | Lower context, trim history, reduce chunks |
| Embedding mismatch | Knowledge base indexed with another model | Re-index; do not mix dimensions |
| 429 Too Many Requests | Plan limit or fair-use concurrency | Back off with jitter; reduce concurrency |
| Streaming stalls | Proxy buffering or short timeout | Disable buffering; raise timeout |
Read the Dify run log and provider response together. A generic “model invocation failed” often hides a 400 with a field name. Log the request ID, model, token count and status without logging prompt content in production.
FAQ
Can Dify use an OpenAI-compatible API?
Yes. Install the OpenAI-API-compatible provider, add the base URL and API key, and add the model with its exact ID and context length. Dify then treats it like any other chat or embedding model.
What base URL should I use for Plugsky in Dify?
Use https://api.plugsky.com/v1. If the plugin appends /chat/completions, do not add a second /v1; a doubled path returns 404. Test the same URL with curl before changing Dify settings.
Does Plugsky have a rerank model for Dify?
Plugsky's published list has no dedicated rerank model. Use hybrid or weighted retrieval without a reranker, install a separate rerank provider in Dify, or rerank in your own service before the workflow.
Why does my Dify knowledge base return bad answers?
Check retrieval before the prompt. Inspect the top chunks, confirm the embedding model and dimension, and test questions with known answers. If the right passage is not retrieved, the model cannot answer from it.
Can I self-host Dify with Plugsky?
Yes, if the Dify containers can reach https://api.plugsky.com over TLS. Use the public base URL, allow outbound traffic, and keep the API key in the credential store. Localhost inside a container is not your laptop.
Sources: Dify's model-provider documentation and the OpenAI-API-compatible plugin listing in the Dify Marketplace. Both checked 20 November 2026. Reviewed 20 November 2026. Dify versions and plugin fields change; confirm the current labels in your workspace.