Custom OpenAI-compatible model streaming response usage metadata shows as "undefined" in Copilot chat log
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
Copilot Chat Extension Version: v0.60.0
VS Code Version: v1.132.0
OS Version: macOS
Feature (e.g. agent/edit/ask mode): Chat (ask mode)
Selected model (e.g. GPT 4.1, Claude 3.7 Sonnet): Custom OpenAI-compatible model
Logs: When streaming is enabled, usage metadata in the chat log shows as `"undefined"`.
When "stream": false, usage displays correctly: {"completion_tokens":319,"prompt_tokens":50922,"total_tokens":51241}
**Steps to Reproduce:**
1. Configure a custom OpenAI-compatible model in Copilot VS Code settings
2. Enable streaming for the model
3. Send a chat message in ask mode
4. Check the chat log — usage shows as undefined
**Additional context:**
The model correctly sends usage data in the final streaming chunk (verified via direct API test).
This appears to be an issue in the extension's streaming response handler not extracting the usage field from the final chunk for custom/OpenAI-compatible models.
Non-streaming mode works fine, so the bug is specific to the streaming code path.
**Impact**
This causes the context/session info icon on the bottom right to disappear so there is no way to see data on the context window etc
Contributor guide
Assessment
This issue has not been assessed yet.