cyberine
UsageRun recipes

Credit ledger — track provider balances, gate low-credit workers

Cyberine can track an approximate estimated remaining balance per provider and skip or down-rank workers whose provider is running low. Credits do not need to match the provider dashboard exactly; the ledger intentionally estimates LOWER (conservative round-up) so estimated-remaining is always <= reality and you are never surprised by an unexpected 402.

A provider absent from the ledger is treated as unlimited — default behaviour is byte-for-byte unchanged until you opt a provider in.

# Seed a provider balance (resets estimated spend to $0)
cyberine credits set deepseek 10

# Top-up without resetting spend (adds to existing balance)
cyberine credits add deepseek 5

# Show all tracked providers: balance, estimated spent, remaining, and status
cyberine credits

# Remove a provider from the ledger (opt-out, revert to unlimited)
cyberine credits reset deepseek

Sample output of cyberine credits:

provider          balance   spent-est    remaining  status
──────────────────────────────────────────────────────────────
deepseek          $10.0000     $1.2345     $8.7655  ok
openrouter         $5.0000     $4.8000     $0.2000  low (<$0.50)

threshold: $0.50 (CYBERINE_CREDIT_MIN_USD)

When a worker's estimated remaining drops below the threshold (CYBERINE_CREDIT_MIN_USD, default $0.50), it is moved to the back of the selected fleet (down-ranked, not removed). If ALL workers in the fleet are below threshold, the cheapest one is kept as a last-resort fallback with a warning in the routing reasons — the fleet is never emptied.

When a hard 402 / insufficient-credits error fires, Cyberine automatically zeros that provider's estimated balance in the ledger so it is gated out immediately on the next dispatch (in addition to the existing worker-cooldown.json time-based gate).