OpenAI 修改项目速率限制
2026-11-17 18:24 更新
修改项目速率限制
post /organization/projects/{project_id}/rate_limits/{rate_limit_id}
更新项目的速率限制。
路径参数
project_id: string
项目 ID。
rate_limit_id: string
速率限制 ID。
请求体参数
内容类型:application/json
batch_1_day_max_input_tokens: optional integer
每天的批处理输入词元数量上限。仅适用于某些模型。
max_audio_megabytes_per_1_minute: optional integer
每分钟的音频兆字节数上限。仅适用于某些模型。
max_images_per_1_minute: optional integer
每分钟的图像数量上限。仅适用于某些模型。
max_requests_per_1_day: optional integer
每天的请求数量上限。仅适用于某些模型。
max_requests_per_1_minute: optional integer
每分钟的请求数量上限。
max_tokens_per_1_minute: optional integer
每分钟的词元数量上限。
返回值
ProjectRateLimit object { id, max_requests_per_1_minute, max_tokens_per_1_minute, 6 more }
表示项目的速率限制配置。
id: string
标识符,可在 API 端点中引用。
max_requests_per_1_minute: integer
每分钟的请求数量上限。
max_tokens_per_1_minute: integer
每分钟的词元数量上限。
model: string
此速率限制适用的模型。
object: "project.rate_limit"
对象类型,固定为 project.rate_limit。
"project.rate_limit"
batch_1_day_max_input_tokens: optional integer
每天的批处理输入词元数量上限。仅对相关模型返回。
max_audio_megabytes_per_1_minute: optional integer
每分钟的音频兆字节数上限。仅对相关模型返回。
max_images_per_1_minute: optional integer
每分钟的图像数量上限。仅对相关模型返回。
max_requests_per_1_day: optional integer
每天的请求数量上限。仅对相关模型返回。
示例
## 从环境变量读取管理员密钥;先把项目、资源 ID 和请求参数替换为实际值
curl "https://api.openai.com/v1/organization/projects/$PROJECT_ID/rate_limits/$RATE_LIMIT_ID" \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{}'
200 示例 1
{
"id": "id",
"max_requests_per_1_minute": 0,
"max_tokens_per_1_minute": 0,
"model": "model",
"object": "project.rate_limit",
"batch_1_day_max_input_tokens": 0,
"max_audio_megabytes_per_1_minute": 0,
"max_images_per_1_minute": 0,
"max_requests_per_1_day": 0
}
404 — 默认响应
以下错误消息仅为中文化示例;实际 API 返回的消息文字可能为英文,错误代码和类型按原文保留。
{
"error": {
"code": "project_not_found",
"message": "找不到项目 proj_abc",
"type": "invalid_request_error",
"param": null
}
}
示例
## 从环境变量读取管理员密钥;先把项目、资源 ID 和请求参数替换为实际值
curl -X POST "https://api.openai.com/v1/organization/projects/proj_abc/rate_limits/rl_xxx" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"max_requests_per_1_minute": 500
}'
响应示例
译注:官方具体请求将每分钟请求上限设为500,但响应示例为600,且资源 ID 不一致。此处保留原例的字段和值,不把它解释为同一次调用的结果。
{
"object": "project.rate_limit",
"id": "rl-ada",
"model": "ada",
"max_requests_per_1_minute": 600,
"max_tokens_per_1_minute": 150000,
"max_images_per_1_minute": 10
}以上内容是否对您有帮助:

TRAE-AI编程


更多建议: