chatgpt-api/docs/publishing/config/rate-limits.mdx

84 wiersze
2.2 KiB
Plaintext

2025-06-27 16:10:25 +00:00
---
2025-06-27 16:56:39 +00:00
title: Rate Limits
2025-06-27 19:00:41 +00:00
description: Configure rate-limits for your project.
2025-06-27 16:10:25 +00:00
---
Agentic's durable rate-limiting is built on top of Cloudflare's global infrastructure. Customize the default rate-limits, change them based on a customer's pricing plan, or create custom tool-specific overrides.
2025-06-27 16:32:56 +00:00
## Rate Limit
2025-06-27 16:10:25 +00:00
<ResponseField name='enabled' type='boolean' required>
2025-06-27 16:32:56 +00:00
Whether or not this rate limit is enabled.
2025-06-27 16:10:25 +00:00
</ResponseField>
<ResponseField name="interval" type="string" required>
The interval at which the rate limit is applied.
2025-06-27 16:32:56 +00:00
Either a positive integer expressed in seconds or a valid positive [ms](https://github.com/vercel/ms) string (eg, `10s`, `1m`, `8h`, `2d`, `1w`, `1y`, etc).
2025-06-27 16:10:25 +00:00
</ResponseField>
<ResponseField name='limit' type='number' required>
The maximum number of API requests per interval (unitless).
</ResponseField>
<ResponseField name="mode" type="string" default="approximate">
2025-06-27 16:32:56 +00:00
How to enforce the rate limit: `strict` (more precise but slower) or `approximate` (the default; faster and asynchronous but less precise).
2025-06-27 16:10:25 +00:00
The default rate-limiting mode is `approximate`, which means that requests
are allowed to proceed immediately, with the limit being enforced
2025-06-27 16:32:56 +00:00
asynchronously in the background. This is faster than `strict` mode, but it is less consistent if precise adherence to rate-limits is required.
2025-06-27 16:10:25 +00:00
2025-06-27 16:32:56 +00:00
With `strict` mode, customer requests are blocked until the current limit has
2025-06-27 16:10:25 +00:00
been confirmed. The downside with this approach is that it introduces
more latency to every request by default. The advantage is that it is
more precise and consistent.
</ResponseField>
## Example Rate Limits
<Tabs>
<Tab title="Default">
The default platform rate limit for `requests` is a limit of 1000 requests per minute per customer.
```ts
{
enabled: true,
interval: '1m',
2025-06-27 19:00:41 +00:00
limit: 1000
2025-06-27 16:10:25 +00:00
}
```
</Tab>
<Tab title="Strict daily">
This example rate limit restricts customers to 100 requests per day. It uses `strict` mode which adds a little extra latency but guarantees that customers will never exceed the limit.
```ts
{
enabled: true,
interval: '1d',
limit: 100,
mode: 'strict'
}
```
</Tab>
<Tab title="Disabled">
This is an example of a disabled rate limit.
```ts
{
enabled: false
}
```
</Tab>
</Tabs>