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
The token cost generated by session titles, message summary titles, and body summaries has not been accounted for. #7175
Still relevant on v1.3.11. We ran into this while building cost analytics for our multi-tenant platform that embeds OpenCode.
Confirmed empirically: title generation, summary titles, and body summaries make LLM calls via LLM.stream() but never persist token usage or cost on any message. For title generation specifically (prompt.ts), the call uses provider.getSmallModel() / the small_model config and updates the session title via sessions.setTitle() without creating an AssistantMessage, so there's no surface to attach usage data to.
For compaction, an AssistantMessage is created but tokens are initialized to zero and never populated with actual usage from the LLM call.
As a workaround for the main prompt cost tracking, we accumulate tokens/cost from step-finish parts (via message.part.updated events) instead of relying on message.updated — but that doesn't help with these hidden background costs since they don't emit step-finish parts at all.
Would be great to see this addressed — for BYOK (bring your own key) deployments, accurate cost reporting to end users is critical.
Activity
github-actions commentedon Jan 7, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
junmediatek commentedon Jan 7, 2026
@rekram1-node @thdxr
Could you help to check this issue?
junmediatek commentedon Jan 12, 2026
@rekram1-node Is there anything update for this issue?
thdxr commentedon Mar 25, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.
fedealliani commentedon Apr 1, 2026
Still relevant on v1.3.11. We ran into this while building cost analytics for our multi-tenant platform that embeds OpenCode.
Confirmed empirically: title generation, summary titles, and body summaries make LLM calls via
LLM.stream()but never persist token usage or cost on any message. For title generation specifically (prompt.ts), the call usesprovider.getSmallModel()/ thesmall_modelconfig and updates the session title viasessions.setTitle()without creating anAssistantMessage, so there's no surface to attach usage data to.For compaction, an
AssistantMessageis created but tokens are initialized to zero and never populated with actual usage from the LLM call.As a workaround for the main prompt cost tracking, we accumulate tokens/cost from
step-finishparts (viamessage.part.updatedevents) instead of relying onmessage.updated— but that doesn't help with these hidden background costs since they don't emit step-finish parts at all.Would be great to see this addressed — for BYOK (bring your own key) deployments, accurate cost reporting to end users is critical.