---
title: "Workspace agent token usage by model — spend from sessions completed in the window, broken down by model (PLAT-97)"
method: GET
path: "/api/workspaces/{workspaceId}/insights/token-usage"
tags: ["Insights"]
---

# Workspace agent token usage by model — spend from sessions completed in the window, broken down by model (PLAT-97)

`GET /api/workspaces/{workspaceId}/insights/token-usage`

## Request

- Base URL: `https://hiveship.app/api`
- URL: `https://hiveship.app/api/api/workspaces/{workspaceId}/insights/token-usage`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `hiveship_access`
  - HTTP bearer

## Path parameters

- `workspaceId` string, required

## Query parameters

- `from` string
- `to` string
- `projectIds` string
- `priorities` string
- `assigneeIds` string
- `labelIds` string

## Response `200`

Per-model token totals + grand total for completed sessions in the window (agent-reported)

- object
  - `success` boolean, required
  - `data` object, required
    - `byModel` object[], required
      - `model` string, required
      - `inputTokens` integer, required
      - `outputTokens` integer, required
      - `cacheReadTokens` integer, required
      - `cacheWriteTokens` integer, required
      - `totalTokens` integer, required
    - `totalTokens` integer, required
    - `sessionCount` integer, required
    - `finishedSessionCount` integer, required
    - `windowStart` string, required
    - `windowEnd` string, required
    - `emptyReason` 'no_usage', nullable, required

## Other responses

- `403`: Plan does not include insights, or caller lacks OWNER/ADMIN role (PLAT-105)

---

[API](https://skmtc.dev/hiveship/apis/hiveship-api.md) · [All operations](https://skmtc.dev/hiveship/apis/hiveship-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hiveship/apis/hiveship-api/revisions/73d3e26544e4?raw)
