How do you limit the maximum token size of a session so that you don't have a huge token size if you keep talking in a session #4559

Closed
opened 2026-02-21 18:07:01 -05:00 by yindo · 2 comments
Owner

Originally created by @xddcode on GitHub (Jul 11, 2024).

Originally assigned to: @crazywoola on GitHub.

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

Over time, the tokens in a session can get huge, but they can still be emitted,

2. Additional context or comments

We want to be able to impose a maximum token limit on a single session of LLM in a workspace

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @xddcode on GitHub (Jul 11, 2024). Originally assigned to: @crazywoola on GitHub. ### Self Checks - [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 (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. Over time, the tokens in a session can get huge, but they can still be emitted, ### 2. Additional context or comments We want to be able to impose a maximum token limit on a single session of LLM in a workspace ### 3. Can you help us with this feature? - [ ] I am interested in contributing to this feature.
yindo added the 💪 enhancement label 2026-02-21 18:07:01 -05:00
yindo closed this issue 2026-02-21 18:07:01 -05:00
Author
Owner

@crazywoola commented on GitHub (Jul 11, 2024):

If you are using api, you will be able to get all the tokens information. In this case you could be able to limit the total numbers of the session.

@crazywoola commented on GitHub (Jul 11, 2024): If you are using api, you will be able to get all the tokens information. In this case you could be able to limit the total numbers of the session.
Author
Owner

@xw2723 commented on GitHub (Jul 12, 2024):

I also encountered this problem. When I embedded Dify's chat tool into the user's system, because there was no reference context restriction set in the Dify chat tool, the user would not create a new conversation out of convenience, which resulted in the conversation content being quickly Expansion, the consumption of tokens increases exponentially.
Is it possible to add a limit to the publishing chat tool page and set the number of context references?
image
@crazywoola

@xw2723 commented on GitHub (Jul 12, 2024): I also encountered this problem. When I embedded Dify's chat tool into the user's system, because there was no reference context restriction set in the Dify chat tool, the user would not create a new conversation out of convenience, which resulted in the conversation content being quickly Expansion, the consumption of tokens increases exponentially. Is it possible to add a limit to the publishing chat tool page and set the number of context references? ![image](https://github.com/user-attachments/assets/d56472b7-ec77-44d9-b13a-e3f8ddd1b417) @crazywoola
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#4559