add an Anthropic Token Usage callback #25829
Kevin-McIsaac
announced in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Checked
Feature request
Enable access to the token count and usage cost for Anthropic LLM by adding a call back handler to langchain_community.callbacks.
Motivation
Track usage costs for Claude 3
Proposal (If applicable)
The existing OpenAI callback (openai_callback) returns the token count, but not the cost, when used with Claude. The cost is not returned because the Anthropic model names are not in the unit cost dict.
The simplest solution would be to create a new callback for Anthropic based on the OpenAI callback and add a different cost table.
Beta Was this translation helpful? Give feedback.
All reactions