限制维度
限制由 API Key 策略与平台风控共同决定。不同 Key 可以有不同 RPM、并发和月消费限额,因此不要在客户端写死平台级数字。
- Requests per minute (RPM)
- 同时进行的请求数
- 每月 API Key 消费上限
- 风险控制的临时限流
429 处理
收到 429 时先读取 Retry-After。若该 header 不存在,从较短延迟开始指数退避并加入随机抖动。
退避建议text
delay = min(cap, base * 2^attempt) + random_jitter
max_attempts = a small bounded number