## Summary
Request to expose actual token consumption metrics in Qoder CLI session logs for better cost attribution and optimization.
Current Problem
The `model.response.completed` events in session logs (`~/.qoder/logs/sessions/*/segments/*.jsonl`) show all token fields as 0:
```json
{
“type”: “model.response.completed”,
“data”: {
“input_tokens”: 0,
“output_tokens”: 0,
“cache_read_input_tokens”: 0,
“cache_creation_input_tokens”: 0
}
}
```
This makes it impossible to track per-session or per-skill token consumption locally.
Use Case
I’m building a **Skill Token Attribution Tool** that needs:
- Per-request token data for accurate cost attribution
- Skill-level aggregation to identify optimization opportunities
- Local analysis for real-time feedback without API calls
Proposed Solution
**Option A (Preferred)**: Populate existing token fields in `model.response.completed` events with actual values from the model provider.
**Option B**: Add a new event type `model.token.usage` if Option A isn’t feasible.
Benefits
Cost transparency - See exactly what each operation costs
Skill optimization - Identify expensive skills
Budget management - Real-time monitoring without API delays
Debugging - Understand token-heavy operations
Community tools - Enable third-party analytics
Technical Details
- Log location: `~/.qoder/logs/sessions/{session_id}/segments/{timestamp}.jsonl`
- Event type to fix: `model.response.completed`
- Account type: Teams (org_id available)
The Usage API provides aggregated data but cannot attribute to specific skills and has a 7-day query limit. Local log exposure would complement it perfectly.
Example Desired Output
```json
{
“type”: “model.response.completed”,
“data”: {
“input_tokens”: 2450,
“output_tokens”: 380,
“cache_read_input_tokens”: 1200,
“cache_creation_input_tokens”: 0
}
}
```
**CLI Version**: 1.1.52
**Account Type**: Teams
Happy to help test beta versions and provide validation scenarios!