---
title: "Get Repo Costs"
method: GET
path: "/repos/{short_id}/costs"
tags: ["analytics"]
---

# Get Repo Costs

`GET /repos/{short_id}/costs`

Per-repo cost breakdown.

Aggregates two data sources:
  - credit_transactions (this user, scoped by repo_id) - billing-side spend
    in cents, broken down by transaction type, with 7d / 30d / lifetime
    windows.
  - llm_costs.json artifact (engine-side per-operation telemetry) when
    present. The OSS indexer doesn't currently emit this artifact for
    every snapshot, so the response includes available=False rather than
    500-ing when it's missing.

Auth: anyone can fetch the totals for a public snapshot (transactions are
filtered by user_id, so anonymous callers see zeros for the spend half but
the engine telemetry is still useful as a public stat). Private snapshots
follow the standard owner-only rule.

## Path parameters

- `short_id` string, required

## Response `200`

Successful Response

- RepoCostsResponse
  - `repo_id` string, required
  - `short_id` string, required
  - `total_cents` integer, required
  - `total_cents_30d` integer, required
  - `total_cents_7d` integer, required
  - `by_type` CostsByType, required — Spend on this repo, split by what was bought. One field per billable `transaction_type`, because `other_cents` was swallowing most of them: the bucket list was written when the enum had three debit types and never grew with it, so `answer`, `mcp` and `prose_generation` all landed in "other". On any account using Ask or the hosted MCP, the largest slice of the breakdown was an unlabelled catch-all. Credit types (`monthly_grant`, `topup`, `subscription_grant`) are absent by design: this is a breakdown of spend, and those are the opposite. `other_cents` stays, now as a real catch-all for a type added to the enum after this list -- migration 087 is what happens when a label goes live before the code that handles it, so it fails into a visible bucket rather than being dropped.
    - `indexing_cents` integer
    - `reindex_cents` integer
    - `chat_cents` integer
    - `answer_cents` integer
    - `mcp_cents` integer
    - `prose_cents` integer
    - `bot_review_cents` integer
    - `other_cents` integer
  - `transaction_count` integer, required
  - `transactions` RepoCostTransaction[]
    - `id` string, nullable
    - `amount_cents` integer, required
    - `type` string, required
    - `description` string, nullable
    - `snapshot_id` string, nullable
    - `created_at` string, nullable
  - `llm_costs` LlmCostsTelemetry, required — Engine-side per-operation token telemetry (from llm_costs.json artifact). Available only when the OSS pipeline writes the artifact. Hosted gracefully returns None for every field if the file is absent.
    - `available` boolean
    - `total_input_tokens` integer, nullable
    - `total_output_tokens` integer, nullable
    - `total_cost_usd` number, nullable
    - `by_model` object
    - `by_operation` object

## Other responses

- `422` — Validation Error

## Changes

- **2026-09-22** `51ddce128926` — 4 info
  - added the optional property `by_type/answer_cents` to the response with the `200` status
  - added the optional property `by_type/bot_review_cents` to the response with the `200` status
  - added the optional property `by_type/mcp_cents` to the response with the `200` status
  - added the optional property `by_type/prose_cents` to the response with the `200` status

[Change history](https://skmtc.dev/repowise/apis/repowise-hosted-api/changes/repos/:short_id/costs/get.md)

---

[API](https://skmtc.dev/repowise/apis/repowise-hosted-api.md) · [All operations](https://skmtc.dev/repowise/apis/repowise-hosted-api/llms.txt) · [OpenAPI document](https://skmtc.dev/repowise/apis/repowise-hosted-api/revisions/8c05b8b9a5c4?raw)
