---
title: API: metering
description: REST endpoints tagged metering — generated from the platform's OpenAPI contract (4 operations).
locale: en
version: 0.2.0
canonical: https://enterium-developer-docs.pages.dev/developers/api/metering/
---

> Documentation index: https://enterium-developer-docs.pages.dev/developers/llms.txt — every page of this portal has a Markdown twin at <route>.md; the frozen API contract is at https://enterium-developer-docs.pages.dev/developers/api/openapi.json.

:::note
Generated from the OpenAPI contract — do not edit by hand. Interactive explorer with full schemas: [https://entherium.duckdns.org:8443/reference](https://entherium.duckdns.org:8443/reference); frozen spec for this build: [openapi.json](/developers/api/openapi.json).
:::

## `GET /api/v1/metering/costs/by-article`

Costs By Article

[Open as a page →](./get-metering-costs-by-article/)

Per-article cost for a contract: direct spend + amortized collect share.

``direct`` = sum over the article's own runs (generate/publish, where
``generated_article_id`` is set). ``amortized_collect`` = the contract's
contract-level cost (its collect runs, where ``generated_article_id`` IS
NULL) divided by the number of articles in the window — (owner
decision: amortize by period, not per collect-run, since collect feeds the
reused RAG corpus). imagegen is a deliberately separate ledger and NOT added.

**Auth:** `Authorization: Bearer <token>` required

| Parameter | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `salescontracts_id` | query | yes | `integer` |  |
| `from` | query | no | `string \| null` |  |
| `to` | query | no | `string \| null` |  |

**Responses:**

| Code | Meaning | Body |
| --- | --- | --- |
| `200` | Successful Response | `array of ArticleCostRow` |
| `401` | Missing or invalid authentication credentials | `ErrorResponse` |
| `422` | Validation Error | `HTTPValidationError` |

## `GET /api/v1/metering/costs/by-contract`

Costs By Contract

[Open as a page →](./get-metering-costs-by-contract/)

Per-contract cost rollup (sum over each salescontracts_id).

**Auth:** `Authorization: Bearer <token>` required

| Parameter | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `ai_company_id` | query | no | `integer \| null` |  |
| `from` | query | no | `string \| null` |  |
| `to` | query | no | `string \| null` |  |

**Responses:**

| Code | Meaning | Body |
| --- | --- | --- |
| `200` | Successful Response | `array of ContractCostRow` |
| `401` | Missing or invalid authentication credentials | `ErrorResponse` |
| `422` | Validation Error | `HTTPValidationError` |

## `GET /api/v1/metering/costs/by-pipeline-run`

Costs By Pipeline Run

[Open as a page →](./get-metering-costs-by-pipeline-run/)

Per-run cost rows, newest first.

**Auth:** `Authorization: Bearer <token>` required

| Parameter | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `ai_company_id` | query | no | `integer \| null` |  |
| `from` | query | no | `string \| null` |  |
| `to` | query | no | `string \| null` |  |
| `limit` | query | no | `integer` |  |
| `offset` | query | no | `integer` |  |

**Responses:**

| Code | Meaning | Body |
| --- | --- | --- |
| `200` | Successful Response | `array of RunCostRow` |
| `401` | Missing or invalid authentication credentials | `ErrorResponse` |
| `422` | Validation Error | `HTTPValidationError` |

## `GET /api/v1/metering/costs/summary`

Costs Summary

[Open as a page →](./get-metering-costs-summary/)

Cost + tokens + brave aggregated by day / contract / model / provider.

**Auth:** `Authorization: Bearer <token>` required

| Parameter | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `group_by` | query | no | `"day" \| "contract" \| "model" \| "provider"` |  |
| `ai_company_id` | query | no | `integer \| null` |  |
| `from` | query | no | `string \| null` |  |
| `to` | query | no | `string \| null` |  |

**Responses:**

| Code | Meaning | Body |
| --- | --- | --- |
| `200` | Successful Response | `array of CostSummaryRow` |
| `401` | Missing or invalid authentication credentials | `ErrorResponse` |
| `422` | Validation Error | `HTTPValidationError` |
