You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(credits): close the five accounting holes from review
- Scope the balance's spend aggregation to provider "nodetool": BYOK
predictions (fal_ai, anthropic, ...) no longer drain credits, and
historical BYOK spend no longer zeroes new balances. Regression test
covers mixed managed/BYOK rows.
- Gate the no-payment top-up behind NODETOOL_ENABLE_TEST_TOPUP (off by
default): the mutation throws FORBIDDEN otherwise, status reports
testTopupEnabled, and the UI hides the button.
- Direct generate_media now admits against a unit-price estimate,
reserves it for the duration of the call, and records a prediction row
(max of delegate-tracked cost and the unit estimate) so the balance
decrements; transcribe_audio records delegate-tracked cost likewise.
- Workflow runs reserve their nodetool estimate when admitted and
release at the terminal state or cancel-while-queued, so concurrent or
queued submissions can't multiply a small balance (process-local, TTL-
bounded; a multi-instance deployment moves this into the DB like
application-budgets).
- NodetoolProvider builds a fresh delegate per call instead of sharing a
cached instance, so absorbing cost off the delegate's cumulative
counter can't double-count overlapping calls.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011GwuPTt5T1sLkmpwWUt2N2
0 commit comments