Import usage data
TTDash supports three input shapes:
- the array returned by
toktrack daily --json - an object with a
dailyarray using current toktrack field names - a legacy TTDash or
ccusageobject withdailyentries and model breakdowns
Every accepted payload is normalized into TTDash’s stored shape. Rows without a date are discarded, valid rows are sorted by date, and top-level totals are recalculated from normalized daily rows.
Auto-import
Section titled “Auto-import”Select Auto import in the empty-state onboarding or Import in the dashboard header after data has loaded. Both open Toktrack auto import. You can also run one import during startup:
ttdash --auto-loadTTDash chooses a compatible runner in this order:
- the package-local
toktrackexecutable, orTTDASH_TOKTRACK_LOCAL_BIN bunxwith the exact toktrack package version pinned by the TTDash releasenpx --yeswith the same package version and an isolated cache
A local executable is used only when toktrack --version matches the pinned version. The dashboard streams runner checks, progress, stderr, success, and structured failure messages while the import runs.
Only one auto-import can run per server process. Auto-import replaces the persisted dataset with the normalized result and records the source and load time. A startup auto-import failure is non-fatal: TTDash continues with the previous dataset or an empty state.
Upload a complete JSON dataset
Section titled “Upload a complete JSON dataset”Use Upload when the selected file should become the complete current dataset.
- the file is normalized before it is stored
- it replaces
data.json; it does not merge dates - the JSON request body is limited to 10 MiB
- malformed JSON and unsupported shapes are rejected without replacing valid stored data
You can generate a current toktrack payload yourself:
toktrack daily --json > usage.jsonThen select usage.json in TTDash. See Data formats for field-level examples.
Import a TTDash usage backup
Section titled “Import a TTDash usage backup”Use Settings → Maintenance → Back up data → Import data when you want a conservative date merge:
- dates missing from the current dataset are added
- equivalent existing dates are skipped
- dates that exist with different values remain unchanged and are reported as conflicts
- invalid or dateless imported entries are counted as skipped
Choose ordinary Upload instead when the incoming file should replace the entire dataset.
Verify the result
Section titled “Verify the result”After any successful load:
- check the displayed day count and total cost
- set the date preset to All
- inspect provider and model filters for unexpected names
- open a recent period drilldown and confirm requests and token types
- export a fresh usage backup before making large changes
The normalized dataset is also available through GET /api/usage.