{"slug": "whats-actually-inside-24723-tokens-of-a-search-result-we-broke-it-down-field-by", "title": "What’s Actually Inside 24,723 Tokens of a Search Result? We Broke It Down, Field by Field", "summary": "SerpApi's new Markdown output cut a \"coffee\" search response from 24,723 tokens in JSON to 6,435 tokens, a 74 percent reduction, with further filtering bringing it to 1,298 tokens, according to SerpApi's documentation and examples. The Markdown format strips tracking links, icons, thumbnails, nested metadata, and duplicate fields while merging title and link into a single line, and SerpApi notes JSON remains the better choice for pipelines needing exact data types such as integer prices or float ratings. SerpApi has not published an exact token cost per field, and the before-and-after totals are the authoritative numbers.", "body_md": "# What’s Actually Inside 24,723 Tokens of a Search Result? We Broke It Down, Field by Field\n\nSee how SerpApi’s Markdown output can cut search-result token usage by up to 74%, reducing AI agent costs and context-window overhead.\n\n \n\n \n\nIt's no secret that AI agents burn massive amounts of tokens on search results and file retrievals. They pull in dozens of full-length files, logs, and comment blocks, and just reading through those matches can consume tens of thousands of tokens, not to mention the recursive loops that lock in when the agent reruns a query.\n\nJust a simple search like \"look up coffee shops\" can balloon into a payload of nested objects, tracking links and metadata. Much of this data never even gets used by the model. You still wind up paying for each token. However, there are ways to minimize token usage.\n\n[SerpApi](http://serpapi.com/?utm=machinelearningmastery) now offers Markdown output that supports a radical trimming of token sizes. Using conventional JavaScript Object Notation (JSON), a search for \"coffee\" resulted in a response that required 24,723 tokens. Using Markdown, the same search only used 6,435 tokens. That's a 74 percent reduction and there is more to be gained, as further filtering can require just 1,298 tokens for a more restricted view. That reduction can make the AI model more efficient, reduce costs, or allow other information to stay in the context window.\n\n \n\n \n\n## JSON vs. Markdown\n\nBut how does it work? [SerpApi's Markdown](https://serpapi.com/markdown-output) output retains the informational content but strips or reshapes the parts that inflate token count without helping a model reason. Based on SerpApi's documentation and examples, here’s what typically gets removed or transformed:\n\n- Tracking links and internal SerpApi URLs: JSON responses often include `serpapi_link` ,`serpapi_amazon_link` , and similar fields used for refining queries or performing follow-up searches inside SerpApi’s own system. Markdown output removes this internal routing noise and keeps only the user-facing links.\n- Icons and thumbnails: Many result objects carry icon, thumbnail, or image URLs that are useful for user interfaces, but add tokens without aiding an LLM's understanding. Markdown eliminates these by default.\n- Nested metadata and duplicate fields: JSON preserves the data’s full structure, including pagination objects, search metadata, per-result additional arrays, and repeated fields across sections. Markdown flattens this into tables, YAML frontmatter, and inline links.\n- Title/link separation: In JSON, the title and link are separate keys, often accompanied by `displayed_link` ,`snippet` , and other variants. Markdown merges these into a single, human-readable line with a native link, reducing key names and structural overhead.\n\nSerpApi has not published an exact token cost per field; the before-and-after totals (from 24,723 to 6,435) are authoritative numbers. The pattern, however, is clear: anything that exists for code to parse or a UI to render, but not for a model to read, is prime token waste.\n\n## Where Markdown Isn’t the Right Fit\n\nMarkdown output is optimized for LLMs and AI agents, but not for code that needs exact data types. If your pipeline depends on precise numeric prices, coordinates, ratings as floats, or structured arrays for downstream processing, JSON remains the better choice. It relies on the same data, and the same credits. It just provides a different shape depending on who's reading it.\n\nFor example, a Naver Shopping result in JSON exposes `price`, `old_price`, `coupon_price` as integers and `rating` as a float, along with `reviews` and `stores` fields. That's ideal for a pricing engine or analytics job. For an agent that only needs to summarize top products, those typed fields are overkill; Markdown's table rows and inline links carry the signal with far fewer tokens.\n\n## How SerpApi Solves It\n\nSerpApi addresses this directly with a single switch, available through a query parameter, route extension, or header. You can request Markdown output by:\n\n- Adding `output=md` to your existing search call, or\n- Calling the `/search.md` endpoint instead of`/search` , or\n- Setting the `Accept: text/markdown` request header.\n\nThis is available across all 100+ SerpApi APIs at no extra cost, and it returns YAML frontmatter, structured tables, and native inline links while automatically stripping internal tracking noise and duplicate fields. If you also need tighter control, SerpApi’s `json_restrictor` (or `--fields` in the CLI) lets you select only specific keys server-side, reducing payload size before it crosses the network.\n\n## Check It on Your Own Data\n\nYou don’t have to take benchmark numbers on faith, by the way. Just try one query you already run, add `output=md`, and count the tokens before and after on your own response. Then try a restricted field set via `json_restrictor` and measure again. The delta is your real-world savings, specific to your engine and workflow.\n\n## Is It Time for Markdown?\n\nMarkdown isn't a panacea. But it is true that the shape of your data has a token cost most people never look at, and it's worth checking wherever data feeds into a model, and not just with SerpApi. In agentic systems, small per-call bloat compounds fast and measuring and reshaping your payloads is one of the better moves you can make. If you are interested in seeing what Markdown can do and comparing it to JSON, have a look at SerpApi's [new feature here](https://serpapi.com/markdown-output).", "url": "https://wpnews.pro/news/whats-actually-inside-24723-tokens-of-a-search-result-we-broke-it-down-field-by", "canonical_source": "https://www.kdnuggets.com/2026/09/prnews.io/whats-actually-inside-24723-tokens-of-a-search-result-we-broke-it-down-field-by-field", "published_at": "2026-09-17 17:25:01+00:00", "updated_at": "2026-09-17 18:55:53.031906+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "ai-infrastructure", "structured-data", "ai-search"], "entities": ["SerpApi", "Markdown", "JSON", "Naver Shopping"], "alternates": {"html": "https://wpnews.pro/news/whats-actually-inside-24723-tokens-of-a-search-result-we-broke-it-down-field-by", "markdown": "https://wpnews.pro/news/whats-actually-inside-24723-tokens-of-a-search-result-we-broke-it-down-field-by.md", "text": "https://wpnews.pro/news/whats-actually-inside-24723-tokens-of-a-search-result-we-broke-it-down-field-by.txt", "jsonld": "https://wpnews.pro/news/whats-actually-inside-24723-tokens-of-a-search-result-we-broke-it-down-field-by.jsonld"}}