Skip to navigation

Event costs

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, such as inference at cost plus 20%.
  • Bill tokens without sending them twice, with a meter 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:

Create an event with a cost line of type inference. Leave out amount, and Paid calculates it.

{
"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
}
}
]
}

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.

Cost types

typeUse it forDetails objectamount
inferenceModel callsoperation, provider, model, responseModel and token countsOptional: Paid calculates it
computeCPU or GPU timeresource (gpu or cpu), instanceType, durationRequired
storageData storedsize, durationRequired
thirdPartyOther vendors’ APIsvendor, descriptionRequired
humanPeople’s time, such as a reviewerrole, durationRequired
otherAnything elsedescriptionRequired

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:

sourceThe amount came from
paidCatalogPaid’s model catalog, at the version in pricing.priceVersion
providedthe 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:

FieldOpenTelemetry attribute
operationgen_ai.operation.name, such as chat or embeddings
providergen_ai.provider.name
model, responseModelgen_ai.request.model, gen_ai.response.model
inputTokensgen_ai.usage.input_tokens
cacheReadInputTokensgen_ai.usage.cache_read.input_tokens
cacheCreationInputTokensgen_ai.usage.cache_creation.input_tokens
outputTokensgen_ai.usage.output_tokens
reasoningOutputTokensgen_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
{
"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 on an event meter that reads agent.turn, with multiply: "1.2" and costTypes: ["inference"]. In November:

StepValue
Events selected48,200 agent.turn events
Inference cost (sum of the lines’ amount)152,340.25¢
Markup× 1.2
Charge152,340.25 × 1.2 = 182,808.3¢
Invoice lineInference: $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:

codeCause
type_mismatchThe details object doesn’t match type, or more than one was sent.
invalid_request on amountA cost type Paid can’t calculate was sent without amount.
invalid_requestA 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.