The process did not use LLM nodes, but there was a situation where model tokens were consumed #15632

Closed
opened 2026-02-21 19:22:37 -05:00 by yindo · 7 comments
Owner

Originally created by @ysl2001 on GitHub (Jul 24, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.2.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

1、Settings - Model Vendor- Install tongyi 0.0.29
2、Create chatflow
3、add start node、knowledge-retrieval node、 end node
4、batch request v1/chat-messages
5、found call /plugin/{tenantId}/dispatch/llm/invoke api

✔️ Expected Behavior

1、This api:"/plugin/{tenantId}/dispatch/llm/invoke", should not be called

Actual Behavior

1、This api "/plugin/{tenantId}/dispatch/llm/invoke" has been called many times

Originally created by @ysl2001 on GitHub (Jul 24, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.2.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1、Settings - Model Vendor- Install tongyi 0.0.29 2、Create chatflow 3、add start node、knowledge-retrieval node、 end node 4、batch request v1/chat-messages 5、found call /plugin/{tenantId}/dispatch/llm/invoke api ### ✔️ Expected Behavior 1、This api:"/plugin/{tenantId}/dispatch/llm/invoke", should not be called ### ❌ Actual Behavior 1、This api "/plugin/{tenantId}/dispatch/llm/invoke" has been called many times
yindo added the 🐞 bugoutdated labels 2026-02-21 19:22:37 -05:00
yindo closed this issue 2026-02-21 19:22:38 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jul 24, 2025):

Hi @ysl2001! I'm Dosu and I’m helping the dify team.

This behavior is expected in Dify: the knowledge-retrieval node can internally invoke LLM models, even if your chatflow doesn't include an explicit LLM node. This happens especially when automatic metadata filtering or certain retrieval strategies are enabled. The internal logic for knowledge retrieval and metadata filtering uses LLM calls, which results in token consumption and triggers the /plugin/{tenantId}/dispatch/llm/invoke API endpoint—even if you didn't add an LLM node yourself. This is not a bug, but a consequence of how knowledge retrieval is implemented in Dify. If you want to minimize or avoid LLM usage, review your knowledge-retrieval node's configuration, especially around metadata filtering and retrieval strategies.
You can see the relevant logic in the KnowledgeRetrievalNode implementation and how it ultimately leads to LLM API calls via the LargeLanguageModel and PluginModelClient.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Jul 24, 2025): <!-- Greeting --> Hi @ysl2001! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> This behavior is expected in Dify: the knowledge-retrieval node can internally invoke LLM models, even if your chatflow doesn't include an explicit LLM node. This happens especially when automatic metadata filtering or certain retrieval strategies are enabled. The internal logic for knowledge retrieval and metadata filtering uses LLM calls, which results in token consumption and triggers the /plugin/{tenantId}/dispatch/llm/invoke API endpoint—even if you didn't add an LLM node yourself. This is not a bug, but a consequence of how knowledge retrieval is implemented in Dify. If you want to minimize or avoid LLM usage, review your knowledge-retrieval node's configuration, especially around metadata filtering and retrieval strategies. You can see the relevant logic in the [KnowledgeRetrievalNode implementation](https://github.com/langgenius/dify/blob/6ac06486e3fd9af0eb3483caefa99adc85ddb96f/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py) and how it ultimately leads to LLM API calls via the [LargeLanguageModel and PluginModelClient](https://github.com/langgenius/dify/blob/6ac06486e3fd9af0eb3483caefa99adc85ddb96f/api/core/model_runtime/model_providers/__base/large_language_model.py). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/49da08f5-8a73-4042-ae05-29031f8fbfca?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/49da08f5-8a73-4042-ae05-29031f8fbfca?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/49da08f5-8a73-4042-ae05-29031f8fbfca?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/49da08f5-8a73-4042-ae05-29031f8fbfca?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/49da08f5-8a73-4042-ae05-29031f8fbfca?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/49da08f5-8a73-4042-ae05-29031f8fbfca?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/49da08f5-8a73-4042-ae05-29031f8fbfca?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/22902)
Author
Owner

@ysl2001 commented on GitHub (Jul 24, 2025):

@dosu So will he default to an llm configuration?

@ysl2001 commented on GitHub (Jul 24, 2025): @dosu So will he default to an llm configuration?
Author
Owner

@dosubot[bot] commented on GitHub (Jul 24, 2025):

No, the knowledge-retrieval node does not automatically default to an LLM configuration. For any internal LLM usage (like automatic metadata filtering or certain retrieval strategies), it requires an explicit LLM configuration in the node settings. If this configuration is missing, the process will fail with a runtime error—there is no fallback to a default LLM at the node level. Any defaulting behavior would only happen in the UI or workflow editor that generates the node config, not in the core node logic itself. You can check or set the LLM configuration for the knowledge-retrieval node in your workflow editor or node settings.
Reference: KnowledgeRetrievalNode implementation

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Jul 24, 2025): <!-- Answer --> No, the knowledge-retrieval node does not automatically default to an LLM configuration. For any internal LLM usage (like automatic metadata filtering or certain retrieval strategies), it requires an explicit LLM configuration in the node settings. If this configuration is missing, the process will fail with a runtime error—there is no fallback to a default LLM at the node level. Any defaulting behavior would only happen in the UI or workflow editor that generates the node config, not in the core node logic itself. You can check or set the LLM configuration for the knowledge-retrieval node in your workflow editor or node settings. [Reference: KnowledgeRetrievalNode implementation](https://github.com/langgenius/dify/blob/6ac06486e3fd9af0eb3483caefa99adc85ddb96f/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py) <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/14e6190a-99b1-48d2-b65b-c827a1e3099a?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/14e6190a-99b1-48d2-b65b-c827a1e3099a?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/14e6190a-99b1-48d2-b65b-c827a1e3099a?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/14e6190a-99b1-48d2-b65b-c827a1e3099a?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/14e6190a-99b1-48d2-b65b-c827a1e3099a?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/14e6190a-99b1-48d2-b65b-c827a1e3099a?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/14e6190a-99b1-48d2-b65b-c827a1e3099a?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/22902)
Author
Owner

@ysl2001 commented on GitHub (Jul 24, 2025):

@dosu I only configured the vector model,However, the text generation model incurs costs

@ysl2001 commented on GitHub (Jul 24, 2025): @dosu I only configured the vector model,However, the text generation model incurs costs
Author
Owner

@dosubot[bot] commented on GitHub (Jul 24, 2025):

LLM (text generation) costs can occur in the knowledge-retrieval node if certain settings are enabled—even if you only intended to use a vector model. This usually happens if "automatic" metadata filtering is turned on, or if the retrieval strategy references an LLM model in the node configuration. To avoid LLM usage and costs, make sure that metadata_filtering_mode is set to "disabled" and that there are no LLM model configs (like metadata_model_config or single_retrieval_config.model) present in your knowledge-retrieval node settings. This ensures only the vector model is used and no LLM API calls are made. You can check and adjust these settings in your workflow editor or by exporting and reviewing the workflow JSON.
For more technical details, see the KnowledgeRetrievalNode implementation.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Jul 24, 2025): <!-- Answer --> LLM (text generation) costs can occur in the knowledge-retrieval node if certain settings are enabled—even if you only intended to use a vector model. This usually happens if "automatic" metadata filtering is turned on, or if the retrieval strategy references an LLM model in the node configuration. To avoid LLM usage and costs, make sure that `metadata_filtering_mode` is set to `"disabled"` and that there are no LLM model configs (like `metadata_model_config` or `single_retrieval_config.model`) present in your knowledge-retrieval node settings. This ensures only the vector model is used and no LLM API calls are made. You can check and adjust these settings in your workflow editor or by exporting and reviewing the workflow JSON. For more technical details, see the [KnowledgeRetrievalNode implementation](https://github.com/langgenius/dify/blob/6ac06486e3fd9af0eb3483caefa99adc85ddb96f/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/be5e35a6-1502-44b9-bb68-9991605771eb?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/be5e35a6-1502-44b9-bb68-9991605771eb?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/be5e35a6-1502-44b9-bb68-9991605771eb?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/be5e35a6-1502-44b9-bb68-9991605771eb?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/be5e35a6-1502-44b9-bb68-9991605771eb?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/be5e35a6-1502-44b9-bb68-9991605771eb?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/be5e35a6-1502-44b9-bb68-9991605771eb?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/22902)
Author
Owner

@crazywoola commented on GitHub (Jul 24, 2025):

For generating conversation names, and some other scenarios, the system will call this endpoint to do these tasks.

@crazywoola commented on GitHub (Jul 24, 2025): For generating conversation names, and some other scenarios, the system will call this endpoint to do these tasks.
Author
Owner

@ysl2001 commented on GitHub (Jul 24, 2025):

@crazywoola How can I turn off the generation of titles

@ysl2001 commented on GitHub (Jul 24, 2025): @crazywoola How can I turn off the generation of titles
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#15632