We earn a reward if you sign up to SayGM through our links. Your price is the same.
LessPerToken

Blog › Token saving, part 2

We audited GPT Researcher's LLM calls: a caching miss from two quote marks, and 4 other leaks

Part 1 listed six ways to cut an LLM bill. This time we took one real, popular open-source agent and looked for wasted tokens line by line. The biggest finding was a caching miss caused by two prompts that differ by two quote marks.

Part 2 of a series on spending less per token. Read part 1: six token-saving techniques first if you're new to caching.

The project and how we checked it

GPT Researcher is an open-source agent that searches the web, reads sources and writes a cited report. A single "detailed report" fires many model calls: planning, a subtopic list, research for each subtopic, draft section titles, the subtopic reports, an introduction and a conclusion. That makes it a good place to look for waste.

We ran our free LLM cost audit skill on the code at commit 9d39a2f (23 November 2026), then read every flagged call by hand. We did not run the agent, so token counts below are estimates from its default settings, and we say so wherever a number depends on them.

What it already does well: every call has an output limit, it records token usage from the API instead of guessing, and the main context is compressed to the most relevant chunks before it reaches the model. This is a careful codebase. The findings are the kind that survive code review, because none of them look like bugs.

1. Two quote marks, no cache hit

For each subtopic, GPT Researcher makes two calls in a row with the same system message and the same research context: one drafts section titles, the next writes the subtopic report. That context is roughly 5,500 tokens (up to 5 chunks of about 1,000 characters for each of 4 search queries), well above the size where prompt caching kicks in.

The second call should read that context from cache. It can't, because the two prompts open differently:

CallFirst line of the user message
Draft section titles"Context":
Subtopic reportContext:

A cache only matches an identical prefix. Two quote marks are enough to make every token after them count as new. The same thing happens one level up: the introduction and the subtopic list both send the main research context, but one puts the context first and the other puts the task first.

The fix: start every prompt that shares context with the same bytes

PREFIX = 'Context:\n"{context}"\n\n'   # identical in every call that shares it

titles_prompt = PREFIX.format(context=ctx) + titles_instructions
report_prompt = PREFIX.format(context=ctx) + report_instructions

What it's worth: OpenAI lists GPT-6.1 and GPT-6.2 Sol at $2.00 per million input tokens and $0.10 cached. With four calls per detailed report able to reuse the context, that's about $0.04 per report, or $42 per 1,000 reports, from changing a few characters. An estimate, but the direction isn't in doubt.

2. The big model, thinking hard, for small jobs

The subtopic list (three short headings by default) and the deep-research follow-up questions are generated with reasoning_effort="high". On reasoning models, thinking tokens are billed as output, $10 per million on Sol, and high effort can spend thousands of them before writing a short list.

Small jobs also go to the big model. Picking the agent persona at the start of a run, a tiny JSON answer, uses the Smart model. A cheaper Fast model is configured, but in the text pipeline it isn't used at all; only image prompts use it.

The fix: try low or medium effort for list-making, and send the persona choice to the Fast model. One trade-off: keep draft titles on the same model as the subtopic report, because after fix 1 the titles call is what fills the cache. We can't put a number on this without real traces, which is exactly why it's worth measuring.

3. Ten paid retries for the same empty answer

When a reasoning model spends its entire token budget thinking, the reply comes back empty, and you're still billed for it. GPT Researcher's helper retries an empty reply up to 10 times (unless it's streaming to the browser), with the same prompt and the same budget. If the budget was too small the first time, it's usually too small the ninth time too.

The fix: retry once, with more room

if not response and attempt == 1:
    max_tokens *= 2            # or lower reasoning_effort
    continue
raise EmptyResponse()

This is rare, but when it happens it costs up to ten times the call, and nobody notices because the run eventually succeeds or fails quietly.

4. The cost tracker shows the wrong numbers

GPT Researcher reports what each run cost, which is great. But the price table it uses has drifted:

  • Cached tokens are priced at 50% off. On GPT-6.x Sol the cached rate is 95% off, so the tracker shows cached input at ten times its real cost, and a caching fix would barely move the number users see.
  • gpt-6.2-sol isn't in the table, so it falls back to $5 / $15 per million instead of $2 / $10.
  • There are no Claude 5.x prices at all.

A tracker that's off by 2× to 10× is worse than none, because people optimise against it. If your app shows costs, load prices from a file you update, and check the cache rate per model.

5. Where the tokens are bought

GPT Researcher already reads OPENAI_BASE_URL, so changing where it buys tokens is one environment variable. Today SayGM lists GPT-6.2 Sol at $0.94 input and $4.69 output per million tokens, against OpenAI's $2.00 and $10.00: about 53% below list. The same caveat as always: on GPT, Claude and Gemini the model maker still processes the prompt whichever gateway you use.

Disclosure: we earn a reward if you sign up to SayGM through our links. Your price is the same.

Summary

#FindingFixEffort
1Shared context, different first line, no cache hitIdentical prefix in every call that shares contextMinutes
2Big model and high reasoning effort on small jobsLower effort, send persona choice to the Fast modelMinutes, plus testing
3Up to 10 identical paid retries on empty repliesRetry once with more budgetMinutes
4Cost tracker 2× to 10× offUpdate prices and cache ratesAn hour
5Tokens bought at list priceCompare per-token pricesOne env variable

What it adds up to

Our estimate for one detailed report (three subtopics) with the default settings, counting model calls only:

StepPer reportPer 1,000 reports
As it runs today$0.36$364
+ Fix 1: shared prefix, context read from cache$0.32$322 −12%
+ Fix 2: lower effort on the subtopic list, persona on the Fast model$0.29$294 −19%
+ Fix 5: GPT-6.2 Sol bought through SayGM$0.23$227 −38%

So the code changes alone save about a fifth, for less than an hour of work, and where the tokens are bought roughly doubles that. Fixes 3 and 4 aren't counted: retries only cost money when replies come back empty, and a better tracker shows costs rather than cutting them.

How we got these numbers: about 5,500 tokens of research context per researcher; 14 calls per report (persona, 4 sets of search queries, introduction, subtopic list, conclusion, and titles plus a report for each subtopic); output including reasoning tokens of roughly 650 to 3,100 tokens per call, with high effort on the subtopic list assumed to use about 2,400 more thinking tokens than low. Prices: GPT-6.1/6.2 Sol $2.00 input, $0.10 cached, $10.00 output (OpenAI); GPT-5.4 and GPT-5.4 mini from the project's own price table; SayGM's GPT-6.2 Sol price on 25 November 2026. Search and embedding costs are left out. Real numbers depend on the topic, so treat this as an order of magnitude and measure on your own runs.

Check your own project for the same things

  • Find calls that send the same large context and diff the first few hundred characters of their prompts.
  • Search for reasoning_effort and your big model's name, and ask whether each task really needs them.
  • Read your retry loop: does a retry change anything, or just pay again?
  • Compare your cost dashboard with your provider's invoice for one day.

Or let an agent do it: the LLM cost audit skill is free, runs locally and puts a dollar figure on each fix. This audit also showed us where the skill falls short: its scanner didn't recognise calls made through LangChain and the project's own wrapper, so we found these by reading the code. That's going into the next version.

Sources: GPT Researcher on GitHub (Apache 2.0, commit 9d39a2f), OpenAI API pricing, SayGM prices. Token counts are estimates from the project's default settings; we didn't run the agent.

Cut the waste, then pay less for what's left

One URL change. Keep OpenRouter as your backup.

Try SayGM