{"repo":"dvlshah/tokenx","free":true,"listed":false,"github":"https://github.com/dvlshah/tokenx","clone":"git clone https://github.com/dvlshah/tokenx.git","description":"Python decorators to accurately monitor LLM API cost & latency for OpenAI, Anthropic, and other leading AI models","language":"Python","stars":20,"topics":["anthropic","api-monitoring","cost-calculator","cost-tracking","developer-tools","gemini","latency-monitoring","llm","llmops","observability"],"license":null,"category":"ai-agents","readme_excerpt":"Track cost and latency of your LLM calls 👉 Like what you see? Star the repo and follow @dvlshah for updates! Decorator in → Metrics out. Monitor cost & latency of any LLM function without touching its body. --- 🤔 Why tokenx? Integrating with LLM APIs often involves hidden costs and variable performance. Manually tracking token usage and calculating costs across different models and providers is tedious and error-prone. tokenx simplifies this by: Decorator-based monitoring: Add cost and latency tracking with simple decorators. Accurate cost calculation: Uses configurable pricing with caching discounts. Latency measurement: Measures API call response times. Multi-provider support: Supports OpenAI and Anthropic APIs. Note: While tokenx strives for accuracy, there may be occasional discrepancies in token and cost metrics. If you encounter issues, please report them here. --- 🏗️ Architecture (1‑min overview) No vendor lock‑in: pure‑Python wrapper emits plain dicts—pipe them to Prometheus, Datadog, or stdout. --- 💡 Features at a glance Cost tracking – USD costing with cached‑token discounts (if applicable) No estimates policy – only real usage data, numbers will match what you see in the portal Latency measurement – measures API response times Decorator interface – works with sync and async functions Provider support – OpenAI, Anthropic, adding more providers soon! Minimal deps – tiktoken and pyyaml only --- 📦 Installation --- 🚀 Quick Start Here's how to monitor your OpenAI A","default_branch":null,"files":null,"tree":[],"storefront":"/r/dvlshah","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/dvlshah/tokenx/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}