GLM-4.6 context window inconsistent.
Plugin Type
VSCode Extension
App Version
4.99.2
Description
the context window is very limited 72k sometimes 64k the model supports up to 200k tried on opencode works fine
also in kilo tried to use openai compatible version of z.ai but still stuck at certain context around 65k+ but sometimes the bug are vanished.. i don't understand, and need someone to reproduce similar bug..
try on windows and mac. the kilo code on mac is more unstable compared to in my windows laptop..
Reproduction steps
- use kilo code
- select provider: Z.AI Coding Plan
- select model: GLM-4.6
- chat, fill up context window
Provider
Z.AI
Model
GLM-4.6
System Information
mac mini & Windows 11 CPU: m2 & i7 8gb ram & 40gb ram
I encountered a similar problem. "kilo said" showed a large piece of raw HTML, and finally reported the error "kilocode is having trouble..."
i am finding a work around for this.. some people on discord said setting context to 400k solved the issue, but for me it's causes new issue.
what i do now? i set custom endpoint with openai compatible, then set coding plan url my current setting that works:
https://api.z.ai/api/coding/paas/v4 glm-4.6
make sure set max output token 128k and context size 200k this helps me so far.. no issue.. (not yet) maybe my work aren't as heavy as few days ago.
I think there is something wrong here. The probability of failure when editing the file is obviously much higher than other models.
make sure set max output token 128k and context size 200k this helps me so far.. no issue.. (not yet) maybe my work aren't as heavy as few days ago.
This can greatly reduce the probability of failure.
I have the same problem
The issue appears to have been resolved in v4.106.0.
Still have the same issue. It gets stuck at 104.6k, and I can't change it.
Still have the same issue. It gets stuck at 104.6k, and I can't change it.
Yes, this annoying problem has appeared again.
Any workaround yet ?
https://github.com/RooCodeInc/Roo-Code/issues/8833
i don't think that is it. In the ui if you hover over it it says it reserves 40.0k tokens for output regardless if it is actually 100k. i found that using the method of @AngDrew works still
i don't think that is it. In the ui if you hover over it it says it reserves 40.0k tokens for output regardless if it is actually 100k. i found that using the method of @AngDrew works still我觉得不是这样。在用户界面上,如果你把鼠标悬停在上面,它会显示预留了 4 万个代币用于输出,不管实际是不是 10 万个。我发现使用 的方法仍然有效。
204.8k is written in the official documentation. The real problem is that the context window is limited to 128k.
i don't think that is it. In the ui if you hover over it it says it reserves 40.0k tokens for output regardless if it is actually 100k. i found that using the method of @AngDrew works still
i posted workaround in the discord check it out
i don't think that is it. In the ui if you hover over it it says it reserves 40.0k tokens for output regardless if it is actually 100k. i found that using the method of @AngDrew works still
https://discord.com/channels/1346756824233148527/1432188990596841532
That link is broken, it leads to a blank page on Discord. Can you post the workaround here?
That link is broken, it leads to a blank page on Discord. Can you post the workaround here?
sure.
you must set up with this:
- use openai compatible
- endpoint: https://api.z.ai/api/coding/paas/v4
- GLM 4.6
- un-check enable reasoning effort (they claim this is the cause of error but not only this!)
- max output token 32k (you can leave it -1)
- context window 128k (i know. but trust me this is the only config works. for best compatibility i found out that using 110k window works best. 128k ok but sometimes it fails, if you found another issue reduce it further to 100k/110k/120k/etc.. try what fits the best for you)
- ETC:
- use prompt caching (improve speed), uncheck image support, use stream, include max outputs tokens
- save
- go to context tab on the left
- scroll to bottom, auto compact / condensing. enable it for all profile set the value around 75% or so..
with this config you can use kilo in my screenshot i ran it smoothly and it calls 500 tool calling without fail.. enjoy!
https://github.com/Kilo-Org/kilocode/issues/3301 The problem is very, very clear: the context length is stuck at 128k (This model supports 200k). However, many days have passed and it still hasn't been fixed. @chrarnoldus
from https://github.com/RooCodeInc/Roo-Code/issues/8833
Thanks for the detailed investigation and screenshots. This isn’t an actual hard cap on context length — the issue occurs because once the session reaches around ~128k tokens, the model becomes unable to reliably execute tool calls (like
editFileorreadFile). In other words, it’s not that the context limit is enforced at 128k, but that the model’s ability to use tools degrades sharply beyond that point.We’re working on some architectural changes that should help mitigate this longer-term, but there’s no short-term fix. For now, the best workaround is to keep context condensation or truncation thresholds below ~60% to avoid hitting this behavior.
Why doesn't this issue occur in Claude Code or other agent tools? Is it because ANTHROPIC uses BASE_URL=https://open.bigmodel.cn/api/anthropic, while other tools use BASE_URL=https://open.bigmodel.cn/api/coding/paas/v4? Do these two addresses have different specific capabilities?