Spend Caps & Auth
Mid-run spend ceilings, cost protection, and OS keyring credentials.
Spend Caps & Authentication
NIKI provides built-in cost controls and OS-keyring credential storage.
Mid-Run Spend Cap (spend_cap_usd)
To prevent runaway LLM costs or unexpected loop charges, NIKI tracks token consumption after every agent stage.
If the estimated cumulative cost exceeds general.spend_cap_usd, NIKI immediately aborts the run, avoids creating broken git branches, and outputs a diagnostic error:
[general]
spend_cap_usd = 2.50 # Aborts run if estimated cost exceeds $2.50 USD
The cap uses estimated cost from the dated table in src/cost.rs (currently 2026-09-06), not an invoice. Unknown billable models are recorded as $0.00 with a warning, so their reported cost can understate real spend.
OS Keyring Credential Storage
niki auth login stores credentials in the operating system’s native secure keyring (Apple Keychain, Windows Credential Manager, Linux Secret Service):
# Log in to a provider securely
niki auth login --provider anthropic
# Check status of saved credentials
niki auth status
# Log out / remove key
niki auth logout --provider anthropic
Keyring entries are storage and status records only. Runtime provider construction currently reads niki.toml and supported environment variables; it does not resolve keyring values, so a key stored only with niki auth login is not yet a live runtime credential source.