Skip to content

Commit fac03f2

Browse files
committed
Update headers spec
1 parent 732cede commit fac03f2

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

docs/hub/rate-limits.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ We define different rate limits for distinct classes of requests. We distinguish
1111
- Specifically, this is the ["Resolve a file" endpoint](https://huggingface.co/spaces/huggingface/openapi#tag/models/get/{namespace}/{repo}/resolve/{rev}/{path}) documented in our OpenAPI spec.
1212
- Resolve requests are heavily used by the community, and since we optimize our infrastructure to serve them with maximum efficiency, the rate limits for Resolvers are the highest.
1313
- **Pages**
14-
- All the Web pages we host on huggingface.co.
14+
- All the Web pages we host on huggingface.co.
1515
- Usually Web browsing requests are made by humans, hence rate limits don't need to be as high as the above mentioned programmatic endpoints.
1616

1717
> [!TIP]
@@ -37,18 +37,23 @@ Note: You can use the context switcher to easily switch between your user accoun
3737

3838
Whenever you or your organization hits a rate limit, you will receive a **429** `Too Many Requests` HTTP error.
3939

40-
We implement the mechanism described in the [IETF draft](https://datatracker.ietf.org/doc/draft-ietf-httpapi-ratelimit-headers/) titled “RateLimit HTTP header fields for HTTP” (also known as `draft-ietf-httpapi-ratelimit-headers`).
40+
We implement the mechanism described in the [IETF draft (Version 9)](https://datatracker.ietf.org/doc/draft-ietf-httpapi-ratelimit-headers/) titled “RateLimit HTTP header fields for HTTP” (also known as `draft-ietf-httpapi-ratelimit-headers`).
4141

4242
The goal is to define standardized HTTP headers that servers can use to advertise quota / rate-limit policies and communicate current usage / limits to clients so that they can avoid being throttled.
4343

4444
Precisely, we implement the following headers:
4545

46-
| Header | Purpose / Meaning |
47-
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
48-
| **`RateLimit‑Policy`** | Carries the rate limit policy itself (e.g. “100 requests per 5 minutes”). It’s informative; shows what policy the client is subject to. |
49-
| **`RateLimit‑Limit`** | The total allowed rate limit for the current window. “How many requests (of this type) you’re allowed to perform.” |
50-
| **`RateLimit‑Remaining`** | How many requests of this type you have left in the current window. |
51-
| **`RateLimit‑Reset`** | Number of seconds until the rate limit window resets (or until quota is refreshed). Uses a “delta-seconds” format to reduce clock sync issues. |
46+
| Header | Purpose / Meaning |
47+
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
48+
| **`RateLimit`** | The total allowed rate limit for the current window. “How many requests (of this type) you’re allowed to perform.” |
49+
| **`RateLimit-Policy`** | Carries the rate limit policy itself (e.g. “100 requests per 5 minutes”). It’s informative; shows what policy the client is subject to. |
50+
51+
A set of examples is as follows:
52+
53+
| Header | Example |
54+
| ---------------------- | ----------------------------------------------------------------------------------------------------- |
55+
| **`RateLimit`** | `"api\|pages\|resolvers";r=[remaining];t=[seconds remaining until reset]` |
56+
| **`RateLimit-Policy`** | `"fixed window";"api\|\pages\|resolvers";q=[total allowed for window];w=[window duration in seconds]` |
5257

5358
## Rate limit Tiers
5459

0 commit comments

Comments
 (0)