Skip to main content

get_usage

Function get_usage 

Source
pub async fn get_usage(
    __arg0: State<AppState>,
    __arg1: Query<UsageQuery>,
) -> Result<Json<UsageReport>, ApiError>
Expand description

GET /api/usage — cost, turns, and terminal outcomes per workspace over a window, with a per-day series (#180).

The store does the aggregation; this only resolves the window and reshapes the rows. Bounds are compared lexically against the stored RFC-3339 timestamps — the same assumption retention already makes — so crate::dto::usage_window validates them and re-renders every bound, not just the defaults, in the format events are written in (#255). A bound it cannot resolve is a 400, never a report for some other window.