ClipSpacesClipSpaces Docs
Back to app

All releases

AI cost controls (fix OpenRouter 402)

OpenRouter reserves the full max_tokens against your balance up front, so the 700-token briefing 402'd on a low/free balance. Cut AI usage across the board.

Changed

  • Lower output budgets: briefing 700 → 400, chat 900 → 500 tokens. Tunable via AI_BRIEF_MAX_TOKENS / AI_CHAT_MAX_TOKENS.
  • Image captioning now opt-in (AI_IMAGE_CAPTIONS=1, default off). It was the biggest cost — one paid vision call per image, up to the cap, on every fresh scan. Link + Notion enrichment cost no extra model calls, so they stay on.
  • Leaner enrichment context: scraped link text 1500 → 600 chars, Notion 2500 → 1200; per-request caps lowered (images 14 → 8, links 24 → 12, notion 12 → 10). Less input cost on every turn.
  • A 402 from OpenRouter now surfaces as a clear "out of credits" message instead of the raw provider error. OPENROUTER_MODEL can also be pointed at a cheaper/free slug to cut per-call cost.