Claude requests have no cache mark, so each agent step pays for the whole prompt

Cache never hits Reported

An open-source AI browser agent for Chrome and Firefox; its spend meter already counts cache reads and writes, and it retries cut-off answers with a larger cap.

The mistake: Cache never hitsAPPwebbrainPROMPTAbout 12,000-tokensystem prompt, thentools and historyPROVIDER CACHENo cache_control onthe request:nothing is reusedYOU PAYabout 12Mfull-price prompttokens per 1,000callsThe request never asks Anthropic to cache thepromptThe mistake: Cache never hitsAPPwebbrainPROMPTAbout 12,000-tokensystem prompt, thentools and historyPROVIDER CACHENo cache_control onthe request:nothing is reusedYOU PAYabout 12Mfull-price prompttokens per 1,000callsThe request never asks Anthropic to cache thepromptThe mistake: Cache never hitsAPPwebbrainPROMPTAbout 12,000-token systemprompt, then tools and historyPROVIDER CACHENo cache_control on the request:nothing is reusedThe request never asks Anthropicto cache the promptYOU PAYabout 12M full-price prompttokens per 1,000 calls

≈ 12,000,000 tokens per 1,000 calls, of prompt read at full price on the Anthropic and Vertex Claude paths estimate

Estimates, not measurements. Every figure on this page is an estimate from reading the code, not a measurement of the app in use.

Repository
webbrain-one/webbrain 1.8k GitHub stars
Commit audited
c40d107
leanprompt version
0.1.0-dev.15
Audit date
Status
The maintainers have been told about this audit; no response yet.
Maintainers
the issue and the pull request
How it ran
Unattended audit: nobody was asked during the run, so priority, volume and prices were left open; the questions for the owner are listed at the end.

leanprompt read the code at commit c40d107 and found 2 places where its LLM calls could use fewer tokens, plus 1 other problem, not scored. Static score: 70 of 100 (an estimate from the findings). The code may have changed since.

Findings

  1. LP-PC-01 Put cache marks where the provider needs them

    src/chrome/src/providers/anthropic.js:435 · severity high · saves prefill

    What happens. The Anthropic, Claude-subscription and Vertex AI paths build the /v1/messages body (and rawPredict body) with no cache_control field, anywhere in the extension. Anthropic only caches when a mark is sent, so the whole Act system prompt (about 48,800 characters in SYSTEM_PROMPT_ACT, roughly 12,000 tokens) plus the tool list and the growing history is read at full input price on every step of the agent loop. A comment at agent.js:38667 says the prompt is ordered so Anthropic hits the cache, but no mark is sent. The Firefox build has the same code (src/firefox/src/providers/anthropic.js:433).

    The change. Send a cache mark on the request: one top-level cache_control {"type":"ephemeral"} for automatic caching on api.anthropic.com, or an explicit cache_control on the last system block and the last tool for the Vertex path. The prompt is already stable first and volatile last, and runtime context is kept out of the system prompt (agent/runtime-context.js:90).

    Why it helps. An agent run makes many calls within seconds of each other, so each new call can read the prompt prefix at the cache-read price instead of the full input price; the mark costs a one-time write premium per run.

    Overlaps. Finding 2 loses some of the same tokens; the totals count the larger once.

    Estimate about 12M prompt tokens per 1,000 Anthropic-path calls read at full price instead of cache price (estimate)

    Assumptions. system prompt about 12,000 tokens from 48,835 characters at 4 chars per token (estimate, not tokenizer-counted); average call about 20,000 prompt tokens; about 15 steps per run so about 67 cache writes per 1,000 calls; reaches only users on Anthropic, Claude-subscription or Vertex Claude; minimum cacheable length is 512 tokens on current models per the Anthropic page, well below the prompt size.

    Who reaches this. only users on the Anthropic, Claude-subscription or Vertex Claude providers

  2. LP-PC-01 Put cache marks where the provider needs them

    src/chrome/src/providers/aws-bedrock.js:164 · severity medium · saves prefill

    What happens. The Bedrock Converse payload has no cachePoint block, so Claude models on Bedrock also re-read the full system prompt and tools on every step. The cost meter already reads cacheReadInputTokens and cacheWriteInputTokens, but nothing ever writes a cache.

    The change. Add a {"cachePoint":{"type":"default"}} entry after the system text and after the tool list in _toBedrockPayload.

    Why it helps. Same loop as f1; Bedrock charges the discounted cache-read rate only for tokens before a cache checkpoint.

    Overlaps. Finding 1 loses some of the same tokens; the totals count the larger once.

    Estimate about 3M prompt tokens per 1,000 Bedrock-path calls (estimate)

    Assumptions. same prompt size as f1; Bedrock users are a small share of calls; the model must support caching and the prefix meets its minimum (512 to 4,096 tokens per the Bedrock page).

    Who reaches this. only users on AWS Bedrock Claude models

Other problems the audit found

Problems read in the code that cost no tokens of their own, such as a cost meter or an error path. Not scored.

  1. Helicone preset defaults to a model OpenAI retired in February 2026

    src/chrome/src/providers/provider-catalog.js:105

    What happens. The Helicone catalogue entry uses chatgpt-4o-latest as its default model. The OpenAI deprecations page lists chatgpt-4o-latest as shut down on Feb 17, 2026 with gpt-5.1-chat-latest as replacement. If the gateway forwards the id unchanged, a new Helicone setup fails until the user picks another model. The same entry exists in src/firefox/src/providers/provider-catalog.js:105.

    The change. Change the default (and its price fields) to a current model id, for example gpt-5.1-chat-latest or another from the suggestions list.

    To check. Select Helicone in Settings, press Test connection with an empty model field and a valid key; the test should pass.

The maintainers’ response

No response from the maintainers yet.

How this was made

The llm-call-audit skill read the code and wrote findings.json; nothing was run against the project’s providers. The full audit page is what leanprompt report --html writes from the same findings.

Corrections and takedown: email info@podwarden.com or open an issue.