async-bulkhead-llm - v3.17.0
    Preparing search index...

    Type Alias TokenBudgetOptions

    async-bulkhead-llm — public API surface.

    This entry point re-exports everything the package supports; the implementation lives in focused modules:

    • types.ts — request/result/options/stats/event types
    • errors.tsLLMBulkheadRejectedError
    • profiles.tsPROFILES presets
    • estimators.ts — naive + model-aware estimators, extractTextLength
    • adaptive.tscreateAdaptiveTokenEstimator (v3.8)
    • dedup.ts — deduplication internals (keying, share safety)
    • validation.ts — internal numeric/estimate/usage guards
    • bulkhead.tscreateLLMBulkhead (admission, budget, events)

    Deep-importing the internal modules is not supported; the package exports map exposes only this entry point.

    type TokenBudgetOptions = {
        budget: number;
        estimator?: TokenEstimator;
        highPriorityReserve?: number;
        outputCap?: number;
    }
    Index
    budget: number

    Maximum tokens allowed in-flight simultaneously across all active requests. Admission is always fail-fast when this ceiling is reached, independent of concurrency headroom and independent of profile.

    Must be a non-negative integer. 0 is valid and intentional — it represents a pool with no budget to grant this cycle (e.g. a lease ledger reporting exhaustion) and results in every budget-gated admission being rejected with "budget_limit" until the ceiling is raised (via applyLimits() or setBudget()) or tokenBudget admits a zero-token request.

    estimator?: TokenEstimator

    Estimator used to calculate token reservation pre-admission. Defaults to createModelAwareTokenEstimator seeded with the bulkhead's model.

    highPriorityReserve?: number

    Tokens of budget headroom reserved for priority: "high" requests.

    Normal-priority admission is checked against budget - highPriorityReserve; high-priority admission is checked against the full budget. This lets interactive traffic keep admitting while batch traffic has saturated the shared pool.

    Must satisfy 0 <= highPriorityReserve <= budget. Default: 0 (priority has no effect).

    outputCap?: number

    Fallback output reservation when request.max_tokens is absent. Default: 2048.