DoorDash Cut Its LLM Search Costs by 98%.
It moved web search out of the model, and accuracy held.
DoorDash's engineering blog says its search-query system now grounds LLM answers in web results for 98% less search spend, at the same accuracy. The move: take web search out of the model provider's API and put it behind one gateway that DoorDash controls.

Copy the recipe
Paste this into your coding agent.
# 1. Find it
List every LLM call in this repo that turns on the provider's built-in search (web_search, google_search grounding, or similar). For each: what it asks, what format it must return, how often it runs.
# 2. Measure it
Log search cost and latency per query, apart from model tokens.
# 3. Build one search tool every call shares
normalize query
-> exact cache -> semantic cache
-> providers: primary, then fallbacks
-> return {title, url, snippet} as a tool result
Cache per provider. Short TTL for fresh facts. Make result count a setting; start at 6.
# 4. Prove it
Run 500+ labelled queries both ways. Keep built-in search as one provider for freshness-heavy queries. Report accuracy and search cost per 1,000 queries.
The numbers
Same answers, under 2% of the search bill.
DoorDash tested its query intent system, which decides what a shopper's search means, on two sets. The baseline was Gemini Flash with Google search grounding built in. The new path used the same model with Serper behind the gateway.
| Test set | Built-in search | Gateway + Serper |
|---|---|---|
| Retail, 7,988 queries | 93.40% right, $7.90 per 1,000 | 93.90% right, $0.110 per 1,000 |
| Long tail, 2,335 queries | 87.62% right, $10.37 per 1,000 | 87.79% right, $0.146 per 1,000 |
A warm cache did the rest. On a second pass over the same queries, the hit rate rose from 6.2% to 99.4%, average latency fell from 4,570 ms to 1,465 ms, and search cost fell from $0.7385 to $0.0045 per 1,000 queries.
What sits in the gateway
Seven steps, in the order a query hits them.
- Normalize the query, so trivial rewordings share a cache entry.
- Exact cache. A hit returns with no provider call.
- Semantic cache. Reuse a past result with a close enough embedding.
- Provider chain. Serper, BrightData, Firecrawl, Exa or Tavily, with fallback on timeouts and errors.
- Normalize results to title, source URL and snippet.
- Write both caches, per provider, with a TTL set by how fast the answer goes stale.
- Return a tool response, and log provider, cache outcome, depth, latency and cost.
New providers plug in through a YAML adapter with no code change. The gateway speaks MCP, so any agent can call it. Because the cache is shared, a query one team pays for is free for the next.
Search made the model chatty
A bug you may already have.
Many of DoorDash's LLM calls must return bare JSON, an enum or a yes or no. With built-in search on, models stopped obeying. On the HotpotQA benchmark, Claude Sonnet 4 with native search broke an explicit "answer only" instruction 78.1% of the time, opening with lines like "Based on the search results". DoorDash says returning evidence as a tool result largely avoided that, though not completely.
Public benchmarks agree, mostly
Close on accuracy, not on fresh news.

DoorDash also ran five models (GPT-4o, GPT-4o-mini, Gemini 2.5 Flash, Gemini 2.5 Pro, Claude Sonnet 4) on three public benchmarks. Built-in search kept a small accuracy edge there. On SimpleQA it cost $20 per 1,000 queries, against $0.67 to $1.80 through the gateway. On SimpleQA, raising results per query from 2 to 6 lifted average accuracy from 78.7% to 84.9%; going to 10 added 0.6 points.
Where built-in search still wins
- Fresh facts. On FreshQA, native search beat the gateway on all five models.
- Multi-step questions. On HotpotQA, search of either kind helped only a little.
- Vendor risk. Search API prices can change; DoorDash calls the interface, not the price, the lasting result.
What we could not check
All numbers are DoorDash's own evaluation; we did not rerun it. The 98% covers search-provider charges only, not model tokens, and DoorDash gives no total spend or traffic volume. This follows Spotify's 90% Claude Code token cut and our guide to routing tasks by model.
What's next
- Run the prompt above on every repo that calls an LLM with search on.
- Log search cost per query, apart from model tokens.
- Test one search API against built-in search on 500 of your own queries.




GPT-6 Astra