I’ve been building AIProfitHub, a tool for tracking AI API usage and cost across AI products.
One problem I kept seeing: teams ship AI features fast, but they often don’t know which feature, customer, user, or model is creating the cost.
So I published a small JavaScript SDK to make usage tracking easier.
What it does
- Track AI usage events
- Attribute cost by user, team, feature, customer, and model
- Prepare data for budget alerts and cost analysis
- Works with OpenAI, Anthropic, and LangChain-style wrappers
Install
npm install aiprofithub-sdk
Basic example
import { createClient } from "aiprofithub-sdk";
const client = createClient({
apiKey: process.env.AIPROFITHUB_API_KEY,
});
await client.trackUsage({
provider: "openai",
model: "gpt-4o-mini",
feature: "support-chat",
userId: "user_123",
inputTokens: 1200,
outputTokens: 350,
costUsd: 0.0042,
});
Links
GitHub:
https://github.com/aiprofithub/aiprofithub-js
NPM:
https://www.npmjs.com/package/aiprofithub-sdk
I’d love feedback from developers building AI products:
How are you currently tracking LLM usage, token spend, and cost per feature?
Top comments (1)
I’m especially curious how other teams handle this in production.
Do you track raw token usage only, or do you also map cost back to features, users, and customers?