cline/cline

Context Window bar stays at 0% with OpenAI Compatible provider returning "usage": null

開放

#9,433 建立於 2026年2月19日

 (3 則留言) (1 個反應) (0 位負責人)TypeScript (6,427 個分叉)batch import
Help WantedVS Codesize:S

倉庫指標

星標
 (61,799 顆星)
PR 合併指標
 (平均合併 18小時 50分鐘) (30 天內合併 327 個 PR)

描述

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

  1. Configure Cline with API Provider set to "OpenAI Compatible"
  2. Set the base URL to a corporate OpenAI-compatible API gateway that returns "usage": null in responses
  3. Select a model (e.g., claude-4-5-sonnet)
  4. Start a task and perform multiple tool calls/turns
  5. Observe the Context Window bar — it remains at 0% throughout the entire session
  6. 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

貢獻者指南