mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-11-06 21:53:02 +03:00
* Measure Gemini image-token cost instead of using the pixel heuristic Review descriptions size their frame budget from the provider's estimate_image_tokens(). Gemini did not override it, so the base ~1-token-per-1250-pixels heuristic was used: about 46 tokens for a 320x180 preview frame. Gemini 3 models actually bill about 1100 tokens per image regardless of size, so the 24000-token image budget let Frigate send one frame per second of the review item (e.g. 90 frames for a 90 s alert) instead of ~21, and review descriptions cost roughly 4x more than intended. Probe the model with the free count_tokens endpoint, the same way the llama.cpp provider measures its mmproj, and cache the result per image size. Fall back to the base heuristic if the request fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Bound Gemini image-token probes and back off after failures estimate_image_tokens() runs on the enrichment thread, and count_tokens was using the client's defaults: a 120 s timeout and 3 attempts on 429/5xx. A hung endpoint could stall review processing for minutes per review, and a rate-limited key retried on every review of an unmeasured size. Give the probe a 5 s timeout with no retries, and after a failure use the heuristic without probing again for 5 minutes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Update docs to note that Gemini charges roughly-flat token cost regardless of video resolution --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Website
This website is built using Docusaurus 3.5, a modern static website generator.
For installation and contributing instructions, please follow the Contributing Docs.
Development
- Run
npm ito install dependencies - Run
npm run startto start the website