llmfy_usage_tracker
llmfy.llmfy_core.usage.usage_tracker
LLMFY_USAGE_TRACKER_VAR = ContextVar('LLMFY_USAGE_TRACKER', default=None)
module-attribute
llmfy_usage_tracker(openai_pricing=None, bedrock_pricing=None, googleai_pricing=None)
LLMfy usage tracker.
Use this to track token usage all provider.
Example:
[OPENAI] Price per 1M tokens for different models (USD): - https://platform.openai.com/docs/pricing
[BEDROCK] Price per 1K tokens for different models (USD): - https://aws.amazon.com/bedrock/pricing/ - https://aws.amazon.com/bedrock/pricing/ - https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html
Parameters:
Yields:
| Name | Type | Description |
|---|---|---|
OpenAIUsage |
OpenAI usage accumulation. |