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.
Jump to: Web search · Code execution · Web pages · File search · Hidden tokens
Web search and grounding: price per 1,000 searches
Cheapest first for the amount you enter
| Tool | Per 1,000 | Free allowance | 10K searches | Source |
|---|---|---|---|---|
web tools | $0.75 | None | $7.50 | Source for DeepSeek Search: DeepSeek pricing (opens in a new tab) |
web_search | $5 | None | $50.00 | Source for xAI Web search: xAI pricing (opens in a new tab) |
x_search | $5 | None | $50.00 | Source for xAI X search: xAI pricing (opens in a new tab) |
google_search | $14 | 5,000 searches a month, shared across Gemini 3 and newer models | $70.00 | Source for Google Grounding with Google Search: Gemini API pricing (opens in a new tab) |
google_maps | $14 | 5,000 a month, shared across Gemini 3 and newer models | $70.00 | Source for Google Grounding with Google Maps: Gemini API pricing (opens in a new tab) |
web_search | $10 | None | $100 | Source for OpenAI Web search: OpenAI pricing (opens in a new tab) |
web_search | $10 | None | $100 | Source for Anthropic Web search: Claude API pricing (opens in a new tab) |
web_search | $10 | None | $100 | Source for Z.ai Web search: Z.ai 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
| Tool | Fee | Free allowance and notes | Source |
|---|---|---|---|
code_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) |
code_execution | $0.05per container-hour | Free: 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) |
code_execution | No feetokens only | No 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) |
code_execution | $5per 1,000 calls | Runs 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
| Tool | Fee | Free allowance and notes | Source |
|---|---|---|---|
web_fetch | No feetokens only | No 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) |
url_context | No feetokens only | No fee; the page content is billed as input tokens. | Source for Google URL context: Gemini API pricing (opens in a new tab) |
web tools | $0.75per 1,000 calls | Billed 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
| Tool | Fee | Free allowance and notes | Source |
|---|---|---|---|
file_search | $2.50per 1,000 calls | Plus storage at $0.10 per GB a day, with the first 1 GB free. Responses API only. | Source for OpenAI File search: OpenAI pricing (opens in a new tab) |
collections_search | $2.50per 1,000 calls | Searches document collections you've uploaded. Searching files attached to a message (attachment_search) costs $5 per 1,000 calls. | Source for xAI Collections search: xAI pricing (opens in a new tab) |
file_search | No feetokens only | No per-search fee. Indexing is billed at embedding rates (Gemini Embedding, $0.15 per 1M tokens), and retrieved passages as input tokens. | Source for Google File search: Gemini API pricing (opens in a new tab) |
Hosted agent runtime
Charges for the hosted agent itself
| Tool | Fee | Free allowance and notes | Source |
|---|---|---|---|
managed agents | $0.08per session-hour | Per 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) |
agents | No feetokens only | Environment 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
| Added for | Input tokens | Per 1,000 requests on Claude Sonnet 5.5 |
|---|---|---|
| Tool use system prompt (tool_choice auto or none) | 286 | $0.57 |
| Bash tool definition | 325 | $0.65 |
| Text editor tool definition | 974 | $1.95 |
| Computer use toolset | about 4,500 | $9.00 |
| Browser use toolset | about 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
- AI agent cost calculatorTokens per task, with caching
- What an AI agent costs per taskGuide
- Embedding model pricingFor retrieval and RAG
- Best value AI modelsCheapest at each capability level
OpenAI API pricingModel prices per 1M tokens
Claude API pricingModel prices per 1M tokens
Gemini API pricingModel prices per 1M tokens
Grok API pricingModel prices per 1M tokens
DeepSeek API pricingModel prices per 1M tokens
GLM API pricingModel prices per 1M tokens
Sources: OpenAI pricing, Claude API pricing, Gemini API pricing, xAI pricing, DeepSeek pricing, Z.ai pricing. Checked 18 Nov 2026.