Dify (gateway)
Dify can use Respan as the OpenAI-compatible model endpoint for chat-model calls inside Dify applications and workflows. This is separate from tracing calls made to Dify’s Service API with respan-instrumentation-dify or @respan/instrumentation-dify.
This setup routes Dify’s internal LLM calls through Respan Gateway. It does not turn Respan into a Dify Service API endpoint, and it does not route Dify Knowledge Base, Workspace, conversation, file, or app-invocation APIs through Respan.
Setup
Enable Dify's OpenAI-compatible model provider
In Dify, install or enable the official OpenAI-API-compatible model provider. Open Settings → Model Provider, select that provider, and add a customizable LLM model.
Configure the Respan endpoint
Use these values for the custom model:
Set context size, maximum output tokens, vision, and tool-calling options to the real capabilities of the selected model. The documented setup path is to add the model manually and cross-check its exact ID and capabilities in the Respan model catalog; model discovery was not validated in this documentation pass.
Dify validates the provider by making a model request. The Respan project therefore needs credits or a configured provider credential, and validation can create a Gateway log.
Use the model in Dify
Select the configured model in a Dify chatbot, Agent, Chatflow, or Workflow LLM node, then run the application. Keep the provider in Chat mode because this setup uses Respan’s OpenAI-compatible Chat Completions route.
Inspect the Gateway log
Open the Logs page and inspect the model, prompt, completion, usage, latency, cost, and status recorded for the Dify-originated request.
Add Dify Service API tracing
Gateway logging records the model request handled by Respan. To also trace an external Python or JavaScript application’s calls to Dify’s Service API, configure the Dify tracing integration. The two paths observe different network legs and provide complementary evidence; this setup does not claim that Dify propagates the external client’s trace context into its model-provider request.
Limitations
- This page documents the LLM Chat Completions path only. Do not infer support for Dify embedding, rerank, speech, or other model-provider types from this setup.
- Use an exact model ID available to the Respan project; this setup does not claim that Dify’s model discovery has been validated against Respan.
- Respan Gateway does not expose Dify’s Service API. Keep Dify client
baseUrl/base_urlvalues pointed at Dify. - Dify plugin field labels may vary slightly by plugin version. The required transport values remain the Respan API key,
https://api.respan.ai/api, API TypeChat Completions API (/chat/completions), and an available model ID in Chat mode.
See the Respan Gateway API guide for the route contract and current model guidance.