Cost tracking & usage limits
How Amlexia handles dollar metrics and monthly event quotas.
Reported vs estimated cost
cost_source (ingest) | Meaning |
|---|---|
reported | You sent cost_usd / costUsd > 0 |
estimated | Platform computed from model + tokens + pricing table |
| (null) | No cost data |
Ingest runs enrichment on every event:
- If
cost_usd > 0→ reported - Else if
model_name+provider+ tokens → estimated viaestimateEventCostUsd - Else cost charts may show $0; latency/errors still work
Node.js — send explicit cost
typescript
await client.track({
endpoint: 'POST /v1/chat/completions',
method: 'POST',
statusCode: 200,
latencyMs: 400,
provider: 'openai',
modelName: 'gpt-4o-mini',
tokensInput: 500,
tokensOutput: 120,
costUsd: 0.00042, // optional — omit to estimate
});Node.js — estimate locally
typescript
import { estimateEventCostUsd } from '@amlexiahq/node';
const usd = estimateEventCostUsd({
modelName: 'gpt-4o-mini',
provider: 'openai',
tokensInput: 500,
tokensOutput: 120,
});Python
python
from amlexia.cost import estimate_cost_usd
client.track(..., cost_usd=0.01) # reported
# Or omit cost_usd and send model_name + tokens for estimateStripe / payments
Amlexia does not read your Stripe dashboard. Send:
typescript
costUsd: chargeAmountUsd,
provider: 'stripe',Dashboard
- Overview → Cost tab: breakdown by endpoint/provider
- Overview stat cards: reported vs estimated totals
- Providers: 24h cost per vendor
- Operations: 30-day LLM spend forecast
Monthly usage limits
| Plan | Events / month |
|---|---|
| Startup | 10,000 |
| Pro | 2,000,000 |
| Enterprise | Custom |
When exceeded, ingest returns 402. SDKs should not infinite-retry 402.
Check usage: dashboard sidebar meter or GET /api/usage?projectId=.
Reduce volume
sampleRate: 0.1→ ~10% of events- Separate staging project
- Avoid tracking health-check spam in middleware (filter in custom middleware if needed)
