Dify in Russia: OpenAI-Compatible API and Your First Workflow

Add an OpenAI-compatible model provider, build a minimal text-in/text-out workflow, and verify the run against the provider Dashboard.

Dify can connect an external API through its official OpenAI-API-compatible model provider. You need your own API key, a compatible Base URL, and a current Model ID. To verify the setup, build a workflow with a text input, one LLM node, and a text output. Run it once and match the result to the provider record.

Want to test Dify with one workflow and no external actions? Create a separate BetterToken test key and open the current Dify guide. It covers the model API. Dify installation, Marketplace, third-party plugins, agents, and tools remain separate layers.

What you need

  • a working Dify Cloud or self-hosted Dify installation;
  • access to Integrations/Marketplace and Model Providers;
  • your own BetterToken API key;
  • a current Model ID from the BetterToken model plaza;
  • a new test workflow without tools or external actions.

You can connect to the BetterToken API endpoint from Russia without a VPN. This does not promise availability of Dify Cloud, Marketplace, GitHub, a Docker registry, or third-party plugins.

1. Install the official provider

In Dify, open Integrations or Marketplace, then Model Providers. Find the official OpenAI-API-compatible provider and install it if it is not already available.

Verify the author and listing in the official Dify Marketplace. Do not use a random plugin with a similar name; fields and credential handling may differ.

2. Add a BetterToken model

Open the provider settings and add a new LLM model. Enter:

  1. Model Type: LLM.
  2. Model Name / ID: the exact current Model ID.
  3. API Key: your own BetterToken API key.
  4. API Base URL: https://www.bettertoken.ai/v1.
  5. Completion mode: Chat, if the selected provider and model require it.

Do not append /chat/completions to the Base URL; the provider constructs the full path. Do not copy real credentials into an application export, screenshot, or issue.

If the UI asks for context size, max tokens, vision, or streaming parameters, use only current model documentation. The first test does not need extra features.

3. Save and validate the credential

Dify validates the credential on save. This establishes only that the provider completed its authentication procedure; it does not verify the complete workflow.

After an error, keep only safe diagnostic data:

  • provider name and version;
  • Model ID;
  • Base URL without the key;
  • a short error type and HTTP status;
  • time of the attempt.

Do not save the API key or a complete sensitive response.

4. Create a minimal workflow

Create a new Workflow application. Add only three elements:

  1. Start with a text variable named question.
  2. LLM using the BetterToken model you added.
  3. End with the LLM's response text.

Use this simple LLM prompt template:

Ответь одной строкой. Вход: {{question}}

Connect Start → LLM → End. Do not add HTTP tools, a database, knowledge retrieval, an agent loop, or publishing. They make the first failure harder to isolate.

5. Run one test

Pass this input:

Верни DIFY_OK и число 4 как сумму 2 + 2.

The setup is confirmed when:

  • Dify shows the expected text output;
  • the LLM node completes without a credential, model, or endpoint error;
  • the BetterToken Dashboard shows a record with the expected model and status;
  • the Dashboard shows input, output, applicable cache tokens, and the corresponding charge.

Matching the Dify run to the Dashboard rules out a workflow that silently used another provider or model.

Distinguishing errors

Provider or plugin will not install

This belongs to the Dify Marketplace/plugin-daemon layer. In a self-hosted environment, check the Dify version, plugin daemon network access, HTTPS, and certificate chain. Changing the BetterToken API key will not fix it.

ToolProviderCredentialValidationError or 401

Enter the key again, check for spaces, and verify the selected provider. Make sure the credential belongs to the model rather than an unrelated tool plugin.

404

Check the Base URL:

https://www.bettertoken.ai/v1

Remove a manually appended /chat/completions if the field expects an API Base URL.

model not found

Copy the current ID from the model plaza. Confirm that the ID is available to the new key and selected OpenAI-compatible provider.

The credential saves, but the workflow fails

Test the LLM node alone. Remove tools, streaming, and structured output, then repeat the short text-in/text-out run. If it passes, restore additional nodes one at a time.

Scope of this setup

The first workflow confirms one model request through the official OpenAI-API-compatible provider. It does not prove compatibility with every Dify agent, community plugin, tool, or external service. Create a separate test for any action with a side effect and require explicit user confirmation.

Current fields and limitations are in the BetterToken Docs for Dify. Check dynamic Model IDs and prices on the day you configure them.

Ready to optimize your LLM workflow?

Join thousands of developers building faster, smarter, and more cost-effective AI applications with BetterToken.