> This page is for version Preview (default).
> For other versions, use one of these documentation indexes:
> - Preview (default): https://docs.preview.paid.ai/preview/llms.txt
> - Current: https://docs.preview.paid.ai/current/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.preview.paid.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.preview.paid.ai/_mcp/server.

# Event costs

> Record what each event cost you to produce, so you can see your margin per customer and bill your costs plus a markup.

**Cost lines** record what an event cost you to produce: the model call, the GPU time, a third-party API or a person's time. You add them to the same event that records the usage, so one send gives Paid both what you bill and what it cost you. For model calls you don't even need the amount: send the provider, model and token counts, and Paid prices them from its model catalog.

Use cost lines to:

* **See your margin** per customer, product or run, next to what you bill for the same events.
* **Bill your costs plus a markup** with a [`costPlus` price](/catalog/prices#cost-plus-pricing), such as inference at cost plus 20%.
* **Bill tokens without sending them twice**, with a [meter](/usage/meters#paths) that sums a field such as `cost.inference.outputTokens`.

Send the beta alongside the events beta: `Paid-Beta: events=v1,event_costs=v1`.

## How cost lines work

`cost` is a list on the event, one line per cost. Each line has a `type` and one object of the same name with its details, so `type: "inference"` goes with `inference: { ... }`.

1. **You describe the cost.** For a model call, the provider, the model and the token counts. For anything else, the `amount` and what it was for.
2. **Paid prices it.** An `inference` line without an `amount` is priced from Paid's model catalog. Any other line uses the `amount` you sent.
3. **The event comes back priced.** Each line shows its `amount` and, in `pricing`, where that amount came from.

## Record an inference cost

Litware's support agent calls a language model for every turn of a ticket. It sends one `agent.turn` event per turn, with the model call as an inference cost line:

#### API

[Create an event](../api-reference/metering/events/create) with a `cost` line of type `inference`. Leave out `amount`, and Paid calculates it.

**`POST /v1/events`**

```json title="POST /v1/events"
{
  "eventName": "agent.turn",
  "customer": "northwind",
  "product": "support_agent",
  "dedupeKey": "turn_5c1e9a",
  "timestamp": "2026-11-04T09:31:12Z",
  "correlationId": "ticket_4410",
  "cost": [
    {
      "type": "inference",
      "inference": {
        "operation": "chat",
        "provider": "fabrikam",
        "model": "fabrikam-large-2",
        "inputTokens": 3200,
        "cacheReadInputTokens": 2400,
        "outputTokens": 410
      }
    }
  ]
}
```

**`Response`**

```json title="Response"
{
  "id": "evt_6Pw2Nc",
  "object": "event",
  "livemode": false,
  "eventName": "agent.turn",
  "customer": "cus_8HqL2xT",
  "customerUnit": null,
  "sentAs": {
    "customer": "northwind",
    "customerUnit": null
  },
  "product": "prod_9Lm4Vt",
  "dedupeKey": "turn_5c1e9a",
  "timestamp": "2026-11-04T09:31:12Z",
  "correlationId": "ticket_4410",
  "payload": {},
  "cost": [
    {
      "type": "inference",
      "amount": { "amount": "0.927", "currency": "usd" },
      "pricing": {
        "source": "paidCatalog",
        "priceVersion": "2026-10-01"
      },
      "inference": {
        "operation": "chat",
        "provider": "fabrikam",
        "model": "fabrikam-large-2",
        "inputTokens": 3200,
        "cacheReadInputTokens": 2400,
        "outputTokens": 410,
        "uncachedInputTokens": 800
      }
    }
  ],
  "duplicate": false,
  "warnings": [],
  "quantity": null,
  "derived": null,
  "createdAt": "2026-11-04T09:31:13Z"
}
```

The line came back with an `amount` of 0.927¢, priced from Paid's catalog version `2026-10-01`, and `uncachedInputTokens`: 3,200 input tokens minus 2,400 cache reads = 800.

#### Dashboard

> **Draft**
>
> These steps describe the planned v1 dashboard and will change before release.

Cost lines are sent on events, through the API. To see them:

1. Go to **Analyze > Cost**.
2. Filter by customer (`Northwind Traders`), product or cost type.
3. Click a run to see the events that share its correlation ID and what each one cost.

## Cost types

| `type`       | Use it for                        | Details object                                                     | `amount`                     |
| ------------ | --------------------------------- | ------------------------------------------------------------------ | ---------------------------- |
| `inference`  | Model calls                       | `operation`, `provider`, `model`, `responseModel` and token counts | Optional: Paid calculates it |
| `compute`    | CPU or GPU time                   | `resource` (`gpu` or `cpu`), `instanceType`, `duration`            | Required                     |
| `storage`    | Data stored                       | `size`, `duration`                                                 | Required                     |
| `thirdParty` | Other vendors' APIs               | `vendor`, `description`                                            | Required                     |
| `human`      | People's time, such as a reviewer | `role`, `duration`                                                 | Required                     |
| `other`      | Anything else                     | `description`                                                      | Required                     |

The details object is required for `inference` and optional for every other type. `duration` and `size` are quantities with an explicit unit, such as `{ "value": "212", "unit": "second" }`.

## Amounts

A cost `amount` is `{ amount, currency }`, where `amount` is a decimal string in the currency's minor units, with up to 15 decimal places. In `usd`, `"41"` is 41¢ and `"0.42"` is 0.42¢. Per-call costs are often a fraction of a cent, which is why amounts aren't whole numbers.

`pricing.source` says where each line's amount came from:

| `source`      | The amount came from                                           |
| ------------- | -------------------------------------------------------------- |
| `paidCatalog` | Paid's model catalog, at the version in `pricing.priceVersion` |
| `provided`    | the `amount` you sent                                          |

If you already know what a model call cost, for example from your provider's invoice data, send `amount` on the inference line, and Paid uses it as given.

## Inference fields

The inference fields follow the OpenTelemetry GenAI conventions, in camelCase, so you can copy them from your traces:

| Field                      | OpenTelemetry attribute                                 |
| -------------------------- | ------------------------------------------------------- |
| `operation`                | `gen_ai.operation.name`, such as `chat` or `embeddings` |
| `provider`                 | `gen_ai.provider.name`                                  |
| `model`, `responseModel`   | `gen_ai.request.model`, `gen_ai.response.model`         |
| `inputTokens`              | `gen_ai.usage.input_tokens`                             |
| `cacheReadInputTokens`     | `gen_ai.usage.cache_read.input_tokens`                  |
| `cacheCreationInputTokens` | `gen_ai.usage.cache_creation.input_tokens`              |
| `outputTokens`             | `gen_ai.usage.output_tokens`                            |
| `reasoningOutputTokens`    | `gen_ai.usage.reasoning.output_tokens`                  |

As in OpenTelemetry, `inputTokens` is the total and includes cached tokens. Paid prices each part at its own rate, and adds a read-only `uncachedInputTokens`: `inputTokens` minus `cacheReadInputTokens` minus `cacheCreationInputTokens`. A meter that bills input tokens should sum `uncachedInputTokens`, so cached tokens aren't counted twice.

When you send `responseModel`, Paid prices on it, because a router may serve a different model from the one requested. Token counts are non-negative integers.

## Record other costs

Adatum analyses video on GPUs, and a person reviews some results. It states both costs on the same event:

**`POST /v1/events`**

```json title="POST /v1/events"
{
  "eventName": "video.analyzed",
  "customer": "brightrail",
  "product": "video_analysis",
  "dedupeKey": "job_77a10f",
  "payload": { "minutes": 14 },
  "cost": [
    {
      "type": "compute",
      "amount": { "amount": "38.5", "currency": "usd" },
      "compute": {
        "resource": "gpu",
        "instanceType": "h100",
        "duration": { "value": "212", "unit": "second" }
      }
    },
    {
      "type": "human",
      "amount": { "amount": "120", "currency": "usd" },
      "human": {
        "role": "reviewer",
        "duration": { "value": "4", "unit": "minute" }
      }
    }
  ]
}
```

The event cost Adatum 38.5¢ of GPU time plus 120¢ of review: 158.5¢, or \$1.585. Both lines come back with `pricing.source: "provided"`.

A model provider that sells tokens records them differently: tokens are its usage, so they go in `payload`, and its own cost of serving them is a `compute` line. `inference` lines are for companies that buy model calls.

## How it bills

Litware bills Northwind for inference at cost plus 20%, with a [`costPlus` price](/catalog/prices#cost-plus-pricing) on an event meter that reads `agent.turn`, with `multiply: "1.2"` and `costTypes: ["inference"]`. In November:

| Step                                        | Value                         |
| ------------------------------------------- | ----------------------------- |
| Events selected                             | 48,200 `agent.turn` events    |
| Inference cost (sum of the lines' `amount`) | 152,340.25¢                   |
| Markup                                      | × 1.2                         |
| Charge                                      | 152,340.25 × 1.2 = 182,808.3¢ |
| Invoice line                                | Inference: **\$1,828.08**     |

Paid calculates the charge exactly and rounds once, to whole cents, on the invoice line. Each cost type a `costPlus` price bills gets its own invoice line.

## Unknown models and errors

If Paid's catalog doesn't know the provider or model, the line is stored without an amount (`amount: null`) and flagged with `unknown_provider` or `unknown_model`. When Paid's catalog prices the model later, the line is priced at the rate in effect at its `timestamp`.

A line fails, and in a batch only its item fails, when:

| `code`                        | Cause                                                                                               |
| ----------------------------- | --------------------------------------------------------------------------------------------------- |
| `type_mismatch`               | The details object doesn't match `type`, or more than one was sent.                                 |
| `invalid_request` on `amount` | A cost type Paid can't calculate was sent without `amount`.                                         |
| `invalid_request`             | A token count is negative or not an integer, or the cache counts add up to more than `inputTokens`. |

Cost lines can't be changed after the event is accepted.

## Related

* [Send events](/usage/sending-events)
* [Meters](/usage/meters)
* [Prices](/catalog/prices#cost-plus-pricing)
* [Events API reference](../api-reference/metering/events/create)