Skip to content

Conversation

@Sameerlite
Copy link
Collaborator

@Sameerlite Sameerlite commented Oct 28, 2025

Title

Add Xai websearch cost

Relevant issues

Fixes #15907

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🆕 New Feature
🐛 Bug Fix

Changes

  • Added a websearch cost calculation method for xai
  • Added the elif statement for detecting xai
  • Added a method to convert xai num_sources_used to web_search_requests in usage object.
image

@vercel
Copy link

vercel bot commented Oct 28, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
litellm Error Error Oct 28, 2025 7:29am

@krrishdholakia krrishdholakia merged commit 689b210 into main Oct 31, 2025
45 of 53 checks passed
@krrishdholakia krrishdholakia deleted the litellm_xai_include_web_search_cost branch October 31, 2025 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: X.AI web search cost isn't calculated

3 participants