Skip to content
TutujinAPI

Integration guides

Using Dify

Add an OpenAI-API-compatible model in Dify's model providers with your Tutujin API key, the API endpoint URL https://www.tutujin.com/v1 and a model name, and use GPT, Claude, DeepSeek and more in apps and knowledge bases.

Dify connects to Tutujin API through the "OpenAI-API-compatible" model provider: when you add a model, enter your Tutujin API key, the API endpoint URL https://www.tutujin.com/v1 and the model name. Add each model once and it is available in app orchestration, workflows and knowledge bases.

The steps follow the Dify 1.x interface. Dify changes quickly, so menu names and field positions may differ slightly in your version; the values you enter stay the same.

Step 1: Install OpenAI-API-compatible

  1. In Dify, open Settings → Model Provider.
  2. If "OpenAI-API-compatible" is not listed, find it in the plugin marketplace and install it. Since Dify 1.0, model providers ship as plugins.

Step 2: Add a chat model

Click "Add model" on OpenAI-API-compatible and fill in:

FieldValue
Model typeLLM
Model nameA model name from the model hub, e.g. deepseek-v4.1-flash
API KeyYour Tutujin API key
API endpoint URLhttps://www.tutujin.com/v1
Completion modeChat
Context size, max tokensThe values the model's vendor publishes
Function calling, VisionTurn on only if the model supports them

After saving, the model appears in your apps' model picker. Add one entry per model name for each model you want.

Step 3: Add an embedding model (for knowledge bases)

Dify knowledge bases need an embedding model. Click "Add model" again:

FieldValue
Model typeText Embedding
Model namee.g. text-embedding-3-small
API KeyYour Tutujin API key
API endpoint URLhttps://www.tutujin.com/v1

Then make it the default embedding model under System Model Settings. If your Dify version supports the Rerank type for this provider, add a rerank model the same way, for example qwen3-reranker-8b.

Do not switch embedding models casually once a knowledge base exists. Vectors from different models are not compatible, and switching means re-embedding every document.

GPT-only setups

If you only use OpenAI models, you can configure Dify's built-in "OpenAI" provider instead: put your Tutujin key in API Key and https://www.tutujin.com/v1 in API Base. For other vendors' models, OpenAI-API-compatible is the better fit.

Testing and billing

Send a message from an app's debug panel; a normal reply means the setup works. Every call then shows up under Usage in the Tutujin console, billed at the key's group price. Consider a dedicated key for Dify with a spending limit — see Authentication and base URL.

Troubleshooting

SymptomCause and fix
Validation fails when saving the modelCheck the API endpoint URL is https://www.tutujin.com/v1 and the model name matches the model hub
401Wrong or invalid key
503 with model_not_foundThe key's group lacks this model — see Choosing a group
Truncated answersRaise the model's max tokens

Still stuck? Add our WeChat support JsnonoChat and send the request id from the error message, and we will look into it.