Developer Documentation
Build with Bear Lumen.
Track AI costs in one line of code.
Everything you need to instrument your AI app. Capture, attribute, and meter LLM spend across every provider, then query it from the SDK or the dashboard.
Quickstart
Your first tracked request
The SDK reads the response your provider already returned. No proxy, no added latency, no prompt payloads stored.
- 1Install the SDK and add your API key.
- 2Wrap the response your provider returned.
- 3Query cost, margin, and usage anywhere.
track.ts
import { BearLumen } from '@bearlumen/node-sdk';
const bear = new BearLumen({
apiKey: process.env.BEAR_LUMEN_API_KEY,
});
// Wrap the response you already have.
const result = bear.track(response);
result.costUsd; // 0.0042
result.model; // 'gpt-4o'
result.inputTokens; // 12