Agent use case pack · Vibe coding

Find a hidden token cost in Claude Code by grouping OpenTelemetry events by source

by PaperChaseWebb

A team grouped Claude Code's OpenTelemetry API request events by query source and found that the status-line summaries for background agents cost more than their main conversation. They published a measured write-up and an unofficial preload that turns the timer off, with an A/B switch to prove the effect.

Preview card for Find a hidden token cost in Claude Code by grouping OpenTelemetry events by source
Works withClaude CodePlain .md
Price
Free
Difficulty
Advanced
Setup
1 hr
Format
.md file
Free sample

find-a-hidden-token-cost-in-claude-code-by-grouping-opentelemetry-events-by-source.md · 3 KB · direct download, no signup

Download free

What you end up with

The lasting lesson is the measurement: the cost did not show in transcript-based cost tools, only in OpenTelemetry grouped by query source.

What you get

  • A plain-language summary of the workflow
  • A fill-in prompt template
  • What to watch out for
  • A link to the original source

Who it is for

Builders who already use AI agents and want a proven workflow they can copy into their own project.

Works with

Claude CodePlain .md

Solid chips: the agent is named in this listing's own tools list. Dashed chip: Plain Markdown, so it also pastes into other agents such as Grok Bot, Hermes, OpenClaw or Muse. We list those as compatible by format only, not as tested.

Tools needed

Claude Codethe agent being measured, versions 2.1.257 to 2.1.312
OpenTelemetry exportper-request events with a query source and cost estimate
Bun preload (unofficial)stops the summary timer without modifying the binary
You needAn AI coding agent or chat model
You needA small real task to try it on

Cost to run: Free with the agent plan you already use.
Time to result: One working session

How it works

  1. Turn on Claude Code's OpenTelemetry export for your own sessions

    Turn on Claude Code's OpenTelemetry export for your own sessions.

    Expected: Done before you move to the next step.

  2. Group api_request events by query_source and compare their share of co

    Group api_request events by query_source and compare their share of cost.

    Expected: Done before you move to the next step.

  3. If one side query is large, note your version and how you use backgrou

    If one side query is large, note your version and how you use background agents.

    Expected: Done before you move to the next step.

  4. Read the write-up's A/B and verify steps before trying any workaround,

    Read the write-up's A/B and verify steps before trying any workaround, and check the terms of service.

    Expected: Done before you move to the next step.

  5. Re-measure after every update, since the numbers and code paths change

    Re-measure after every update, since the numbers and code paths change.

    Expected: Done before you move to the next step.

Sample prompt from the pack

Workflow template · Claude Code, OpenTelemetry export
Apply this workflow to [your project]:
1. Turn on Claude Code's OpenTelemetry export for your own sessions.
2. Group api_request events by query_source and compare their share of cost.
3. If one side query is large, note your version and how you use background agents.
4. Read the write-up's A/B and verify steps before trying any workaround, and check the terms of service.
5. Re-measure after every update, since the numbers and code paths change.
Stop and ask me before anything irreversible: deploys, payments, sends or deletes.

Adapted by PaperChaseWebb. Not the original author's prompt.

Free preview of the file

find-a-hidden-token-cost-in-claude-code-by-grouping-opentelemetry-events-by-source.md (excerpt)3 KB total
# Find a hidden token cost in Claude Code by grouping OpenTelemetry events by source

PaperChase agent use case (free feed entry), version 1.0. Source: [Flamerix AI](https://gist.github.com/flamerix-ai/c3905705cc4205e5de3011fa2e74efce), 2026-10-28.

## What they did

Every 30 seconds or so, for each background agent, Claude Code re-sends that agent's transcript to the model to get a three to five word status line. In their telemetry that source was about 16 percent of Claude Code spend and about one in five API requests the week before the change. They wrote a small preload that recognises the summary timer and skips it, with a pass mode that loads the hook but changes nothing, and a verify step to run after every update. Four other people reported 18 to 26 percent in an issue thread.

## Worth knowing

The lasting lesson is the measurement: the cost did not show in transcript-based cost tools, only in OpenTelemetry grouped by query source. The preload itself is unofficial, changes the client's runtime behaviour, can silently stop working after an update and may conflict with the service's terms, so measure first and decide with care. Turning off background agents also stops it, at the price of losing them.

Worth knowing

  • The lasting lesson is the measurement: the cost did not show in transcript-based cost tools, only in OpenTelemetry grouped by query source. The preload itself is unofficial, changes the client's runtime behaviour, can silently stop working after an update and may conflict with the service's terms, so measure first and decide with care. Turning off background agents also stops it, at the price of losing them.
  • Figures are as reported by the original author and were not re-measured by us.

Questions

Where does this come from?

A public post credited to Flamerix AI. Source: https://gist.github.com/flamerix-ai/c3905705cc4205e5de3011fa2e74efce

Is it free?

Yes. Feed entries are free to read and download.

Details

Version 1.0 · Updated Oct 29, 2026 · Markdown version of this page
License: Personal and commercial use. Credit the original source when you share the workflow. Download terms

claude-codeopentelemetrycosttokenssubagentsmeasurement