Composable usage and runtime limits for API keys.
Summary
Functions
Returns the most restrictive concurrent-request limit for an API key.
Types
@type metric() ::
:concurrent_requests
| :requests
| :cache_write_tokens
| :cache_read_tokens
| :output_tokens
| :input_tokens
| :cost_usd
@type window() :: :month | :week | :day | :four_hours | :hour | :minute
Functions
@spec cache_read_tokens(window(), non_neg_integer()) :: t()
@spec cache_write_tokens(window(), non_neg_integer()) :: t()
@spec concurrent_request_limit(map()) :: non_neg_integer() | nil
Returns the most restrictive concurrent-request limit for an API key.
Concurrent limits do not use a stored usage window. Runtime admission uses this value without a storage query.
@spec concurrent_requests(non_neg_integer()) :: t()
@spec input_tokens(window(), non_neg_integer()) :: t()
@spec output_tokens(window(), non_neg_integer()) :: t()
@spec requests(window(), non_neg_integer()) :: t()