FinOps Costs
FinOps Costs is the cost explorer: who every cost belongs to (Strongly, the platform with no user load, or an organization, its owners and users, down to each workload's components), monthly and daily spend, forecasts, anomalies, savings and the dashboard's figures. All endpoints are read-only analytics.
Access it as client.finops.costs on a Strongly client, or the same path on AsyncStrongly with await. All methods exist on both with identical signatures.
Methods
All methods
anomalies
anomalies(*, days: int | None = None, sensitivity: Sensitivity | None = None) -> CostAnomalies
Return resources whose cost on the last whole day moved from their usual day.
A resource's usual day is its average day with cost in the lookback.
Parameters
days(int | None, optional): Days to look back; the API's default is 7.sensitivity({"low", "medium", "high"} | None, optional): The move that counts: at least 100% (low), 50% (medium, the API's default) or 25% (high).
Returns
CostAnomalies: The anomalies, largest move first, and the lookback and sensitivity used.
Raises
ValidationError:daysis not a whole number, or an unknownsensitivity.
breakdown
breakdown(*, window: str | None = None, group_by: GroupBy | None = None, org_id: str | None = None, owner_id: str | None = None, user_id: str | None = None, resource_type: str | None = None, workload: str | None = None, namespace: str | None = None) -> CostGroupBreakdown
Return the cost of each group with its parts, change and efficiency.
Parameters
window(str | None, optional): A window; the API's default is"30d".group_by(GroupBy | None, optional): The drill-down's level:org(the API's default: each owner's organization, andstrongly, the platform with no user load),owner(whose workloads; withorg_id),user(who caused the cost; withowner_id),workload(withuser_id) orcomponent(withworkload); ortype(workload type) ornamespace.org_id(str | None, optional): Only this organization (the owner's), or"strongly"; within what you may see.owner_id(str | None, optional): Only the costs of this user's workloads (within what you may see).user_id(str | None, optional): Only the costs this user caused (within what you may see).resource_type(str | None, optional): Only this workload type (app,workflow,workspace, ...), or"strongly".workload(str | None, optional): Only this workload (its id, asgroup_by="workload"names it;strongly:<id>for one of Strongly's own costs).namespace(str | None, optional): Only this Kubernetes namespace.
Returns
CostGroupBreakdown: Each group's cost, most expensive first; the groups sum to the row they were opened from.
Raises
ValidationError: An unknowngroup_by, or the window is not one the API reads.
cost_top_drivers
cost_top_drivers(*, window: str | None = None, limit: int | None = None) -> list[TopCostDriver]
Return the most expensive workloads over a window.
Parameters
window(str | None, optional): A window; the API's default is"30d".limit(int | None, optional): How many workloads (1-100); the API's default is 10.
Returns
list[TopCostDriver]: People's workloads, most expensive first, each with every component of its cost, its organization and owner, its GPU cost and efficiency.
Raises
ValidationError:limitis outside 1-100, or the window is not one the API reads.
daily
daily(*, start_date: str | None = None, end_date: str | None = None, resource_type: str | None = None) -> DailyCosts
Return the cost of each UTC day, with its change on the previous period.
Parameters
start_date(str | None, optional): First day,YYYY-MM-DD; give it withend_date. Without both, the last 30 days.end_date(str | None, optional): Last day, included,YYYY-MM-DD.resource_type(str | None, optional): Only this resource type (app,workflow,workspace,self-hosted-model, ...).
Returns
DailyCosts: Each day's cost, oldest first, with the period's total, daily average and change on the previous period of the same length.
Raises
ValidationError: Only one ofstart_dateandend_dateis given.
dashboard
dashboard() -> FinOpsDashboard
Return the FinOps overview.
The last 30 days' KPIs and daily cost, the last 6 calendar months and
the 5 most expensive resources. Each part is read on its own: a part
that could not be read is None and listed in errors with its
problem, and the other parts are still answered.
Returns
FinOpsDashboard: The overview.
dashboard_stats
dashboard_stats(*, period: str | None = None) -> DashboardStats
Return the FinOps KPIs for a window (spend in US cents).
Parameters
period(str | None, optional): A window; the API's default is"30d".
Returns
DashboardStats: Spend and its change on the previous period, month to date, active resources, budget alerts and efficiency.
Raises
ValidationError: The window is not one the API reads.
efficiency
efficiency(*, window: str | None = None, group_by: GroupBy | None = None, org_id: str | None = None, owner_id: str | None = None, user_id: str | None = None, resource_type: str | None = None, workload: str | None = None, namespace: str | None = None) -> CostEfficiency
Return the CPU and memory the pods used against what they requested.
Parameters
window(str | None, optional): A window; the API's default is"30d".group_by(GroupBy | None, optional): The drill-down's level:org(the API's default: each owner's organization, andstrongly, the platform with no user load),owner(whose workloads; withorg_id),user(who caused the cost; withowner_id),workload(withuser_id) orcomponent(withworkload); ortype(workload type) ornamespace. (componenthas no pods of its own: refused.)org_id(str | None, optional): Only this organization (the owner's), or"strongly"; within what you may see.owner_id(str | None, optional): Only the costs of this user's workloads (within what you may see).user_id(str | None, optional): Only the costs this user caused (within what you may see).resource_type(str | None, optional): Only this workload type (app,workflow,workspace, ...), or"strongly".workload(str | None, optional): Only this workload (its id, asgroup_by="workload"names it;strongly:<id>for one of Strongly's own costs).namespace(str | None, optional): Only this Kubernetes namespace.
Returns
CostEfficiency: CPU core-hours and memory byte-hours, overall and per group.
Raises
ValidationError: An unknowngroup_by, or the window is not one the API reads.
forecast
forecast(*, weeks: int | None = None) -> CostForecast
Project daily cost whole weeks ahead from today (UTC).
A level that reverts toward its recent mean with a weekly season, fit to the last 90 whole days whose every hour is recorded.
Parameters
weeks(int | None, optional): Whole weeks to project (1-52); the API's default is 13.
Returns
CostForecast: The history, then each projected day, each week and the total, each with its median and 95% prediction interval calibrated by back-test, and the back-test's next-week accuracy. Nothing is projected with under 21 recorded days.
Raises
ValidationError:weeksis not a whole number from 1 to 52.
historical
historical(*, start_date: str | None = None, end_date: str | None = None, group_by: GroupBy | None = None, org_id: str | None = None, owner_id: str | None = None, user_id: str | None = None, resource_type: str | None = None, workload: str | None = None) -> HistoricalCosts
Return the cost of each group over a date range.
Parameters
start_date(str | None, optional): First day (YYYY-MM-DDor ISO 8601); give it withend_date. Without both, the last 30 days.end_date(str | None, optional): Last day, included.group_by(GroupBy | None, optional): The drill-down's level:org(the API's default: each owner's organization, andstrongly, the platform with no user load),owner(whose workloads; withorg_id),user(who caused the cost; withowner_id),workload(withuser_id) orcomponent(withworkload); ortype(workload type) ornamespace.org_id(str | None, optional): Only this organization (the owner's), or"strongly"; within what you may see.owner_id(str | None, optional): Only the costs of this user's workloads (within what you may see).user_id(str | None, optional): Only the costs this user caused (within what you may see).resource_type(str | None, optional): Only this workload type (app,workflow,workspace, ...), or"strongly".workload(str | None, optional): Only this workload (its id, asgroup_by="workload"names it;strongly:<id>for one of Strongly's own costs).
Returns
HistoricalCosts: Each group's cost and its parts, most expensive first.
Raises
ValidationError: Only one ofstart_dateandend_dateis given, or an unknowngroup_by.
monthly
monthly(*, months: int | None = None, year: int | None = None) -> MonthlyCosts
Return the cost of each calendar month (UTC).
Parameters
months(int | None, optional): How many calendar months back, this one included; the API's default is 12.year(int | None, optional): A calendar year's months instead (monthsis then ignored).
Returns
MonthlyCosts: Each month's cost, oldest first, with the average, highest and lowest month.
Raises
ValidationError:monthsis below 1.
per_execution
per_execution(*, window: str | None = None, workflow_id: str | None = None) -> CostPerExecution
Return each workflow's (or agent's) cost per run over a window.
Its cost (its workers, its share of the platform services and nodes it used, its runs' stored data) over the runs it started in the same hours, up to the latest hour the cost record records.
Parameters
window(str | None, optional): A window; the API's default is"30d".workflow_id(str | None, optional): Only this workflow (or agent).
Returns
CostPerExecution: Each workflow's cost, runs and cost per run.
Raises
ValidationError: The window is not one the API reads.ConflictError:ledger-not-recorded: no cost is recorded for the window yet (costs are usually recorded within the next hour).
realtime
realtime(*, window: str | None = None, namespace: str | None = None) -> RealtimeCosts
Return each resource's cost over the newest recorded hours, with parts and efficiency.
Parameters
window(str | None, optional): How many of the newest hours the cost record records:"1h"(the API's default),"6h","24h","7d". The window ends atrecorded_through, not at the clock.namespace(str | None, optional): Only this Kubernetes namespace.
Returns
RealtimeCosts: Each resource's cost, most expensive first.
Raises
ValidationError: The window is not one the API reads.ConflictError:ledger-not-recorded: no cost is recorded yet (costs are usually recorded within the next hour).
savings
savings(*, category: str | None = None, min_savings: float | None = None) -> SavingsRecommendations
Return rightsizing savings over the last 30 days.
A resource whose pods used under 40% of the CPU and memory they requested would save the cost of the unused share by lowering its requests.
Parameters
category(str | None, optional):rightsizing, the only category.min_savings(float | None, optional): Only recommendations saving at least this many US dollars.
Returns
SavingsRecommendations: The recommendations, largest saving first, and their total.
Raises
ValidationError: Acategoryother thanrightsizing.
top_drivers
top_drivers(*, limit: int | None = None, period: str | None = None) -> list[TopCostDriver]
Return the most expensive resources over a window, as the dashboard shows them.
Parameters
limit(int | None, optional): How many resources (1-100); the API's default is 10.period(str | None, optional): A window; the API's default is"30d".
Returns
list[TopCostDriver]: The resources, most expensive first.
Raises
ValidationError:limitis outside 1-100, or the window is not one the API reads.
trends
trends(*, window: str | None = None, granularity: str | None = None, group_by: GroupBy | None = None, org_id: str | None = None, owner_id: str | None = None, user_id: str | None = None, resource_type: str | None = None, workload: str | None = None) -> CostTrend
Return the cost of each hour, day, week or month over a window.
Parameters
window(str | None, optional): A window; the API's default is"30d".granularity(str | None, optional):hourly,daily(the API's default),weekly(from Monday) ormonthly, in UTC.group_by(GroupBy | None, optional): Break each point down by a level of the drill-down:org(each owner's organization, andstrongly, the platform with no user load),owner(whose workloads; withorg_id),user(who caused the cost; withowner_id),workload(withuser_id) orcomponent(withworkload); ortype(workload type) ornamespace.org_id(str | None, optional): Only this organization (the owner's), or"strongly"; within what you may see.owner_id(str | None, optional): Only the costs of this user's workloads (within what you may see).user_id(str | None, optional): Only the costs this user caused (within what you may see).resource_type(str | None, optional): Only this workload type (app,workflow,workspace, ...), or"strongly".workload(str | None, optional): Only this workload (its id, asgroup_by="workload"names it;strongly:<id>for one of Strongly's own costs).
Returns
CostTrend: The points, oldest first, with the window's total, daily average and change on the previous period of the same length.
Raises
ValidationError: An unknowngranularityorgroup_by, or the window is not one the API reads.