Userecordtells Unprice what happened.consumedecides whether known usage may happen now.runsreserve a budget before a workload starts.access.checkasks without changing state.
eventSlug for the broad event your app observed, such as completions. Use featureSlug for
the specific product feature you are checking or consuming, such as ai-messages,
ai-generations, or ai-tools.
Decision table
| Use case | Call | Blocks paid work? | Mutates state? | Best for |
|---|---|---|---|---|
| Compare Unprice against existing logic | access.check | No | No | Shadow mode, preflight UI, entitlement checks |
| Enforce a known usage amount before work runs | usage.consume | Yes | Yes | API calls, exports, known-cost actions |
| Report usage without blocking the request | usage.record | No | Yes, asynchronously | Background metering, invoice evidence, eventual analytics |
| Reserve spend for multi-step work | runs.start / runs.consume / runs.end | Yes | Yes | Workflows, jobs, tools, agents, custom workloads |
access.check: ask without changing state
Use access.check when you want to know whether a customer can use a feature, but you do not want
to consume usage or reserve credits.
result.allowed beside your current logic.
usage.consume: decide and apply now
Use usage.consume when the request path needs a synchronous commercial decision and the usage
amount is known before the work runs.
usage.consume is the enforcing path for simple known-cost actions. Retry the same logical request
with the same idempotencyKey.
usage.record: report for evidence
Use usage.record when the request should not wait for Unprice to decide. It queues the usage event
for metering, analytics, and invoice evidence.
usage.record never blocks over-budget work. Do not use it as a spend gate. One async event can
carry several measured properties; meters decide which property applies to each feature.
runs: reserve a budget envelope
Use budgeted runs when a paid action unfolds over multiple steps and can spend more than expected.
The run labels the workload and reserves a budget before it starts.
runs.consume as the workload spends and runs.end when it finishes. Unprice does not own the
workload executor; it owns the budget reservation, spend decision, and evidence trail.
Shortcut
Simple request path
Use
usage.consume when one request maps to a known usage amount.Multi-step workload
Use
runs.start when the workload needs a budget before it begins.