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

> 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.

- URL: https://paperchasewebb.ai/bots/marketplace/items/find-a-hidden-token-cost-in-claude-code-by-grouping-opentelemetry-events-by-source/
- Type: Agent use case pack
- Category: Vibe coding
- By: PaperChaseWebb
- Works with: Claude Code (named in the listing); Plain .md
- Price: Free USD
- Difficulty: Advanced
- Setup time: 1 hr
- Time to result: One working session
- Format: Markdown (.md) file, find-a-hidden-token-cost-in-claude-code-by-grouping-opentelemetry-events-by-source.md
- Version: 1.0, updated 2026-10-29
- License: Personal and commercial use. Credit the original source when you share the workflow.

## 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.

## Tools needed

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

Cost to run: Free with the agent plan you already use.

## 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: 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 find-a-hidden-token-cost-in-claude-code-by-grouping-opentelemetry-events-by-source.md

````markdown
# 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.

## How to get it

Free sample. Download it directly at https://paperchasewebb.ai/bots/marketplace/items/find-a-hidden-token-cost-in-claude-code-by-grouping-opentelemetry-events-by-source/, no signup.

Seller: PaperChaseWebb Inc., mgmt@paperchasewebb.com
