Skip to content
AISpendbook

Finance

Outcomes & unit costs

Define an accepted outcome, send events and non-token costs, and read the cost, revenue and margin per accepted outcome.

An outcome is one result your product delivers, such as a support ticket that was not reopened. You define when it counts as accepted, send one event per outcome, and the page shows the cost per accepted outcome:

Unit cost = (token cost + non-token cost) / accepted outcomes.

Definitions

  • An admin creates a definition with a key, a name, a statement of what counts as accepted, an optional scope (a feature, a customer or both) and an effective date.
  • The key can't be changed later. An edit writes a new version and old versions are kept.
  • An event is judged under the version in effect on its UTC day and stores that version. A new version never rewrites how earlier events were judged.

Outcome events

Send events from your code to POST https://www.aispendbook.com/api/v1/outcomes/ingest with an ingestion key, up to 500 per request. The response reports how many were written, how many were duplicates and which were rejected.

one outcome event
curl -sS -X POST "https://www.aispendbook.com/api/v1/outcomes/ingest" \
  -H "Authorization: Bearer $SPENDBOOK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"events": [{
    "definition": "ticket_resolved",
    "occurred_at": "2026-11-20T14:03:00Z",
    "accepted": true,
    "customer_id": "acme",
    "feature": "support-bot",
    "external_id": "ticket-48213"
  }]}'
FieldRequiredDescription
definitionyesThe key of the outcome definition.
occurred_atyesISO-8601 timestamp with a time zone.
acceptedyestrue or false.
customer_idThe customer the outcome was for. Events without one count in the totals only.
featureThe feature that produced it.
session_idYour session or call id.
trace_idYour trace id.
external_idYour id for the outcome. Sending the same id again is a no-op, so a retry is not counted twice.

An event is rejected when its definition is unknown or when it occurred before the definition's first effective date.

Non-token cost lines

  • A cost line is a cost that is not model tokens. Its kind is one of telephony, speech to text, text to speech, tool, human review, infrastructure or other.
  • Each line has an amount, a day, and optionally a quantity and unit, a customer, a feature and a session id.
  • Admins add lines in the app. A line with an external id is written once per source.
  • The Vapi and Retell connectors write cost lines per call. The ElevenLabs and Deepgram connectors write one cost line per day, and Twilio, Bland, Synthflow, Qdrant, Pinecone (Admin API cost export, Enterprise plan) and Zilliz Cloud write cost lines too. None of these connectors has been run against a live account.
  • CoreWeave, Weaviate Cloud and Turbopuffer have no billing API: upload the PDF invoice under Import cost lines (choose the vendor) or forward the invoice email to the workspace's invoice address. The amount before tax is spread evenly over the service period's days as infrastructure cost lines. USD invoices only; the same invoice twice adds nothing.
  • Any vendor's cost can also be uploaded as a CSV under Non-token cost lines, Import CSV (date, amount_usd, and optional kind, quantity, unit, customer_id, feature, external_id), for example the Pinecone usage report on plans without the Admin API. Uploading the same rows again adds nothing.
  • Support resolutions read from Zendesk or Intercom arrive as outcome events (see IT, GRC, close and support tools).

How the unit cost is computed

  • With a scope, token cost is the request telemetry estimate for that feature or customer, because billed spend has no feature or customer. Only cost lines that carry the same feature or customer are counted.
  • With no scope, token cost is all AI spend of the workspace in the period (billed where available, otherwise estimated) and every cost line is counted.
  • Per-customer rows use the request telemetry that carries that customer id. They do not have to add up to the total.
  • With no accepted outcome in the period, the cost per accepted outcome is not defined and is left empty.

Revenue and margin per outcome

  • The Revenue and margin per outcome card prices each customer's accepted outcomes from its approved deal for this outcome (fee, seats, included units, overage or tiers, discount, caps), otherwise from its contract whose allowance counts this outcome (monthly price plus overage above the allowance).
  • It shows revenue, cost and margin per outcome, per customer and in total, against the unit cost above. Customers with no price are counted apart and left out of the totals.
  • A deal with ramp steps is priced on its base terms. This is a price applied to outcomes, not recorded revenue; invoices stay on the margin page. Members without revenue access can't open it.