Context Window bar stays at 0% with OpenAI Compatible provider returning "usage": null
#9,433 建立於 2026年2月19日
描述
Plugin Type
VSCode Extension
Cline Version
3.65.0
What happened?
The Context Window progress bar in the Cline UI remains at 0% throughout the entire session, regardless of how many turns/tokens have been consumed. This makes it impossible to track context window usage and anticipate when context limits will be reached.
Root cause: The corporate OpenAI-compatible API gateway returns "usage": null in all chat completion responses (both streaming and non-streaming). Since Cline depends on the usage object (prompt_tokens, completion_tokens, total_tokens) to calculate context window consumption, the bar never populates.
Example API response showing the null usage field: { "id": "chatcmpl-12345678", "model": "claude-sonnet-4-5", "object": "chat.completion", "usage": null }
Expected: Cline should either estimate token usage via tokenizer/character count as a fallback, display a warning indicator that the provider doesn't report token usage, or track accumulated input/output size internally. The Cline Output logs show zero entries related to token counting or context window calculations.
Steps to reproduce
- Configure Cline with API Provider set to "OpenAI Compatible"
- Set the base URL to a corporate OpenAI-compatible API gateway that returns "usage": null in responses
- Select a model (e.g., claude-4-5-sonnet)
- Start a task and perform multiple tool calls/turns
- Observe the Context Window bar — it remains at 0% throughout the entire session
- Check the Cline Output panel (View → Output → Cline) — no token counting or context window calculation entries appear
Provider/Model
claude-4-5-sonnet
System Information
OS: Ubuntu 22.04.5 LTS Linux 6.8.0-94-generic x86_64, 13th Gen Intel Core i9-13900K, 32GB RAM