Web search tool with gpt-4o-mini

i’ve just tried out the web search tool with gpt 4o mini through the API and no matter the question , I seem to always get the input tokens as 8174, changing the search context size doesnt make a difference either. Has this happened to anyone else ?

Yes — for gpt-4o-mini this is expected, not necessarily a bug. The pricing docs explicitly say: “For gpt-4o-mini and gpt-4.1-mini with the non-preview web search tool, search content tokens are billed as a fixed block of 8,000 input tokens per call.” That explains why you keep seeing ~8174 input tokens: ~8,000 fixed “search content” tokens plus your actual prompt/tool overhead. search_context_size controls how much search result context is made available to the model, but the Web Search guide says it “does not set an exact token count,” and for these mini models the billing block is fixed anyway. Docs: Web Search guide: Web search | OpenAI API and Pricing / built-in tools: Pricing | OpenAI API .

Cost-wise, the standard Responses API web_search tool is priced at $10 / 1k calls — i.e. $0.01 per search callplus search content tokens billed at the selected model’s input-token rate. So the tool fee does not replace model input billing; the retrieved search context is also counted as model input. For gpt-4o-mini/gpt-4.1-mini on non-preview web_search, that search-context part is billed as a one-time fixed 8,000 input-token block per call, even if the actual retrieved context is smaller or search_context_size is low. By contrast, the docs list web_search_preview for non-reasoning models as $25 / 1k calls with “search content tokens are free,” which is a different/legacy pricing path.


Your buddy and mine - the documentation AI helper - _j