Skip to content

Massive token spike causing quota exhaustion in single session #26184

Closed as not planned

Description

@memin-61

Description

Was using opencode go through opencode tui. Deepseek V4 Pro was selected as the model and the session was about 500k~ tokens. The chat started to slow down and every response took a minute to respond and finally I got quota exceeded.

From my observations session an3G3iVR consumed ~5 hours of quota in ~30 minutes due to input tokens ballooning from ~20k to 500k+ per request.
From usage logs:

  • Normal requests (2:58-3:26 PM): 18k-21k input tokens, $0.001-$0.004 cost
  • After 3:30 PM: 570k-614k input tokens, $0.98-$1.06 cost per request
    15 requests after 3:30 PM cost ~$15 instead of ~$0.05 normal.
    Looks like conversation context got stuck in a loop, re-sending entire 500k token history repeatedly.

If there's anything I can do to clarify, please let me know.

Plugins

none

OpenCode version

1.14.40

Steps to reproduce

  1. Open OpenCode TUI
  2. Select deepseek-v4-pro model through OpenCode Go
  3. Work in a session until it grows to ~500k tokens
  4. Observe: responses slow down to ~1 minute each
  5. Input tokens balloon to 500k+ per request (should stay ~500k, not multiply)
  6. Quota gets exhausted in minutes instead of hours

Screenshot and/or share link

Image

Operating System

Arch Linux 6.18.22-1-lts

Terminal

kitty

Activity

  1. github-actions commented on May 7, 2026

    @github-actions
    Contributor

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

  2. IgorGanapolsky commented on Jun 6, 2026

    @IgorGanapolsky

    The 300× spike (≈$15 for what should've been $0.05) from context re-sending 500k tokens in a loop is exactly the runaway class I work on. Free MIT kit that stops this from torching a Mac/quota: https://github.com/IgorGanapolsky/mac-yolo-safeguards. Besides that session — what's the worst single loop incident you've hit?

  3. Necmttn commented on Jun 22, 2026

    @Necmttn

    This class of bug needs a per-turn context-growth ledger.

    For each request, record request id, session id, model, prompt token count, prior prompt count, delta, cache read/write, compaction state, context segment counts, and whether the same large history block was resent. Then OpenCode can warn before the second or third 500k-token resend instead of only discovering the loop from quota exhaustion after the fact.

    Generated with ax - https://github.com/Necmttn/ax

  4. github-actions commented on Aug 22, 2026

    @github-actions
    Contributor

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

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