Skip to content

Long-Lived Session Hijacking #2

Description

@borhen68

If you starred TokenTamer waiting for the big feature — this is it.

What's New: Long-Lived Session Hijacking

We just shipped Anthropic prompt caching exploitation — the single most powerful cost-cutting feature in TokenTamer.

The Numbers

Before After
Cached input cost $0.30 / Mtoken
Regular input cost $3.00 / Mtoken $3.00 / Mtoken
50-turn Claude Code session ~$5.00 ~$0.50

Same model. Same reasoning. Same output. Just smarter billing.

How It Works

Claude Code (and most agents) re-send the entire conversation every turn. That means turn 50 sends messages 1-50 all over again. Expensive.

TokenTamer now injects cache_control breakpoints at three stable positions:

  1. After the tools array (rarely changes)
  2. After the system prompt (fixed for the session)
  3. After the conversation prefix (everything except the last 2 turns)

Anthropic caches the prefix. You only pay for the new tail. On a long session, 80-90% of your input tokens become cached — and cached is 90% cheaper.

Verification

Run TokenTamer, use Claude Code, then check the response headers:

curl -I http://127.0.0.1:8000/v1/messages ...
# X-TokenTamer-Cache-Breakpoints: 3
# X-TokenTamer-Cache-Tokens: 12400

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions