A request with the websearch enabled cost around 0.22$ and without the websearch it is $0.0003593.
Why such difference?
const result = await generateText({
model: 'openai/gpt-5-nano',
prompt: truncatedPrompt,
maxOutputTokens: tokenLimits.maxOutputTokens,
//tools: {
// web_search: openai.tools.webSearch(webSearchConfig) as Tool,
//},
});
anshumanb
(Anshuman Bhardwaj)
January 13, 2026, 5:06am
4
Hi @marcolivierbouch , welcome to the Vercel Community!
That’s interesting. Can you check how many search calls did it make?
Are you using AI Gateway? If not you can refer to OpenAI’s pricing for web search and models here:
https://openai.com/api/pricing/
openai/gpt-5-nano
OpenAI
$0.1358454
54K
4.6K
1m18s
openai/gpt-5-nano
OpenAI
$0.22060187
97K
8K
2m11s
openai/gpt-5-nano
OpenAI
$0.13672295
56K
5.2K
1m35s
Here’s what I get using the AI Gateway.
cost: ‘0.13672295’,
marketCost: ‘0.13672295’,
billableWebSearchCalls: 13
I just don’t understand why I get to 13 websearches, I would like to be able to limit that to one because it is very expensive.
anshumanb
(Anshuman Bhardwaj)
January 14, 2026, 5:17am
6
Hi @marcolivierbouch , I found this thread on the OpenAI forum discussing the issue you are facing.
I’m not sure if we can control how the tool works, maybe check it’s references . For example, change the searchContextSize: 'high' to medium.
But, ai-sdk’s stopWhen feature let’s you limit number of steps, which I think is 1 by default.
anshumanb
(Anshuman Bhardwaj)
January 24, 2026, 12:01am
7
Hi @marcolivierbouch , I wanted to check in regarding your concern about the 13 web searches resulting in increased costs. Have you been able to implement any adjustments, such as modifying the searchContextSize or using the stopWhen feature? Did you find a solution or still need assistance? Let me know if you need more details.
Basicly I migrated to their API directly using responses api and it is doing only one websearch, which makes it quite cheap.
1 Like
system
(system)
Closed
February 9, 2026, 11:43am
9
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.