Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

LLMBUDGET.STATUS

Last updated
LLMBUDGET.STATUS name
Group
LLM usage and budgets
Complexity
O(1)
Arity
2 (exactly, counting the command name)
Flags
read-only, fast
Keys
first 1, last 1, step 1
HotKV Cloud
Performance and Scale
On-Premise
requires the llm-budget license feature

LLM budgets put a hard cap on the tokens and dollars a named budget (for example one per tenant) can spend in a time window, so you can refuse a request before you pay the model provider for it. LLMBUDGET.STATUS reports a budget’s state. For a budget that does not exist, every field is zero.

The reply is a flat array of alternating field names and values in both RESP2 and RESP3 (it is not sent as a RESP3 map). The fields, in order:

Field Type Meaning
tokens_used Integer Tokens charged in the current window.
token_limit Integer Token cap (0 = none).
cost_used_usd Bulk string Dollars charged in the current window, with six decimals.
cost_limit_usd Bulk string Cost cap with six decimals (0.000000 = none).
window_seconds Integer Window length.
window_remaining Integer Seconds left in the current window (0 when the window is 0 or has run out).
requests_allowed Integer Requests charged since the budget was created or reset.
requests_rejected Integer Requests rejected since the budget was created or reset.
unpriced_requests Integer Allowed requests whose MODEL had no price.

tokens_used and cost_used_usd go back to zero when a new window starts; the request counts do not.

Errors:

  • ERR wrong number of arguments for 'llmbudget.status' command if the argument count is wrong.
  • NOLICENSE llm-budget requires a HotKV license. Contact sales@hotkv.com if your license does not include the llm-budget feature.
127.0.0.1:6379> LLMBUDGET.STATUS tenant_acme
1) "tokens_used"
2) (integer) 102000
3) "token_limit"
4) (integer) 0
5) "cost_used_usd"
6) "0.220000"
7) "cost_limit_usd"
8) "5.000000"
9) "window_seconds"
10) (integer) 3600
11) "window_remaining"
12) (integer) 3412
13) "requests_allowed"
14) (integer) 1
15) "requests_rejected"
16) (integer) 1
17) "unpriced_requests"
18) (integer) 0

HotKV-only command. Redis and Valkey have no equivalent.

LLMBUDGET.SET, LLMBUDGET.CONSUME, LLMBUDGET.RESET, LLMBUDGET.DROP, LLMBUDGET.LIST, AI features guide