---
title: "query for aggregated AI inference costs"
method: GET
path: "/inferenceCost/total"
---

# query for aggregated AI inference costs

`GET /inferenceCost/total`

Returns a single aggregated InferenceCostSet covering the full requested window. Costs are broken down per model/namespace with blended and differentiated (input/output) cost-per-million-token rates under the chosen cost basis. Requires `INFERENCE_COST_ENABLED=true`.

## Query parameters

- `window` string, required
- `costBasis` 'allocation' | 'usage'
- `aggregate` string
- `accumulate` 'hour' | 'day' | 'week' | 'month'
- `filter` string

## Response `200`

Success

- InferenceCostSetResponse — Response envelope for /inferenceCost/total.
  - `code` integer
  - `status` string
  - `data` InferenceCostSet — A collection of InferenceCostResponse entries for a single time window, keyed by aggregation key (e.g. `modelName:namespace`).
    - `inferenceCosts` object
    - `window` Window
      - `start` string, date-time
      - `end` string, date-time

## Other responses

- `400` — Bad request — missing or invalid parameters
- `501` — Inference cost tracking is not enabled (`INFERENCE_COST_ENABLED` is not set to `true`)

---

[API](https://skmtc.dev/opencost/apis/opencost-api.md) · [All operations](https://skmtc.dev/opencost/apis/opencost-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/opencost/opencost-api/revisions/c4d279a26333/schema)
