cellmap_flow.ai_annotate.usage
A per-user daily cap on hosted-model calls, kept across dashboard restarts.
Each call to a hosted model costs money, and a stuck key or a runaway loop
in the browser could make hundreds. The config’s daily_call_limit caps
the calls one user makes in a local calendar day. The count lives in the
user’s home (~/.cellmap_flow/ai_annotate_usage.json), not in the session,
so restarting the dashboard does not reset it, and two dashboards the same
user runs share it.
A call is counted before it is made, so a failed call counts too: it may still have been billed.
Attributes
Functions
|
|
|
Count one call against today's |
|
Take back one call counted today: one refused before it reached the model. |
|
Calls counted so far today. |
Module Contents
- cellmap_flow.ai_annotate.usage.fcntl = None
- cellmap_flow.ai_annotate.usage.logger
- cellmap_flow.ai_annotate.usage.usage_path()
~/.cellmap_flow/ai_annotate_usage.json.
- cellmap_flow.ai_annotate.usage.check_and_count(limit, *, path=None, today=None)
Count one call against today’s
limitand return the calls used, this one included.Raises
AIAnnotateError("limit")without counting when today’s calls already reached the limit.pathandtodayare for tests.
- cellmap_flow.ai_annotate.usage.refund(*, path=None, today=None)
Take back one call counted today: one refused before it reached the model.
A call that fails signing in, or that the config rejects, costs nothing, so it should not use up the day’s limit. Never goes below zero.
- cellmap_flow.ai_annotate.usage.calls_today(*, path=None, today=None)
Calls counted so far today.