SDK
SDK overview
The LLM Cost Tracker SDK is a lightweight TypeScript package that wraps your existing Anthropic or OpenAI calls and logs cost data to your dashboard — without changing your response handling or adding latency to your requests.
Installation
npm install @llmcosttracker/sdkTwo functions
The SDK exports two functions depending on how you call your LLM:
trackedCall()— for standard (non-streaming) callstrackedStream()— for streaming calls
Design principles
- Non-blocking — logging happens asynchronously and never throws. A logging failure will never surface to your users or break your app.
- Zero response change — both functions return the exact same value as the underlying LLM call. Drop-in replacement.
- No framework required — works with any Node.js or TypeScript project. No LangChain, no special setup.
- Your data — events are posted to your own LLM Cost Tracker project endpoint. No third-party data sharing.