Skip to content

Statusline context percentage incorrect for Sonnet 4 #666

Description

@chrisbeardy

When using the statusline, the context percentage is showing very low, for example, the context could be shown as 130,000 tokens but the percentage could be 13%.

Activity

  1. chrisbeardy commented on Sep 26, 2025

    @chrisbeardy
    ContributorAuthor

    I've noticed its just dividing it by 1000. Looks like there is a maths error somewhere.

  2. chrisbeardy commented on Sep 26, 2025

    @chrisbeardy
    ContributorAuthor

    On inspection of the code, it looks just the litellm max_input_tokens is used verbatim. However, this is only available on the API usage and not the plan usage. Maybe we need to do a check for what plan is being used (if thats available or can be configured)

  3. ryoppippi commented on Sep 27, 2025

    @ryoppippi
    Member

    so what is the difference between claude-plan and claude model from api

  4. chrisbeardy commented on Sep 28, 2025

    @chrisbeardy
    ContributorAuthor

    I believe its the same model and model id etc, however it seems if you use the API you have access to a 1000000 token window, however if you're on a plan, you only have access to a 200000 context window.

  5. chrisbeardy commented on Oct 4, 2025

    @chrisbeardy
    ContributorAuthor

    as of today this appears to have corrected itself, but this is only because litellm for sonnet 4.5 has max tokens of 200000

    Image
  6. changed the title [-]Statusline context percentage incorrect[/-] [+]Statusline context percentage incorrect for Sonnet 4[/+] on Oct 4, 2025
  7. adstr123 commented on Oct 18, 2025

    @adstr123

    I also get completely different values from ccusage on the statusline vs. the /context command that's now in CC.

  8. willma-andela commented on May 13, 2026

    @willma-andela

    This is still an issue

    Image Image

    Would love a fix for this as I use this information to help me decide when to /clear

  9. ryoppippi commented on May 17, 2026

    @ryoppippi
    Member

    The current statusline still relies on hookData.context_window.total_input_tokens, which can diverge from /context and the actual current usage. That problem is covered by #823, and #923 is the active PR direction for fixing it, so I am closing this as a duplicate.

  10. willma-andela commented on May 20, 2026

    @willma-andela

    @ryoppippi you closed #923, so I think this should be reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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