# What server-side tools cost an AI agent: search, fetch, sandboxes

URL: https://infro.io/blog/ai-agent-tool-call-costs
Author: INFRO Editorial (https://infro.io/blog/editorial)
Publisher: INFRO
Published: 2026-10-27
Last modified: 2026-10-27
Last reviewed: 2026-10-27 (next review due 2026-11-26)
Topic: Cost and FinOps
Format: Guide

> Server-side tools bill on top of tokens. As of 27 October 2026, OpenAI and Anthropic charge $10 per 1,000 web searches, Gemini charges $14 per 1,000 grounding queries after 5,000 free a month, and DeepSeek's Search and Fetch APIs cost $0.75 per 1,000 successful calls each, billed for calls made through DeepSeek Harness, Claude Code and Codex from 31 October at 16:00 UTC. Search results then re-enter context as input tokens on every later turn, which usually costs more than the search fee. Count calls from each provider's usage fields and cap them with max_uses, max_tool_calls or a run-level guard.

Key takeaways:
- Hosted web search costs $10 per 1,000 calls at OpenAI and Anthropic, $14 per 1,000 queries at Gemini after a monthly free allowance, and $0.75 per 1,000 at DeepSeek, which starts billing agent-harness calls on 31 October 2026 at 16:00 UTC.
- The bigger cost is usually the results: Anthropic and OpenAI bill retrieved content as input tokens, and in an agent loop that content is re-read on every later turn.
- Sandboxes bill by time and memory: OpenAI containers from $0.03 per 20-minute session for 1 GB; Anthropic code execution is free with its newer search and fetch tools and otherwise $0.05 per container-hour after 1,550 free hours.
- Count calls from the response, not from your own logs: Anthropic reports usage.server_tool_use.web_search_requests, OpenAI emits web_search_call items, and Gemini may run several queries per request.
- Cap per request with Anthropic's max_uses or OpenAI's max_tool_calls, and per run with a guard in your own loop; neither provider cap knows about the rest of the run.

A server-side tool is one the provider runs for you inside the model call: web search, page fetch, a code sandbox. Each has its own price on top of tokens, and in October 2026 the per-call rates run from $0.75 to $14 per 1,000 calls. The fee is rarely the largest part of the bill. What a search returns becomes input tokens, and in an agent loop those tokens are re-read on every later turn. This guide lists what each provider charges, works through one agent run, and shows how to count and cap tool calls before a loop does it for you.

The timing is not abstract. DeepSeek opened its Search and Fetch APIs on 17 October at $0.75 per 1,000 calls per endpoint, and said the server-side tool calls its models make through DeepSeek Harness, Claude Code and Codex, free until now, start billing on 31 October 2026 at 16:00 UTC[1][2]. Teams running coding agents on DeepSeek get a new line item next week.

## What each provider charges for hosted tools

| Provider | Tool | Price | What else bills |
| --- | --- | --- | --- |
| OpenAI | Web search (`web_search`, all models) | $10 per 1,000 calls | Search content tokens at the model's rates[3] |
| OpenAI | Web search preview, non-reasoning models | $25 per 1,000 calls | Search content tokens free[3] |
| OpenAI | File search | $2.50 per 1,000 calls; storage $0.10 per GB a day, 1 GB free | Retrieved tokens[3] |
| OpenAI | Hosted Shell and Code Interpreter containers | $0.03 (1 GB), $0.12 (4 GB), $0.48 (16 GB), $1.92 (64 GB) per 20-minute session | Model tokens[3] |
| Anthropic | Web search | $10 per 1,000 searches | Results as input tokens, this turn and later turns[4] |
| Anthropic | Web fetch | No extra charge | Fetched content as tokens[4] |
| Anthropic | Code execution | Free with `web_search_20260209` or `web_fetch_20260209` and later; otherwise 1,550 free hours a month, then $0.05 per container-hour | Model tokens[4] |
| Google | Grounding with Google Search (Gemini 3 and newer) | 5,000 free requests a month, then $14 per 1,000 | One request can run several billed queries[5] |
| DeepSeek | Search API, Fetch API | $0.75 per 1,000 successful requests each | Results the agent passes back as model tokens[6] |
| AWS Bedrock | Web Search (Responses API on `bedrock-mantle`) | Charged per query; no rate shown on the pricing page read | Observations as input tokens[7][8] |

Table: Server-side tool prices on each provider's pricing page, read 2026-10-27.

A few billing rules change the arithmetic more than the headline rate does.

**What counts as a call.** Anthropic counts each web search as one use "regardless of the number of results returned", and does not bill a search that errors[4]. DeepSeek bills a request only when it returns HTTP 200 with a result: "Failed requests, empty search results, and timeouts are not billed", and the `count` of results does not change the price[6]. Google warns that one customer request "may result in one or more queries to Google Search", each billed[5].

**Where the results go.** Anthropic says search results "are counted as input tokens, in search iterations run during a single turn and in subsequent conversation turns"[4]. OpenAI defines web search content tokens as "tokens retrieved from the search index and fed to the model alongside your prompt"[3]. Bedrock's `search_context_size` sets how many observations a search returns, 5, 11 or 25, and AWS notes it "does not limit how many Search calls the model can make"[8].

**Idle sandboxes.** Since 9 October, OpenAI bills hosted sandbox compute in the Agents API only during active turns, not for idle time between turns, and added pre-warming[9]. Those sandboxes use the standard container rates; sizes run from `small` (1 vCPU, 1 GB) to `large` (4 vCPU, 16 GB), with `medium` the default[10]. Eligible container sessions bill by the minute with a 5-minute minimum[3].

## What one agent run costs

> **Example: A research agent run on Claude Sonnet 5.5, at list rates**
> A run makes 12 model calls and 8 web searches. Each search adds about 3,000 tokens of results, and the agent keeps them in context, so by the end of the run the searches have been re-read many times. Assume the run's 12 calls send 180,000 input tokens in total, of which 120,000 are search results being read again, and produce 6,000 output tokens. Sonnet 5.5 lists $2 input and $10 output per million tokens.
> 
> - Search fees: 8 × $10 / 1,000 = $0.08.
> - Input tokens: 180,000 × $2 / 1M = $0.36, of which $0.24 is the search results.
> - Output tokens: 6,000 × $10 / 1M = $0.06.
> - Run total: $0.50, and the search results cost three times their own fee.
> 
> If the same 120,000 re-read tokens hit the prompt cache, Anthropic bills cache reads on Sonnet 5.5 at $0.10 per million, so that part falls from $0.24 to about $0.012 (cache writes bill extra and are left out here). The same 8 searches plus 5 page fetches through DeepSeek's APIs would cost 13 × $0.75 / 1,000 = about $0.01 in fees. All token counts are assumptions; measure yours from the usage fields.

The lesson for budgeting is to model three numbers per run, not one: calls per run, tokens each call returns, and how many later turns carry those tokens. A lower per-search fee does not help much if the agent pastes ten full pages into context and keeps them there.

Anthropic offers two levers aimed at this. With `web_search_20260209` and later, Claude writes code that filters results before they reach the context window, which Anthropic says "reduces token use on search-heavy requests", with no extra charge for the code execution this needs[11][4]. And `response_inclusion: "excluded"` drops nested search and fetch result blocks from the response when a completed code execution call already consumed them, reducing output token costs[11][12].

## How to count tool calls

Count from what the provider reports, per request, and attach the count to the run:

1. **Anthropic.** Read `usage.server_tool_use.web_search_requests` on each response[11].
2. **OpenAI.** Count `web_search_call` output items whose action is `search`; OpenAI notes that search actions incur the tool call cost[13]. Container sessions are counted by time, not by call.
3. **Gemini.** Count grounding queries, not requests, because one request can trigger several billed queries[5].
4. **DeepSeek.** Count successful Search and Fetch requests; if your harness calls the APIs directly, your own HTTP log is the count, and from 31 October so is DeepSeek's bill[6].
5. **Bedrock.** Billing is per query[7]; AWS also records Web Search activity as CloudTrail data events when that logging is on[8].

Then sum per run. A per-request count tells you whether one call misbehaved; a per-run count tells you whether the agent design is affordable.

## How to cap them

**Per request.** Anthropic's web search and web fetch tools take `max_uses`; past it, the tool result is an error with code `max_uses_exceeded`[11]. OpenAI's Responses API takes `max_tool_calls`, "the maximum number of total calls to built-in tools that can be processed in a response", applied across all built-in tools together; further attempts are ignored[14]. OpenAI's `return_token_budget` controls how much search content a run may return, and its `unlimited` setting "can increase latency and cost"[13].

**Per source.** Domain filters shrink what a search can pull in. OpenAI's `web_search` takes up to 100 `allowed_domains` or `blocked_domains`[13]; Anthropic takes `allowed_domains` or `blocked_domains`, not both[11]; and since 23 October Bedrock Web Search takes up to 100 allowed or 100 blocked domains plus an optional user location, in US East (N. Virginia), US East (Ohio), US West (Oregon) and AWS GovCloud (US-West)[15].

**Per run.** No provider cap knows what the rest of the run already spent. Keep a counter in your agent loop for tool calls and for input tokens, and end the run when either passes its limit. The [run guard in the agent loops guide](https://infro.io/blog/bound-ai-agent-loops) does this for steps, tokens and wall-clock time; add tool calls to the same guard.

**Per account.** DeepSeek enforces Search and Fetch rate limits per account, independently of each other and of model concurrency, and answers `429` past them[6]. A shared account means one runaway agent can throttle every other team's searches.

## What to ask before turning on hosted tools

- Which tools does each agent actually need, and is a lower-priced or free option available (Anthropic's web fetch, DeepSeek's APIs) for the same job?
- What is our expected calls-per-run, and what is the ceiling we will enforce?
- Do results stay in context for the rest of the run, or does the agent summarise and drop them?
- Who sees the provider's tool line items each month, and do they reach the same budget owner as the token spend?

## Keeping agent runs inside a budget with INFRO

INFRO is a control plane in front of the provider accounts you already hold; your providers bill you directly, including for every hosted tool, and INFRO's charge is a software subscription.

For model calls that pass through it, INFRO helps with the token side of this problem. Tag each call with `metadata.trace_id`, `workflow` and `step`, and `GET /v1/traces/{trace_id}` returns every request in the run with its estimated provider cost, so the growth in input tokens from re-read results shows step by step ([tracing an agent run](https://infro.io/blog/trace-ai-agent-runs)). A gateway key per agent can carry a spend limit, checked before each call, so a loop stops at a ceiling rather than at the invoice. For tools you host yourself as MCP servers, INFRO's MCP gateway records each tool call on the trace and enforces per-key and per-server rate limits.

What it does not do: INFRO's estimates are built from the tokens and units it can see, and they exclude provider-side surcharges such as a web search fee, a grounding query or a container session. Its budgets act on that estimate, not on the provider's invoice. Keep the provider's own usage reports and billing alerts on for hosted tools.

## Questions

### How much does web search cost in the OpenAI and Claude APIs?

Both list $10 per 1,000 calls as of 27 October 2026, plus tokens. OpenAI bills the search content tokens at the model's rates for its current web_search tool; Anthropic bills search results as input tokens, in the turn that searched and in every later turn that carries them. OpenAI's older web_search_preview tool on non-reasoning models is $25 per 1,000 calls with content tokens free.

### When does DeepSeek start charging for tool calls?

DeepSeek's release note says Search and Fetch calls made through server-side tools in DeepSeek Harness, Claude Code and Codex are free until billing starts on 31 October 2026 at 16:00 UTC (00:00 Beijing time on 1 November). Each endpoint costs $0.75 per 1,000 successful requests; failed requests, empty search results and timeouts are not billed.

### How do I limit how many times an agent searches?

Per request, Anthropic's web search and web fetch tools take max_uses, and OpenAI's Responses API takes max_tool_calls, which caps all built-in tool calls in one response together. Per run, keep a counter in your own agent loop and stop the run when it passes your limit; a provider's per-request cap does not know how many requests the run has already made.

### Is code execution billed per call?

No, by time. OpenAI bills Hosted Shell and Code Interpreter containers by memory size per 20-minute session, by the minute with a 5-minute minimum for eligible sessions, and its hosted sandboxes in the Agents API now bill only during active turns. Anthropic's code execution is free when used with its newer web search or web fetch tool versions; otherwise each organization gets 1,550 free hours a month and then pays $0.05 per container-hour.

### Does INFRO include web search fees in its cost estimates?

No. INFRO estimates provider cost from tokens and units it can see in each request. Provider-side surcharges such as a built-in web search fee or a container session are outside that estimate, so its budgets act on a figure that excludes them. Keep the provider's own usage reports and billing alerts for those charges.

## Sources

1. DeepSeek-V4.1-Flash-1017 release — DeepSeek. https://api-docs.deepseek.com/news/news261017/ (accessed 2026-10-27)
2. Models & Pricing — DeepSeek. https://api-docs.deepseek.com/quick_start/pricing/ (accessed 2026-10-27)
3. Pricing — OpenAI. https://developers.openai.com/api/docs/pricing (accessed 2026-10-27)
4. Pricing — Anthropic. https://platform.claude.com/docs/en/about-claude/pricing (accessed 2026-10-27)
5. Gemini Developer API pricing — Google. https://ai.google.dev/gemini-api/docs/pricing (accessed 2026-10-27)
6. Search & Fetch — DeepSeek. https://api-docs.deepseek.com/guides/search (accessed 2026-10-27)
7. Amazon Bedrock pricing — AWS. https://aws.amazon.com/bedrock/pricing/ (accessed 2026-10-27)
8. Web Search - Amazon Bedrock — AWS. https://docs.aws.amazon.com/bedrock/latest/userguide/web-search.html (accessed 2026-10-27)
9. Changelog — OpenAI. https://developers.openai.com/api/docs/changelog (accessed 2026-10-27)
10. OpenAI-hosted sandboxes — OpenAI. https://developers.openai.com/api/docs/guides/agents-api/environments/openai-hosted (accessed 2026-10-27)
11. Web search tool — Anthropic. https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool (accessed 2026-10-27)
12. Web fetch tool — Anthropic. https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-fetch-tool (accessed 2026-10-27)
13. Web search — OpenAI. https://developers.openai.com/api/docs/guides/tools-web-search (accessed 2026-10-27)
14. Responses API reference — OpenAI. https://developers.openai.com/api/reference/resources/responses (accessed 2026-10-27)
15. Web Search on Amazon Bedrock now supports domain filtering and user location controls — AWS. https://aws.amazon.com/about-aws/whats-new/2026/10/bedrock-web-search-domain-user-location/ (accessed 2026-10-27)
