Skip to content

feat(limits): count rate limits per team and model, with a key's own beneath - #27

Draft
phot0n wants to merge 1 commit into
mainfrom
model-rate-limits
Draft

phot0n wants to merge 1 commit into
mainfrom
model-rate-limits

Conversation

@phot0n

@phot0n phot0n commented Nov 6, 2026

Copy link
Copy Markdown
Member

Rate limits counted per key, so a team's throughput scaled with how many keys it minted and the control plane capped key counts to bound it. Now the rows pushed on a key are its team's, counted on lim:team:::..., and the key's own rows ride beside them as key_limits, counted on lim:key:::...; both gates run in the one admit script and the lower one refuses first. An entry may name a model last (metric:window:value[:model]); a row naming the model stands in for the blank row on its metric and window, and a model no row reaches is uncapped on that list.

The model is not known before the body, so Admit leaves quota for modelaccess, after the grant check; a fallback is not admitted again. The 429 names the model and whose limit it was.

…beneath

Rate limits counted per key, so a team's throughput scaled with how many
keys it minted and the control plane capped key counts to bound it. Now
the rows pushed on a key are its team's, counted on
lim:team:<team>:<model>:..., and the key's own rows ride beside them as
key_limits, counted on lim:key:<prefix>:<model>:...; both gates run in
the one admit script and the lower one refuses first. An entry may name
a model last (metric:window:value[:model]); a row naming the model
stands in for the blank row on its metric and window, and a model no row
reaches is uncapped on that list.

The model is not known before the body, so Admit leaves quota for
modelaccess, after the grant check; a fallback is not admitted again.
The 429 names the model and whose limit it was.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant