The discourse around trimming AI costs has focused on prompts. Lesser attention has been paid to the data the tools send back, even though that's where most tokens are spent. While developers focus on creating prompt libraries, counting tokens, and aiming for shorter messages, the payloads agents pull from APIs barely register a mention. It's a real blind spot.
Prompt tuning can feel like real work. You can cut down your prompt length. You can shave away words. The response you get back seems like it's beyond your control and so you don't think you need to clean it up, even though you'll wind up paying for every token it entails.
Probably because prompts seem to be the most under our control, the internet is chock-full of prompt-engineering tips. The shape of the incoming data is less of a concern. But the bill doesn't really care whether your prompt was on point. Even if you think you're making a dent, the JSON coming back has the last laugh. To make matters worse, many think that's unchangeable.
SerpApi now offers a new way of returning results that casts this difference into focus. With a single Google search for "coffee," the company could run a comparison. In full JSON, the result cost 24,723 tokens. Using Markdown results, that fell to 6,435 tokens. It was a 74 percent reduction, and there were zero changes to the prompt.
With a little more basic filtering, the JSON dropped to 8,486 tokens and Markdown dropped to 1,298. Keep in mind that the work undertaken was identical. Only the format of the data changed.
Markdown tables carry the same information as nested JSON, with fewer tokens and no brace-counting for your model
These are real head-to-head numbers from SerpApi's own comparison. Extrapolated, they could account for an average cost savings of around 50 percent across the company's 100+ APIs. For some endpoints—consider Google Shopping, Google Hotels, Apple Maps—it's closer to 90%.
There's no magic involved. SerpApi's Markdown feature drops the information that language models don’t need, such as tracking and redirect links, icons and favicon data, deeply nested metadata, and duplicate fields.
Where JSON can wrap every result in multiple objects, including position, title, thumbnail, snippet, source, and several link variants, Markdown puts the same facts into compact lines with inline links. Redirect URLs built for click tracking suddenly disappear. Favicon data that no LLM uses evaporates. And nested objects become flat, readable rows.
The model still gets all the titles, snippets, sources, and links it needs to reason, summarize, or extract. It just doesn’t pay the token tax for scaffolding designed for traditional parsers.
Token savings by API
SerpApi has noted that Markdown is not one size fits all. If your code needs exact types or strict JSON schemas, then JSON is the ticket. The real question developers face is a simple one: what consumes the response, a language model or a parser?
For agents, RAG pipelines, and chat tools, Markdown often does the same job for fewer tokens. For legacy systems that depend on rigid typing and field validation, JSON remains the safer bet.
So, ask which format fits the thing reading the data, not which format is "better" in the abstract.
If you want to try Markdown, you won't need a new stack. If an API supports Markdown, it's usually just a query parameter, a different route, or an Accept header. Run one API call your agent already makes in JSON, then run the exact same call in Markdown and count the tokens. If your flow is LLM-first and you don’t rely on exact JSON schemas, the lighter format will probably cut costs without even touching your prompts.
You can check any API returning verbose JSON the same way. Just grab a real response, measure the token weight, and ask whether a cleaner version would still work for your agent.
Prompt trimming has its limits. You can only cut so much before the instructions get way too vague. Most still haven’t pulled the other lever: the format of the data feeding those prompts.
Next time you look at your agent's costs, don't spend hours trying to perfect your prompt. Just ask what the search is actually costing you and see if a simpler format could do the same work for fewer tokens. If the answer is yes, you've just found a lever most in the industry still ignore. Why not pull it?
This article was published under HackerNoon's Business Blogging program.