Dify can add an external API through the official OpenAI-API-compatible model provider. You need your own API key, a compatible Base URL, and a current Model ID. Build a workflow with text input, one LLM node, and text output, run it once, and match the result to the provider record.
Want to test Dify with a workflow that has no external side effects? Create a dedicated BetterToken test key and open the current Dify setup guide. It covers the model API; Dify installation, Marketplace, third-party plugins, agents, and tools remain separate layers.
Prerequisites
You need a working Dify Cloud or self-hosted installation, access to Integrations/Marketplace and Model Providers, your own BetterToken API key, a current Model ID, and a new test workflow without tools.
The BetterToken API endpoint can be reached from Russia without a VPN. This does not guarantee access to Dify Cloud, Marketplace, GitHub, Docker registries, or third-party plugins.
1. Install the official provider
Open Integrations or Marketplace, then Model Providers. Find the official OpenAI-API-compatible provider and install it if necessary. Check the publisher in the official Dify Marketplace rather than choosing an unrelated plugin with a similar name.
2. Add a BetterToken model
Open the provider settings and add an LLM:
- Model Type: LLM.
- Model Name / ID: the current exact Model ID.
- API Key: your own BetterToken key.
- API Base URL:
https://www.bettertoken.ai/v1. - Completion mode: Chat when the selected provider/model requires it.
Do not append /chat/completions; the provider creates the full path. Do not include a real key in an application export, screenshot, or issue. Use current model documentation for optional context, token, vision, or streaming limits; they are unnecessary for the first test.
3. Save and classify validation errors
Dify validates credentials when saving. This confirms only the provider's authentication check, not the whole workflow. Record the provider/version, Model ID, Base URL without the key, short error type, HTTP status, and attempt time. Never store the key or a sensitive full response in a diagnostic note.
4. Build a minimal workflow
Create a Workflow application with three elements:
- Start with a text variable named
question. - LLM using the added BetterToken model.
- End returning the LLM text.
Use a simple prompt:
Reply with one line. Input: {{question}}
Connect Start → LLM → End. Do not add HTTP tools, databases, retrieval, agent loops, or publishing until this test passes.
5. Verify one run
Use the input: Return DIFY_OK and the number 4 as 2 + 2. The setup is confirmed when Dify shows the expected output, the LLM node finishes without provider/model/endpoint errors, and the BetterToken Dashboard contains a matching request with model, status, and applicable token usage.
Troubleshoot by layer
A provider/plugin installation failure belongs to Dify Marketplace or plugin_daemon; in self-hosted deployments check version, network access, HTTPS, and certificates. A credential validation error or 401 points to the key and provider. A 404 points to an incorrect Base URL or appended path. model not found requires a current ID that is available to the selected key/provider. If credentials save but the workflow fails, remove tools, streaming, and structured output and test the LLM node alone.
The first workflow confirms a model request through the official OpenAI-compatible provider. It does not prove compatibility with every Dify agent, community plugin, tool, or external service. Test side-effecting actions separately and require explicit confirmation.