Track every LLM call's cost, tokens, and latency with one line of code. Zero overhead. Auto-detects OpenAI, Anthropic, Google, and Azure.
One init call. CostKey patches fetch, intercepts AI calls, captures stack traces, and ships everything to your dashboard — automatically.
Patches globalThis.fetch
Like Sentry — one line
Recognizes OpenAI, Anthropic,
Google, Azure by URL
Tokens, cost, latency, TTFT
Stack trace for attribution
Every call visible by function,
feature, trace, and model
Cost by function, auto-detected features, request-level traces — all from stack traces, zero manual tagging.
Total spend, call volume, latency, TTFT — plus cost breakdown by model. See where your money goes at a glance.
Each feature expands to show its AI call sites — which functions, how many tokens, what cost — grouped by shared parent functions.
Every HTTP request gets a trace. See exactly which AI calls happened, their cost, duration, and models — all grouped per request.
Patches fetch, detects AI providers by URL. OpenAI, Anthropic, Google, Azure — all automatic.
See which function costs what. Captures call site on every AI call. Zero manual tagging.
Group all AI calls per request. See total cost, tokens, and latency per user action.
Detects features from call chain analysis. Your search pipeline's cost, broken down automatically.
Time to first token, tokens/sec, chunk timing. Full observability for streaming responses.
Never captures API keys. Headers are never read. Auto-redacts secrets from captured bodies.
| CostKey | Portkey | LiteLLM | |
|---|---|---|---|
| Setup | 1 line | Proxy config | Proxy config |
| Approach | SDK (no proxy) | Proxy | Proxy |
| Latency overhead | ~0ms | 20-40ms | Variable |
| Cost | Free | $49+/month | Free (self-host) |
| Code attribution | Automatic (stack traces) | Manual tags | Manual tags |
| TypeScript native | ✓ | ✗ | ✗ Python |
| Request tracing | ✓ Auto | ✓ Manual | ✗ |
| Feature detection | ✓ Auto | ✗ | ✗ |