When getUsage is provided in options, it is called with the result
of fn to extract actual token usage. The refund mechanism then
returns the difference between the reservation and actual consumption
to the budget.
Deduplication (when enabled) applies to run() only; acquire()
never deduplicates. A caller that joins an existing in-flight call
is capped only by its own signal and an explicitly passed
per-call timeoutMs — the bulkhead-level timeoutMs (a queue-wait
timeout) does not apply to that wait.
Primary API. Acquire → call
fn→ release, automatically.Throws
LLMBulkheadRejectedErroron rejection.When
getUsageis provided in options, it is called with the result offnto extract actual token usage. The refund mechanism then returns the difference between the reservation and actual consumption to the budget.Deduplication (when enabled) applies to
run()only;acquire()never deduplicates. A caller that joins an existing in-flight call is capped only by its ownsignaland an explicitly passed per-calltimeoutMs— the bulkhead-leveltimeoutMs(a queue-wait timeout) does not apply to that wait.