caelum0x 7da8e22925 feat(relay): daily spend caps and paid-floor failover for product keys
- relay_key_budgets gains an optional daily_limit_micros (UTC day). The
  spend-cap middleware answers 429 relay_spend_cap_exceeded with
  error.period "day" or "month"; the monthly cap wins when both are hit.
- A groq::<model> (or any managed-provider) shorthand whose provider is the
  first route of a same-id catalog model now runs on that catalog model when
  a later route is enabled, so an exhausted Groq key fails over to the
  OpenRouter floor instead of failing the caller. First attempt unchanged.
- Budgets UI: optional daily cap field and today's spend.
- Tests: unit tests for decide/validation/failover/429 body, plus a
  live-Postgres test of the month and day windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 04:39:15 +03:00
..