2 Commits
Author SHA1 Message Date
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
CatoandClaude Opus 5 e449c97a40 docs(providers): a register of what each vendor actually costs (#63)
A provider ruled out today for costing money is worth revisiting the moment
there is a budget. That only works if the REASON survives — otherwise the next
person re-derives it from scratch, and re-derives it wrongly, which is what kept
happening.

So: every provider looked at, what it costs, and the evidence and date behind
each verdict. Wired, not-free-revisit-later, unverified-candidate, retired.

The rule it exists to enforce, learned twice this week in OPPOSITE directions:

  - An unkeyed 401/403 proves the HOST EXISTS, nothing more. Cerebras cleared
    that bar and then refused every completion with 402 payment_required. It was
    carried as a free vendor for two days on the strength of it.
  - An unkeyed 404 does NOT mean absent. Google's OpenAI-compatible
    /v1beta/openai/models answers 404 without a key and 200 WITH one. It sat in
    a rejected list on the reasoning that the endpoint had no catalogue.

An unkeyed probe cannot separate "absent" from "hidden behind auth" in either
direction. A vendor is only free once a real key has served a real completion.

Concrete things now written down rather than remembered:

  - Cerebras has NO permanently free tier — their own FAQ says so. $5 in trial
    credits that EXPIRE after 30 days and are consumed by usage. That is the
    opposite of OpenRouter, where a one-time $10 UNLOCKS 50 -> 1000 free
    requests/day and is never consumed by `:free` models. Prices kept so the
    call can be made on numbers when there is budget; Cerebras is also the
    fastest inference on the list at ~3000 tok/s, which is the reason to
    revisit it.
  - OpenRouter's unpaid tier is 50 requests a DAY for the whole ACCOUNT. On a
    box where several apps share one key, that is the scarcest pool in the
    chain and the reason it is ordered last.
  - Novita is the best unverified free candidate: 8 zero-priced chat models with
    function-calling. With a warning attached — `qwen3.5-plus` and
    `qwen3.6-plus` read as price 0 but carry `is_tiered_billing=true`, the shape
    that starts billing at volume.
  - Cloudflare Workers AI is the strongest untested no-card option.
  - GitHub Models is RETIRED: 410 with `github_models_retirement_brownout`.

Plus the checklist for adding one, including the two traps that are invisible
until they bite: a model that cannot emit a native tool_call is useless to a
tool loop however cheap (groq/compound-mini advertises 70000 TPM and refuses
tool calling), and the id format the CATALOGUE uses may differ from what
/chat/completions accepts (Google lists `models/`-prefixed ids and accepts both,
so the bare form serves perfectly while the rot check reports it missing every
run).

Docs only. 278 tests pass, verify clean.


Claude-Session: https://claude.ai/code/session_01HJRuvHJEBd8t7iRA9Sb1iw

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-15 03:49:57 -07:00