langchain-ai/langchain

Add Perplexity cost tracking

Open

#31,647 opened on Apr 14, 2025

View on GitHub
 (6 comments) (1 reaction) (1 assignee)Python (136,758 stars) (22,617 forks)batch import
externalhelp wantedintegrationinvestigateperplexity

Description

Issue you'd like to raise.

costs shown on langsmith for perplexity API calls are inaccurate (even upto an order of magnitude). refer to their docs for how to calculate costs: https://docs.perplexity.ai/guides/models/sonar-reasoning-pro#detailed-pricing-breakdown-for-sonar-reasoning-pro

The problem is that pplx cost depends not only on input and output tokens but also on search queries and

Suggestion:

either add support for calculating this within langsmith platform or let users update the true cost while tracing an LLM call.

Contributor guide