---
title: "query for AI inference costs as a time series"
method: GET
path: "/inferenceCost/timeseries"
---

# query for AI inference costs as a time series

`GET /inferenceCost/timeseries`

Returns one InferenceCostSet per time step within the requested window. The `accumulate` parameter is required and defines the step size. All other parameters are identical to `/inferenceCost/total`. Requires `INFERENCE_COST_ENABLED=true`.

## Query parameters

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

## Response `200`

Success

- InferenceCostSetRangeResponse — Response envelope for /inferenceCost/timeseries.
  - `code` integer
  - `status` string
  - `data` object
    - `inferenceCostSets` InferenceCostSet[] — One InferenceCostSet per time step.
      - `inferenceCosts` object
      - `window` Window
        - `start` string, date-time
        - `end` string, date-time
    - `window` Window
      - `start` string, date-time
      - `end` string, date-time

## Other responses

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

## Changes

- **2026-07-17** `c4d279a26333` — 1 info
  - removed the non-success response with the status `500`
- **2026-07-16** `c440ab5efe8e` — 1 info
  - added the non-success response with the status `500`
- **2026-07-03** `8e1854beb9cd` — 1 info
  - endpoint added
- **2023-01-20** `3cbff640f287` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/opencost/apis/opencost-api/changes/inferenceCost/timeseries/get.md)

---

[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)
