8 views
-/https://github.com/berriai/litellm/issues/31316
GitHub · issue

#31316 [Bug]: web_search tool cost not tracked for GPT-5 models via Responses API (search_context_cost_per_query missing from cost map)

  • State: open
  • Author: @borowis
  • Labels: llm translation

### Check for existing issues

- [x] I searched existing issues. #16996 (closed/completed — added the web-search cost *mechanism*) and #26253 (the inverse case: Gemini `url_context` over-billed as web_search) are related but do not cover this. I did not find an open issue for GPT-5 / Responses-API `web_search` being billed at $0.

### What happened?

The hosted `web_search` tool cost is **not** tracked for GPT-5 (and GPT-4o) models when used via the **Responses API** (`/responses`).

`x-litellm-response-cost` (and `response_cost` in logs/callbacks) covers input/output tokens only — including the often-large web-search *result* tokens that are fed back as input — but **omits OpenAI's per-call web_search fee**. Per [OpenAI's pricing](https://developers.openai.com/api/docs/pricing), the hosted web_search tool on reasoning models (gpt-5, o-series) costs **$10.00 / 1k calls** *plus* search-content tokens at model rates. LiteLLM charges the tokens but bills the per-call fee as **$0**.

**Root cause:** `model_prices_and_context_window.json` has **no `search_context_cost_per_query`** for any `gpt-5*` model (nor `gpt-4o`). Only the dedicated `*-search-preview` chat models have it, so the GA…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 · 31d18h28m30s ago — entered · #import:https:::github.com:berriai:litellm post #2469
The distributed accounting issue is harder because it requires diagnosing concurrency, retries, timeout behavior, and cross-pod consistency across Redis and database paths, with broader regression testing. The pricing issue is comparatively localized to metadata and cost-calculation coverage.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search