opensync icon indicating copy to clipboard operation
opensync copied to clipboard

Tokens, Cost, Duration don't seem to match up

Open shadeydev opened this issue 10 months ago • 3 comments

Claude Code v2.1.15 OpenSync version via commit ad62947 claude-code-sync version is 0.1.14.

Running OpenSync from local env. Forked then npx convex dev npm run dev Auth with WORKOS_CLIENT_ID

claude-code-sync login claude-code-sync setup

New folder, run claude. Prompt this is a test With system prompt and tools that comes to 19365 tokens from Claude Code. Type /config enable Verbose output. The 19365 is not high even thought it may appear to be. Type /context

     ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛀   claude-opus-4-5-20251101 · 19k/200k tokens (10%)
     ⛀ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   Estimated usage by category
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ System prompt: 3.0k tokens (1.5%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ System tools: 16.9k tokens (8.4%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ Custom agents: 456 tokens (0.2%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ Messages: 420 tokens (0.2%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛝ ⛝ ⛝   ⛶ Free space: 134k (67.1%)
     ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝   ⛝ Autocompact buffer: 45.0k tokens (22.5%)
     ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝

     Custom agents · /agents

     User
     └ worktree-sync-reset: 456 tokens

Note I ran /config twice and /context once. See Round 1 below.

Round 1 OpenSync:

In Opensync for this specific Project:

Project Prompt Completion Total Cost
test987 38.7K 0.0K 38.7K $0.7265

Full output of new session in new directory:

Round 1 Claude Code

  ⎿  SessionStart:startup hook succeeded

❯ this is a test

∴ Thinking…

  The user has sent "this is a test". This appears to be a simple test message to check if I'm working. I
  should respond briefly and appropriately.

⏺ Got it. I'm here and ready to help with any software engineering tasks you have. What would you like to
  work on?

❯ /config
  ⎿  Set verbose to false

❯ /config
  ⎿  Set verbose to true

❯ /context
  ⎿   Context Usage
     ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛀   claude-opus-4-5-20251101 · 19k/200k tokens (10%)
     ⛀ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   Estimated usage by category
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ System prompt: 3.0k tokens (1.5%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ System tools: 16.9k tokens (8.4%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ Custom agents: 456 tokens (0.2%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ Messages: 420 tokens (0.2%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛝ ⛝ ⛝   ⛶ Free space: 134k (67.1%)
     ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝   ⛝ Autocompact buffer: 45.0k tokens (22.5%)
     ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝

     Custom agents · /agents

     User
     └ worktree-sync-reset: 456 tokens Context Usage
     ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛀   claude-opus-4-5-20251101 · 19k/200k tokens (10%)
     ⛀ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   Estimated usage by category
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ System prompt: 3.0k tokens (1.5%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ System tools: 16.9k tokens (8.4%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ Custom agents: 456 tokens (0.2%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ Messages: 420 tokens (0.2%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛝ ⛝ ⛝   ⛶ Free space: 134k (67.1%)
     ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝   ⛝ Autocompact buffer: 45.0k tokens (22.5%)
     ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝

     Custom agents · /agents

     User
     └ worktree-sync-reset: 456 tokens


─────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯
─────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ~/Projects/test987 (Opus 4.5)                                                                19365 tokens

Round 2 OpenSync

Project Prompt Completion Total Cost
test99 38.7K 0.0K 38.7K $0.2382

Round 2 Claude Code

➜  ~ cd ~/Projects
➜  Projects mkdir test99
➜  Projects cd test99
➜  test99 claude

╭─── Claude Code v2.1.15 ──────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                     │ Tips for getting started                                       │
│                 Welcome back John!                  │ Ask Claude to create a new app or clone a repository           │
│                                                     │                                                                │
│                                                     │ ────────────────────────────────────────────────────           │
│                       ▐▛███▜▌                       │ Recent activity                                                │
│                      ▝▜█████▛▘                      │ No recent activity                                             │
│                        ▘▘ ▝▝                        │                                                                │
│ Opus 4.5 · Claude Max ·                             │                                                                │
│ [email protected]'s Organization  │                                                                │
│                 ~/Projects/test99                   │                                                                │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
  ⎿  SessionStart:startup hook succeeded

❯ this is a test

∴ Thinking…

  The user said "this is a test". This seems like a simple greeting or test message to see if I'm working. I should
  respond briefly and offer to help with whatever they need.

⏺ Got it. I'm here and ready to help. What would you like to work on?

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ help me build something                                                                                        ↵ send
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ~/Projects/test99 (Opus 4.5)                                                                            19370 tokens

shadeydev avatar Jan 22 '26 15:01 shadeydev

Also running into this issue, for example I see some empty token counts on the sessions page of the dashboard even though there's clearly > 0 tokens

Image.

@waynesutton happy to look into this if you're open to help :)

freddiev4 avatar Jan 27 '26 21:01 freddiev4

@freddiev4 hi yes, I'm open https://github.com/waynesutton/claude-code-sync

waynesutton avatar Jan 28 '26 02:01 waynesutton

Keeping open: repeated usage snapshots need deduplication, and cost/duration still need verification. Current context size is not cumulative token usage. This needs a coordinated Claude plugin fix.

waynesutton avatar Oct 04 '26 02:10 waynesutton