Dify

Dify

Open-source LLM app development platform with workflows, RAG, and agents

Introduction

Dify is a visual LLM application development platform. By connecting it to TokenMix's OpenAI-compatible endpoint, you can use any model available on TokenMix (Claude, GPT-5, DeepSeek, Qwen, and more) inside every Dify workflow, chatbot, or RAG pipeline — with zero additional setup on the model side.

Prerequisites

You need a self-hosted Dify instance. The quickest way is Docker Compose:

git clone https://github.com/langgenius/dify.git
cd dify/docker
cp .env.example .env
docker compose up -d

Access Dify at http://localhost (default port 80). Create an admin account on first launch.

You also need a TokenMix API key. Sign up at tokenmix.ai → Console → API Keys and create a new key.

Setup Steps

Step 1 — Open Model Provider settings

In your Dify workspace, click your avatar (top-right) → SettingsModel Provider.

Step 2 — Add OpenAI-API-compatible provider

Scroll to OpenAI-API-compatible and click Add Model.

Step 3 — Fill in the connection details

Field Value
API endpoint URL https://api.tokenmix.ai/v1
API Key Your TokenMix key (sk-tm-…)
Model Name e.g. claude-sonnet-4.6
Model Type LLM
Completion mode Chat
Context window Set per model (e.g. 200000 for Claude Sonnet)

Click Save. Dify will validate the credentials automatically.

Step 4 — Add an Embedding model (for RAG)

Repeat Step 2–3, but set Model Type = Text Embedding and enter an embedding model name available on TokenMix (check the Models page for type=embedding entries, e.g. text-embedding-3-large).

Step 5 — Use in a workflow or chatbot

Create a new App (or open an existing one) → in the model selector, choose the model you just added. Your Dify app now routes through TokenMix.

Verify

Run a quick test inside Dify's built-in "Debug & Preview" panel. Send a short message — a successful response with the correct model name confirms the integration is working.

Alternatively, check TokenMix Console → Usage to see the request logged.

FAQ

Q: I added the model but Dify shows "Quota exceeded" or "Invalid API key". A: Double-check your TokenMix key in Settings → Model Provider — paste it again to avoid leading/trailing spaces. Make sure your TokenMix balance is positive.

Q: Which embedding models does TokenMix support? A: Go to tokenmix.ai → Models and filter by type Embedding. Common choices include text-embedding-3-large and text-embedding-3-small. Use the exact short_id shown on that page as the Model Name in Dify.

Q: Can I add multiple models (e.g. Claude + GPT-5) at the same time? A: Yes. Repeat the "Add Model" step for each model. All models share the same base_url and API key — you only change the Model Name and context window per entry.