Files
Cato 3901ff0342 feat(spend): Google out of the free chain; paid AI off unless a feature opts in, and capped (1.26.0) (#112)
freeChain() put Google's Gemini API second, on a fleet-wide GEMINI_API_KEY
described as a free per-project tier. The project had billing; every app on
the box fell through to it whenever Groq's pool was spent, about $567 on
10-11 Nov 2026. Google is not in the chain any more; it bills.

- freeChain(): Groq, then OpenRouter :free. visionProviders() loses the
  Google seat; the free vision left is OpenRouter's :free Gemma id.
- spend: a provider is paid when marked so or when it is Google's Gemini
  API, xAI, Anthropic or OpenAI (by host or key name, also prefixed). A
  reader's own key is never paid by us.
- AI_PAID_DISABLED is on when unset; AI_PAID_OK / {PREFIX}_AI_PAID_OK opts an
  app in. usableChain() drops paid providers unless allowed.
- Daily caps (UTC): fleet 90 calls / 120,000 in / 60,000 out; per-app rows
  (about 60% of the fleet named), aliases, unknown apps 1 / 800 / 400, no-AI
  apps 0; xAI 0 until opted in, then 2 / 2,000 / 1,000; a 5,000-call free
  loop guard. Env overrides per prefix. A reached cap throws SpendLimitError
  ("limit reached") and never walks onto another paid vendor.
- images: every paid transport, the gemini one included, is gated the same
  way; ownKey for a person's own key.
- README, docs/providers.md and CHANGELOG say plainly that Google bills.

Tests: test/spend.test.js (kill switch on/off/missing, no xAI or Google
link without opt-in, caps and headroom, aliases, unknown app, env
overrides, cap hit without walking to another paid vendor, fleet cap,
token cap, BYOK past spent caps, free loop guard); chain, images and vision
tests updated. 425 pass.
2026-11-12 22:27:29 +01:00
..