You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Token usage always shows 0 when using Zhipu Coding Plan API with @ai-sdk/openai-compatible #25986
When using @ai-sdk/openai-compatible with Zhipu's Coding Plan endpoint, the status bar always displays Context: 0% used and token cost is never tracked — despite the upstream API returning valid usage data in both streaming and non-streaming responses.
Note: This is a different issue from #20885 which covers @ai-sdk/openai (Responses API). This issue is specific to @ai-sdk/openai-compatible (Chat Completions API) with Zhipu's Coding Plan endpoint.
Same SDK, different baseURL, different result — I have another provider using the same @ai-sdk/openai-compatible SDK pointing to Zhipu's standard endpoint (https://open.bigmodel.cn/api/paas/v4), and context %used displays correctly there (~44-59%). The only difference is the baseURL path (/api/coding/paas/v4 vs /api/paas/v4).
Session I/O shows correctly — The right panel displays 44K in / 166 out correctly, but the top bar Context: 0% used remains at zero.
The Coding Plan endpoint may return a slightly different response structure — possibly missing or extra fields in the streaming SSE format that causes the SDK to fail to extract usage data.
If your issue is distinct (e.g., specifically caused by a different response structure from the Zhipu Coding Plan endpoint), please add details explaining how it differs from the above, and we can keep this open.
Activity
github-actions commentedon May 6, 2026
This issue might be a duplicate of existing issues. Please check:
@ai-sdk/openai-compatible— same SDK, same symptom (token usage not tracked/context % stuck at 0), different provider@ai-sdk/openai-compatible(LM Studio/Qwen model) — same SDK and same symptomIf your issue is distinct (e.g., specifically caused by a different response structure from the Zhipu Coding Plan endpoint), please add details explaining how it differs from the above, and we can keep this open.
github-actions commentedon Jul 8, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.