Skip to content
v0.8.4stable

Versioned pricing and Project/Token Guard

Cost governance is not one global budget switch. Halro answers four separate questions in order:

  1. Price Version: how this Attempt is priced;
  2. Project controls: whether the application may start more work;
  3. Token Guard: whether this request or recent behavior is anomalous;
  4. Run budget: whether one business execution may spend more.

Price Versions are immutable and effective-dated. Bind the exact Provider, target, Region, tier, currency, token classes, and any per-request fee. Never use zero to mean “unknown”; mark a genuinely free target explicitly.

1. Establish trustworthy pricing
ItemConsole unitTypical use
InputUSD / 1M tokensOrdinary input tokens
Cached inputUSD / 1M tokensProvider-reported cache-read input
OutputUSD / 1M tokensOrdinary output and Provider-defined reasoning tokens
Fixed per requestUSD / requestMedia, Rerank, resource operations, or contract fees

Store source type and reviewable notes. Public list, contract, internal transfer price, and temporary estimate carry different assurance. Confirm model, Region, Tier, caching rules, and units. The confirmation example catches million-token, fixed-fee, and decimal mistakes but does not replace independent recalculation. Each Attempt binds the full pre-I/O snapshot; later versions never rewrite history.

Immediate, scheduled, and time-window prices

Section titled “Immediate, scheduled, and time-window prices”
  • An immediate version cannot be deleted; supersede it with a later version.
  • A scheduled version may be canceled before activation; every new scheduled time must be after all uncanceled scheduled versions.
  • If a future version exists, do not insert an earlier “immediate” version; cancel the blocker or schedule after it.
  • Time-window pricing uses the Provider’s IANA timezone, not Project Accounting timezone; split windows across midnight.
  • Uncovered times use the version’s base rate and are never treated as free.

After restoring an old backup, a scheduled version may have crossed its effective time during downtime. The Deployment enters pricing quarantine until an administrator reviews the timeline and confirms restored pricing.

2. Use Projects for deterministic boundaries

Section titled “2. Use Projects for deterministic boundaries”
2. Use Projects for deterministic boundaries
SettingRisk protectedHow to set it
Allowed ModelsWrong environment or unapproved modelOnly required public Route aliases
Daily BudgetUnbounded daily costNormal daily use, peaks, and stop policy; it is a hard gate, not an alert
RPM / TPMRetry storms or input spikesReal peak plus justified headroom
Max concurrencyUpstream/local exhaustionCombine application, Deployment, and Provider concurrency
Input/output token limitsExcessive worst-case request costLongest business input and acceptable answer
Body/stream limitsImages or long streams occupy resourcesEncoding expansion, client and Gateway timeouts
Allowed CIDRsKey use from another networkActual application egress or controlled networks

Separate development, staging, production, owners, and cost centers into distinct Projects. Gateway Keys inherit Project boundaries and never bypass them. Daily Budget follows Accounting timezone, so a day may be 23, 24, or 25 hours. Timezone changes apply after the current period and do not rewrite UTC evidence.

Budget is reserved before Provider I/O and settled from actual or conservative usage afterward. Retries and fallbacks belong to the same visible request but can create multiple billable Attempts.

Token Guard complements, not replaces, Project rate, concurrency, and budget boundaries. Simulate real samples before binding. Fixed thresholds cover per-request tokens, per-minute tokens and cost, concurrency, error rate with minimum samples, and unique source IPs per minute.

3. Use Token Guard for abnormal behavior
ActionEffectRecommended stage
observeInitial fixed-threshold hits are recorded; repricing or policy-version rechecks may still fail closedEstablish baseline and observe recheck rejection
alertInitial hits are recorded and delivered; rechecks may still fail closedValidate thresholds, delivery, and response
temporary_blockBlocks after the configured violation countOnly after false positives and unblock flow are accepted

Configure violations-before-block, block TTL, and cooldown. Manual unblock is not root-cause remediation. EWMA detects deviation from history; establish absolute RPM, TPM, per-request token, and cost thresholds first, then configure warmup, evaluation window, minimum sample, and cooldown. Current EWMA alerts only and is not an automatic block boundary.

4. Add Run budgets only for business execution boundaries

Section titled “4. Add Run budgets only for business execution boundaries”

A Run budget limits the combined committed + reserved + pending cost of one execution, while the Project budget covers the business boundary. Provider retries and fallbacks consume the same Run balance. A new execution of the same Work Unit gets a new Run; do not reset a budget by relabeling a retry. Halro atomically checks both budgets before Provider I/O. Insufficient Run balance does not auto-close the Run. Unknown price cannot pass Run-budget admission even when the instance permits ordinary unknown-price requests.

Run Governance is experimental. Use it only when the application can define a stable Work Unit and Outcome Definition and can close or expire abandoned Runs.

  1. Price review: FinOps/contract owner confirms identity, units, caching, and effective time.
  2. Project hard boundaries: allowed models, output, budget, RPM, TPM, and concurrency.
  3. Observe: use Token Guard observe over normal peaks, troughs, and releases; test repricing/policy recheck rejection.
  4. Alert: validate recipient, deduplication, retry, response deadline, and recheck path.
  5. Temporary block: enable only high-confidence fixed thresholds and drill expiry/manual unblock.
  6. Run budget: pilot after the application defines real Work Unit/Run boundaries; do not derive them mechanically from HTTP requests.
6. Acceptance matrix
TestExpected result
Deployment has no effective Price VersionRefused before Provider I/O, never shown as $0.00
Explicit freeKnown zero cost with a free price snapshot
New Price VersionNew Attempts use the new snapshot; historical amounts remain
Scheduled version not activeCurrent version remains until the effective instant
Project daily budget insufficientRefused before Provider I/O; blind retry cannot help
Token Guard observeInitial fixed hit records only; higher Attempt cost or policy change can still return token_guard_blocked on recheck
Temporary block triggeredSubsequent requests reject until TTL or reviewed admin action
Run balance insufficientProject may have balance, but this Run rejects
Missing Provider Usage or ambiguous resultAttempt is estimated or unknown, never zero by default

After acceptance, expand the Attempt under Usage & Calls and verify reported tokens, price snapshot, input/output/fixed fees, estimated, and final amount.