TokenSave Data · Dataset
How many tokens does an AI web search cost? Claude Code vs Codex
With web search on, a one-line fact question cost 150,414 input tokens in Claude Code and 33,296 in Codex. Across four kinds of question Claude Code used 150,414 to 372,216 input tokens and Codex 33,296 to 99,584.
Measured 2026-10-18 · 4 questions · search on, 2 runs each · License CC BY 4.0 · Related: Claude Code vs Codex startup tokens
DOI 10.5281/zenodo.23449842 · Also on Hugging Face · Kaggle · GitHub
Key findings
- Search is the expensive part of an answer. With every tool off, the same questions cost Codex 15,545 to 55,450 input tokens; turning search on added 65% to 207%.
- Claude Code runs a second model for the web. During searches and page reads a smaller Claude model (Haiku) processed the results; that helper accounted for 13% to 26% of Claude Code’s input tokens.
- Research-style questions cost the most. The tokenizer question took Claude Code 372,216 input tokens on average with 2.5 searches and 6 page opens.
- Different tools look at different web. For the news question Codex’s results were led by reddit.com and Claude Code’s by en.wikipedia.org, and the two cited almost no sources in common. For prices both cited only the official pages.
- Without search both tools declined the news question instead of guessing. On the price question Claude Code said it was answering from memory; Codex named the pricing page as its source although it had not opened it.
- Turning search off is not simple. With only the search tool blocked, Claude Code fetched pages with shell commands and Codex used other built-in tools to reach the web; we had to switch off every tool for the no-search runs.
Tokens and searches per question
Averages of two runs with web search on. The last column is the same question with all tools switched off, for reference.
| Question | Tool | Input tokens | Output tokens | Searches / page opens | Time | Input, no tools |
|---|---|---|---|---|---|---|
| Simple fact | Claude Code (Opus 5.5) | 150,414 | 1,526 | 1.5 / 0 | 23 s | 2,985 |
| Simple fact | Codex (gpt-6-luna) | 33,296 | 108 | 1 / 0 | 10 s | 15,545 |
| Recent news | Claude Code (Opus 5.5) | 180,111 | 5,273 | 3 / 0 | 34 s | 2,982 |
| Recent news | Codex (gpt-6-luna) | 68,191 | 440 | 2 / 0 | 15 s | 41,424 |
| Price comparison | Claude Code (Opus 5.5) | 178,710 | 14,874 | 0 / 6.5 | 64 s | 2,999 |
| Price comparison | Codex (gpt-6-luna) | 99,584 | 680 | 2 / 1 | 22 s | 55,450 |
| Research question | Claude Code (Opus 5.5) | 372,216 | 11,056 | 2.5 / 6 | 80 s | 2,993 |
| Research question | Codex (gpt-6-luna) | 85,118 | 594 | 2 / 0.5 | 20 s | 27,741 |
Sites seen and cited
Unique sites in the search results and fetched pages (average per run), the sites that came up most, and every site cited in the final answers.
| Question · tool | Sites seen | Most seen in results | Cited in the answer |
|---|---|---|---|
| Simple fact Claude Code | 8 | support.claude.com, claude.com, morphllm.com | claude.com, support.claude.com |
| Simple fact Codex | 2 | support.anthropic.com, anthropic.com | anthropic.com, support.anthropic.com |
| Recent news Claude Code | 20 | en.wikipedia.org, llmgateway.io, letsdatascience.com | axios.com, blog.google, clone-systems.com, dev.to, es.euronews.com, llmgateway.io, research.meta.ai |
| Recent news Codex | 34 | reddit.com, en.wikipedia.org, tomshardware.com | about.fb.com, artificialwatch.com, blog.google, blogs.nvidia.com, reflection.ai, themodelgap.com |
| Price comparison Claude Code | 20 | platform.claude.com, aistudio.google.com, ai.google.dev | ai.google.dev, claude.com, developers.openai.com, platform.claude.com |
| Price comparison Codex | 8 | ai.google.dev, developers.openai.com, anthropic.com | ai.google.dev, anthropic.com, developers.openai.com |
| Research question Claude Code | 39 | dev.to, media2.dev.to, assets.dev.to | arxiv.org, dev.to, github.com, hiai.korea.ac.kr, jangwook.net, proceedings.neurips.cc |
| Research question Codex | 20 | reddit.com, arxiv.org, platform.openai.com | huggingface.co, jangwook.net, platform.claude.com, platform.openai.com, zolamir.com |
Questions
- Simple fact: “What is the current monthly price of the Claude Pro plan in the United States? Answer in one sentence and cite your source.”
- Recent news: “Summarize the three most important AI model releases announced in the past 7 days, one sentence each, with a source link for each.”
- Price comparison: “Compare the current API prices per million input and output tokens of the flagship models from Anthropic, OpenAI and Google. Use official pricing pages and cite them.”
- Research question: “How many more tokens does Korean text need than the same English text on OpenAI and Claude tokenizers? Give numbers and cite your sources.”
Method
- Both tools on the same Windows laptop, effort medium, each run in its own empty folder, prompts sent through standard input.
- Claude Code 2.1.295 (Opus 5.5, Max plan):
claude -p --output-format stream-json --verbose --allowedTools WebSearch WebFetchwith no MCP servers. Input tokens are summed over every model in the run, including the helper model that reads fetched pages. - Codex CLI 0.162 (gpt-6-luna, ChatGPT plan):
codex --search exec --json. Searches and page opens are the web-search items in the log. - No tools: Claude Code with
--tools ""; Codex with-c web_search="disabled"and apps, plugins, in-app browser and skill search disabled.
Limitations
- Four English questions, two runs each, on one day; search results change over time, and runs varied (Claude Code’s two research runs differed by 34%).
- Default models and per-token prices differ, and most Claude Code input is cached, so token counts are not costs.
- “No tools” removes Claude Code’s built-in tool definitions as well as search, so it is a lower bound, not the cost of search alone.
- Other languages will be covered in a separate dataset; Cursor will be added later.
How to cite
Free to use, quote and republish with attribution under CC BY 4.0. Please link to this page.
TokenSave (2026). Web search in Claude Code and Codex: tokens, searches and sources per question [Data set]. Zenodo. https://doi.org/10.5281/zenodo.23449842
Embed the chart
Related
- Claude Code vs Codex: startup tokens and the same coding task
- PDF token cost per page
- Check your own Claude Code and Codex usage
Questions or corrections: contact@jonhisking.com