Files
devplacepy/devplacepy/services/devii/actions/cost_actions.py
T
2026-06-09 06:41:27 +02:00

40 lines
1.5 KiB
Python

# retoor <retoor@molodetz.nl>
from __future__ import annotations
from .spec import Action
COST_ACTIONS: tuple[Action, ...] = (
Action(
name="usage_quota",
method="LOCAL",
path="",
summary="Report the current user's AI usage as a percentage of their rolling 24h quota",
description=(
"Returns ONLY the percentage of the rolling 24-hour AI quota the current user has "
"used, the number of turns taken today, and whether the limit is reached. It never "
"returns any cost, dollar amount, pricing, or spend figure. Use this for any "
"'how much have I used' or 'what percent of resources' question."
),
handler="cost",
requires_auth=False,
read_only=True,
),
Action(
name="cost_stats",
method="LOCAL",
path="",
summary="Report token usage and full USD cost statistics for the current session (administrators only)",
description=(
"Administrators only. Returns this session's LLM token counts (prompt, completion, "
"total, cache hit/miss, reasoning), the cost in USD broken down by cache-hit input, "
"cache-miss input, and output, per-request averages, cache hit rate, and session "
"timing. Financial figures must never be shown to non-admin users."
),
handler="cost",
requires_auth=True,
requires_admin=True,
read_only=True,
),
)