Get compute duration and cost from inside a run, or for a specific block of code.
costInCents
baseCostInCents
and durationMs
fields.
usage.measure
to get the cost and duration of that block of code:
run
function, our lifecycle hooks (like onStart
, onFailure
, onSuccess
, etc.), or any function you’re calling from the run
function. It won’t work for code that’s not executed using Trigger.dev.