llmfy_usage_tracker
llmfy.llmfy_core.usage.usage_tracker
llmfy_usage_tracker(openai_pricing=None, bedrock_pricing=None)
LLMfy usage tracker.
Use this to track token usage all provider.
Example:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
openai_pricing
|
Optional[Dict[str, Any]]
|
None
|
|
bedrock_pricing
|
Optional[Dict[str, Any]]
|
Bedrock Pricing dictionary source. Defaults to None. If None then use default pricing from this dependency. Example pricing structure:
|
None
|
Yields:
| Name | Type | Description |
|---|---|---|
OpenAIUsage |
OpenAI usage accumulation. |
Source code in llmfy/llmfy_core/usage/usage_tracker.py
track_bedrock_embedding_usage(func)
Decorator to wrap __call_bedrock_embedding calls on BedrockEmbedding.
Source code in llmfy/llmfy_core/usage/usage_tracker.py
track_bedrock_usage(func)
Decorator to wrap __call_bedrock calls on BedrockModel.
Source code in llmfy/llmfy_core/usage/usage_tracker.py
track_openai_embedding_usage(func)
Decorator to wrap __call_openai_embedding calls on OpenAIEmbedding.
Source code in llmfy/llmfy_core/usage/usage_tracker.py
track_openai_usage(func)
Decorator to wrap __call_openai calls on OpenAIModel.