Skip to navigation

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

1

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.

2

Configure the Respan endpoint

Use these values for the custom model:

Dify fieldValue
Model NameA model available to the Respan project, for example gpt-5.5
API KeyYour Respan API key
API Base URLhttps://api.respan.ai/api
Model name for API endpointThe same Respan model ID, unless an explicit endpoint alias is required
Completion modeChat
API TypeChat Completions API (/chat/completions)
Compatibility modeOpenAI compatible / strict

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.

3

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.

4

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_url values 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 Type Chat 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.