token消耗量好大 #8890
-
📦 PlatformOther 📦 Deploymenet modeclient db (lobe-chat image) 📌 Versionv1.114.1 💻 Operating SystemWindows 🌐 BrowserEdge 🐛 Bug Description我只是加入了一些角色设定,大概几百字,输出的token只有1000,但是有个输入未缓存4000多是什么呢?有具体的计算方法吗token 📷 Recurrence StepsNo response 🚦 Expected BehaviorNo response 📝 Additional InformationNo response |
Beta Was this translation helpful? Give feedback.
Replies: 18 comments 2 replies
-
Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. |
Beta Was this translation helpful? Give feedback.
-
Lobe Chat 的 token 消耗量高,通常是因为每次请求都会把「角色设定(system/role prompt)+ 历史消息 + 当前输入」一起打包发给大模型,所有内容都会计入 token 计算。即使你只加了几百字的角色设定,历史对话和系统提示也会累计消耗 token。 关于「输入未缓存」,这是因为 token 计算时没用到缓存(比如首次输入、内容变动或缓存失效),系统会直接实时计算 token 数量。这个不会影响实际消耗,只是提示当前是即时计算。 token 计算方法在代码里主要通过 To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
只是首条消息,也没有什么历史消息呀,只有角色设定,这样也会消耗很多吗?输入(角色设定500+当前输入10多个汉字),这样的输入都能有4000多呢?@dosu |
Beta Was this translation helpful? Give feedback.
-
It’s just the first message, there is no historical message, only the role settings, will this consume a lot? Enter (character setting 500+currently enter more than 10 Chinese characters), can such inputs be more than 4,000? @dosu |
Beta Was this translation helpful? Give feedback.
-
正常情况下,只有角色设定(约500字)和十几个汉字输入,token 不可能超过4000。Lobe Chat 的 token 计算逻辑是把角色设定和输入合并后,用精确分词器统计 token 数量(小于1万字符时)源码说明。没有历史消息时,token 只会包含你看到的内容。 如果你看到4000+,常见原因有:
建议你可以:
目前没有发现类似的已知 bug 或讨论,代码层面也没有发现会自动拼接大量隐藏内容的逻辑。如果问题持续,建议关注后续版本更新或社区反馈。 To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
你看下是否开启了插件、搜索之类的,这些也会有token开销 |
Beta Was this translation helpful? Give feedback.
-
Check whether plug-ins, search, etc. are enabled, and these will also have token overhead. |
Beta Was this translation helpful? Give feedback.
-
没有诶,可能是我用的API的问题?不过我用chatbox消耗量又会低很多,好奇怪,不知道是不是lobe这边的问题,那边1000多,这边能快5000 |
Beta Was this translation helpful? Give feedback.
-
No, maybe it's a problem with the API I use? However, the consumption of my chatbox will be much lower. It's so strange. I don't know if it's a problem with Lobe. It's more than 1,000 on the other side, and it can be faster than 5,000 on the other side. |
Beta Was this translation helpful? Give feedback.
-
是否方便截个窗口的图? |
Beta Was this translation helpful? Give feedback.
-
Is it convenient to screen a window picture? |
Beta Was this translation helpful? Give feedback.
-
没问题 ![]() ![]() |
Beta Was this translation helpful? Give feedback.
-
但是我发现,如果没有角色设定,就几乎不会有那个输入未缓存,消耗的token基本就是真正输出和输入的(包括历史消息的消耗)。但是如果加上了角色设定的(助手),就会消耗好几千起步 |
Beta Was this translation helpful? Give feedback.
-
But I found that without the role settings, there would be almost no input that is not cached, and the consumed token is basically the real output and input (including the consumption of historical messages). However, if the character setting (assistant) is added, it will consume thousands of steps. |
Beta Was this translation helpful? Give feedback.
-
我是说截一个整个窗口的图?因为我不确定你现在有开什么配置 |
Beta Was this translation helpful? Give feedback.
-
I mean a picture of the entire window? Because I'm not sure what configuration you have now |
Beta Was this translation helpful? Give feedback.
-
![]() ![]() |
Beta Was this translation helpful? Give feedback.
-
![]() 因为你开了联网搜索,为了保证联网搜索的效果好,我们是有注入提示词的 |
Beta Was this translation helpful? Give feedback.
因为你开了联网搜索,为了保证联网搜索的效果好,我们是有注入提示词的