Skip to content

The token cost generated by session titles, message summary titles, and body summaries has not been accounted for. #7175

Closed as not planned

Description

@junmediatek

Description

Session titles update code:

const agent = await Agent.get("title")

Message summary title code:

const agent = await Agent.get("title")

body summary code:

const summaryAgent = await Agent.get("summary")

None of the above LLM requests have had their costs accounted for.

Is this a bug, or is it a deliberate design?

Plugins

NA

OpenCode version

1.1.3

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

Ubuntu 24.04

Terminal

VSCode remoteSSH

Activity

  1. github-actions commented on Jan 7, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  2. junmediatek commented on Jan 7, 2026

    @junmediatek
    ContributorAuthor

    @rekram1-node @thdxr

    Could you help to check this issue?

  3. junmediatek commented on Jan 12, 2026

    @junmediatek
    ContributorAuthor

    @rekram1-node Is there anything update for this issue?

  4. thdxr commented on Mar 25, 2026

    @thdxr
    Member

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

  5. fedealliani commented on Apr 1, 2026

    @fedealliani

    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.

  6. removed
    bugSomething isn't working
    on May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions