Metadata-Version: 2.4
Name: llm-cost-profiler
Version: 0.1.2
Summary: A tiny Python library for tracking LLM token usage, latency, and estimated cost.
Author-email: Boniface Alexander <you@example.com>
License: MIT
Keywords: llm,cost,profiler,openai,langchain
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

# llm-cost-profiler


[![PyPI version](https://img.shields.io/pypi/v/llm-cost-profiler?label=PyPI)](https://pypi.org/project/llm-cost-profiler/0.1.0/)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)


Lightweight LLM cost, token, and latency profiler for any Python AI stack.


## Overview


`llm-cost-profiler` is a small, dependency-light Python library for tracking LLM usage, latency and estimated cost across different model providers. It provides simple instrumentation primitives (manual recording and a decorator), JSONL logging for audit and analysis, and optional dynamic pricing lookups.


Perfect for developers building RAG systems, agents, batch inference jobs, Streamlit apps, FastAPI services, and more.


## Features


- Token usage (prompt & completion) tracking
- Model-specific cost estimation
- Latency & response time tracking
- JSONL logging sink for audits & dashboards
- Simple decorator to profile function calls
- Dynamic pricing (optional) with safe fallbacks
- Minimal dependencies


## Installation


Install from PyPI:


```bash
pip install llm-cost-profiler
