Cost Tracking
Understand how Grafient tracks and visualizes your AI costs.
How It Works
Grafient pulls cost data from your connected providers in two ways:
On-Demand Sync
When you visit the dashboard or click Force Sync on an integration, we fetch fresh data from the provider's API for the current period. This gives you real-time visibility without waiting for scheduled updates.
Daily Cron Sync
A scheduled job runs every day at 6 AM UTC to pull the previous day's final cost data for all active integrations. This ensures we never miss data for days you don't visit the dashboard.
Dashboard Overview
The main dashboard shows:
- Summary Cards: Total spend, daily average, most expensive model, and month-over-month change
- Cost Chart: An area chart showing spend over time, stacked by provider
- Provider Cards: Per-integration cards showing cost, token count, and sync status
Time Periods
Use the period selector in the top bar to view:
- 7d: Last 7 days
- 30d: Last 30 days
- 90d: Last 90 days
Cost Breakdown
The Breakdown page provides a sortable table with per-model cost details, including:
- Model name and provider
- Input/output/cached token counts
- Total cost in USD
Data Storage
Cost data is stored as daily snapshots in the daily_costs table. Each record includes:
- The date
- Total cost in USD
- Model-level breakdown (JSON)
- Token usage counts (JSON)
- Raw API response for debugging
Data History Limits
When you first connect a provider, Grafient backfills historical cost data up to the limit allowed by your plan and the provider's API. On the Free plan, all providers backfill up to 30 days. On Pro and Ultimate plans, the backfill window extends to the provider's maximum:
| Provider | Max History | Free Plan | Pro / Ultimate |
|---|---|---|---|
| Anthropic | 365 days | 30 days | 365 days |
| OpenAI | 180 days | 30 days | 180 days |
| OpenRouter | 30 days | 30 days | 30 days |
| Cursor | 30 days | 30 days | 30 days |
| xAI | 90 days | 30 days | 90 days |
| ElevenLabs | 90 days | 30 days | 90 days |
| Google AI | 365 days | 30 days | 365 days |
| Amazon Bedrock | 365 days | 30 days | 365 days |
| Vercel AI Gateway | 90 days | 30 days | 90 days |
| Azure AI Foundry | 365 days | 30 days | 365 days |
After the initial backfill, daily syncs and manual resyncs fetch the last 30 days to keep data fresh without unnecessary API calls. The "Max History" column reflects the maximum each provider's API supports - upgrading your plan won't exceed this limit.