Skip to content

[Feature]: response_cost should include web search request cost #16996

@KeremTurgutlu

Description

@KeremTurgutlu

The Feature

Currently response_cost from custom callback logger doesn't take web search requests into account.

Few other notes:

  • Web search cost is not available in model cost map either.
  • When stream=True server_tool_use is not included in Usage metadata, here is an open PR that fixes that issue.
  • Complexity of including web search cost will depend on the model provider, for example Anthropic applies a fixed cost whereas Google Gemini applies a threshold based pricing.

Motivation, pitch

Web search is quite expensive so it would be great to have that in response_cost for a complete cost tracking.

LiteLLM is hiring a founding backend engineer, are you interested in joining us and shipping to all our users?

No

Twitter / LinkedIn details

https://x.com/KeremTurgutlu

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions