AI Token Price

AI agent tool pricing: web search, code and file search

Built-in tools cost extra on top of tokens. Web search runs from $0.75 per 1,000 searches (DeepSeek) to $14 (Google, after 5,000 free a month); OpenAI and Anthropic both charge $10. 20 tool fees from 6 providers, each checked on the provider’s own pricing page, 18 Nov 2026.

Web search and grounding: price per 1,000 searches

Cheapest first for the amount you enter

Tool fees for 10,000 searches a month, after free allowances.
Web search tool fees per 1,000 searches, free allowances, and the fee for a month of searches
ToolPer 1,000Free allowance10K searchesSource
Grounding with Google Searchgoogle_search$145,000 searches a month, shared across Gemini 3 and newer models$70.00Source for Google Grounding with Google Search: Gemini API pricing (opens in a new tab)
Grounding with Google Mapsgoogle_maps$145,000 a month, shared across Gemini 3 and newer models$70.00Source for Google Grounding with Google Maps: Gemini API pricing (opens in a new tab)

Tool fees only. The pages and snippets the model reads are billed as input tokens on top, except on Google, which doesn’t bill retrieved search content. X search is per 1,000 posts ($10 per 1,000 profiles); Maps grounding is per query.

Code execution

Billed by calls, by time or not at all

Code execution: fee per use, free allowance and what’s billed on top
ToolFeeFree allowance and notesSource
OpenAI Code Interpreter and Hosted Shellcode_interpreter, shell$0.03–$1.92per 20-minute session (1 GB–64 GB)Per 20-minute session per container, by memory size. Eligible sessions are billed by the minute, with a 5-minute minimum.Source for OpenAI Code Interpreter and Hosted Shell: OpenAI pricing (opens in a new tab)
Anthropic Code executioncode_execution$0.05per container-hourFree: 1,550 container-hours a month per organisation. Free when the request also uses the web search or web fetch tool. Otherwise billed by execution time with a 5-minute minimum, including when files preload a container that's never called.Source for Anthropic Code execution: Claude API pricing (opens in a new tab)
Google Code executioncode_executionNo feetokens onlyNo runtime fee. Generated code and results are billed as output tokens when written and input tokens when the model reads them.Source for Google Code execution: Gemini API pricing (opens in a new tab)
xAI Code executioncode_execution$5per 1,000 callsRuns Python in a sandbox.Source for xAI Code execution: xAI pricing (opens in a new tab)

Reading web pages

Fetching a page you name, rather than searching

Reading web pages: fee per use, free allowance and what’s billed on top
ToolFeeFree allowance and notesSource
Anthropic Web fetchweb_fetchNo feetokens onlyNo fee beyond the tokens of the fetched page: about 2,500 tokens for an average web page and 25,000 for a large documentation page, by Anthropic's estimate. Set max_content_tokens to cap them.Source for Anthropic Web fetch: Claude API pricing (opens in a new tab)
Google URL contexturl_contextNo feetokens onlyNo fee; the page content is billed as input tokens.Source for Google URL context: Gemini API pricing (opens in a new tab)
DeepSeek Web fetchweb tools$0.75per 1,000 callsBilled per fetch, plus the tokens the model reads.Source for DeepSeek Web fetch: DeepSeek pricing (opens in a new tab)

File search over your documents

Retrieval over files you upload

File search over your documents: fee per use, free allowance and what’s billed on top
ToolFeeFree allowance and notesSource

Hosted agent runtime

Charges for the hosted agent itself

Hosted agent runtime: fee per use, free allowance and what’s billed on top
ToolFeeFree allowance and notesSource
Anthropic Claude Managed Agents sessionmanaged agents$0.08per session-hourPer session-hour while the session is running; idle time isn't billed. Replaces code-execution container billing, and the Batch discount doesn't apply.Source for Anthropic Claude Managed Agents session: Claude API pricing (opens in a new tab)
Google Managed agents and Antigravity agentagentsNo feetokens onlyEnvironment compute (CPU, memory, sandbox) isn't billed during the preview; model tokens and tool fees are.Source for Google Managed agents and Antigravity agent: Gemini API pricing (opens in a new tab)

Hidden tokens: what declaring a tool adds

Every request, before your own tool definitions

Input tokens Anthropic adds to each request for tools on current Claude models, with their cost on Claude Sonnet 5.5
Added forInput tokensPer 1,000 requests on Claude Sonnet 5.5
Tool use system prompt (tool_choice auto or none)286$0.57
Bash tool definition325$0.65
Text editor tool definition974$1.95
Computer use toolsetabout 4,500$9.00
Browser use toolsetabout 6,600$13.20

Input tokens Anthropic adds to a request when tools are present, on current Claude models (Opus 5.5, Sonnet 5.5, Haiku 5.5), before your own tool definitions. At $2 per 1M input tokens, before caching; prompt caching cuts repeated tool definitions to a tenth or less. Other providers also bill tool definitions as input tokens but don’t publish counts. Claude API pricing

How tool billing works

  • Three costs, not one. A tool call can carry a per-use fee, the tokens of whatever the tool returns, and the tokens of the tool definitions sent with every request. The fee is the only part this page can compare directly; the tokens depend on your model, which our agent cost calculator prices.
  • Agents decide how often. The model chooses how many searches to run, so a hard question can trigger several. Cap the number of tool calls per task if your provider allows it.
  • Free allowances favour small projects. Gemini’s 5,000 free searches a month cover a prototype; Anthropic’s 1,550 container-hours cover most code execution. Past those, per-use fees take over.
  • Read the page, or search for it? Fetching a page you already know is free beyond tokens on Claude and Gemini, so when an agent has a URL, fetching is cheaper than searching.

Mistral's Agents API has web search and code interpreter tools, but its pricing pages don't list a separate charge for them.

Questions

How much does web search cost in the OpenAI API?

$10 per 1,000 calls to the web_search tool, plus the search content the model reads, billed at the model’s normal token rates. 10,000 searches a month cost $100 in tool fees.

How much does Claude’s web search tool cost?

$10 per 1,000 searches on the Claude API, plus the results, which count as input tokens. A search that fails isn’t billed. Anthropic’s web fetch tool has no fee beyond tokens, and code execution is free when used alongside web search or web fetch.

How much does Gemini grounding with Google Search cost?

On Gemini 3 and newer models, the first 5,000 searches a month are free (shared across models), then $14 per 1,000. One request can trigger several searches, and each is billed. Gemini 2.5 models cost $35 per 1,000 grounded prompts instead.

What is the cheapest web search for an AI agent?

Among model providers’ built-in tools, DeepSeek’s at $0.75 per 1,000, then xAI’s at $5. For low volumes Gemini is free: its first 5,000 searches a month cost nothing. OpenAI and Anthropic charge $10.

Is code execution free?

On Gemini, yes: there’s no runtime fee, only tokens. Anthropic gives each organisation 1,550 free container-hours a month, then charges $0.05 an hour (and nothing when the request also uses web search or fetch). OpenAI charges per 20-minute container session by memory size, from $0.03, and xAI $5 per 1,000 calls.

Do search results count as input tokens?

Usually, yes. OpenAI, Anthropic and xAI bill what the model reads from search results at its input rate, which can cost more than the search fee itself on an expensive model. Google doesn’t bill retrieved search content as tokens; OpenAI’s older search preview tool on non-reasoning models doesn’t either.

When were these prices checked?

On 18 Nov 2026, on each provider’s own pricing page, linked from every row. Prices are US dollar pay-as-you-go rates before tax.

Price the rest of the agent

Sources: OpenAI pricing, Claude API pricing, Gemini API pricing, xAI pricing, DeepSeek pricing, Z.ai pricing. Checked 18 Nov 2026.