Skip to content

Commit e0cb2d7

Browse files
Merge pull request #368 from openai/dev/karenwong/rate-limit-api-docs
[Rate Limits API] API Documentation
2 parents acff98c + dc7b380 commit e0cb2d7

File tree

1 file changed

+318
-5
lines changed

1 file changed

+318
-5
lines changed

openapi.yaml

+318-5
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ paths:
965965
Your input file must be formatted as a [JSONL
966966
file](/docs/api-reference/batch/request-input), and must be
967967
uploaded with the purpose `batch`. The file can contain up
968-
to 50,000 requests, and can be up to 100 MB in size.
968+
to 50,000 requests, and can be up to 200 MB in size.
969969
endpoint:
970970
type: string
971971
enum:
@@ -2375,7 +2375,7 @@ paths:
23752375
[completions](/docs/api-reference/fine-tuning/completions-input) models.
23762376

23772377

2378-
The Batch API only supports `.jsonl` files up to 100 MB in size. The
2378+
The Batch API only supports `.jsonl` files up to 200 MB in size. The
23792379
input also has a specific required
23802380
[format](/docs/api-reference/batch/request-input).
23812381

@@ -4664,6 +4664,161 @@ paths:
46644664
"archived_at": 1711471533,
46654665
"status": "archived"
46664666
}
4667+
/organization/projects/{project_id}/rate_limits:
4668+
get:
4669+
summary: Returns the rate limits per model for a project.
4670+
operationId: list-project-rate-limits
4671+
tags:
4672+
- Projects
4673+
parameters:
4674+
- name: project_id
4675+
in: path
4676+
description: The ID of the project.
4677+
required: true
4678+
schema:
4679+
type: string
4680+
- name: limit
4681+
in: query
4682+
description: |
4683+
A limit on the number of objects to be returned. The default is 100.
4684+
required: false
4685+
schema:
4686+
type: integer
4687+
default: 100
4688+
- name: after
4689+
in: query
4690+
description: >
4691+
A cursor for use in pagination. `after` is an object ID that defines
4692+
your place in the list. For instance, if you make a list request and
4693+
receive 100 objects, ending with obj_foo, your subsequent call can
4694+
include after=obj_foo in order to fetch the next page of the list.
4695+
required: false
4696+
schema:
4697+
type: string
4698+
- name: before
4699+
in: query
4700+
description: >
4701+
A cursor for use in pagination. `before` is an object ID that
4702+
defines your place in the list. For instance, if you make a list
4703+
request and receive 100 objects, beginning with obj_foo, your
4704+
subsequent call can include before=obj_foo in order to fetch the
4705+
previous page of the list.
4706+
required: false
4707+
schema:
4708+
type: string
4709+
responses:
4710+
"200":
4711+
description: Project rate limits listed successfully.
4712+
content:
4713+
application/json:
4714+
schema:
4715+
$ref: "#/components/schemas/ProjectRateLimitListResponse"
4716+
x-oaiMeta:
4717+
name: List project rate limits
4718+
group: administration
4719+
returns: A list of
4720+
[ProjectRateLimit](/docs/api-reference/project-rate-limits/object)
4721+
objects.
4722+
examples:
4723+
request:
4724+
curl: >
4725+
curl
4726+
https://api.openai.com/v1/organization/projects/proj_abc/rate_limits?after=rl_xxx&limit=20
4727+
\
4728+
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
4729+
-H "Content-Type: application/json"
4730+
response: |
4731+
{
4732+
"object": "list",
4733+
"data": [
4734+
{
4735+
"object": "project.rate_limit",
4736+
"id": "rl-ada",
4737+
"model": "ada",
4738+
"max_requests_per_1_minute": 600,
4739+
"max_tokens_per_1_minute": 150000,
4740+
"max_images_per_1_minute": 10
4741+
}
4742+
],
4743+
"first_id": "rl-ada",
4744+
"last_id": "rl-ada",
4745+
"has_more": false
4746+
}
4747+
error_response: |
4748+
{
4749+
"code": 404,
4750+
"message": "The project {project_id} was not found"
4751+
}
4752+
/organization/projects/{project_id}/rate_limits/{rate_limit_id}:
4753+
post:
4754+
summary: Updates a project rate limit.
4755+
operationId: update-project-rate-limits
4756+
tags:
4757+
- Projects
4758+
parameters:
4759+
- name: project_id
4760+
in: path
4761+
description: The ID of the project.
4762+
required: true
4763+
schema:
4764+
type: string
4765+
- name: rate_limit_id
4766+
in: path
4767+
description: The ID of the rate limit.
4768+
required: true
4769+
schema:
4770+
type: string
4771+
requestBody:
4772+
description: The project rate limit update request payload.
4773+
required: true
4774+
content:
4775+
application/json:
4776+
schema:
4777+
$ref: "#/components/schemas/ProjectRateLimitUpdateRequest"
4778+
responses:
4779+
"200":
4780+
description: Project rate limit updated successfully.
4781+
content:
4782+
application/json:
4783+
schema:
4784+
$ref: "#/components/schemas/ProjectRateLimit"
4785+
"400":
4786+
description: Error response for various conditions.
4787+
content:
4788+
application/json:
4789+
schema:
4790+
$ref: "#/components/schemas/ErrorResponse"
4791+
x-oaiMeta:
4792+
name: Modify project rate limit
4793+
group: administration
4794+
returns: The updated
4795+
[ProjectRateLimit](/docs/api-reference/project-rate-limits/object)
4796+
object.
4797+
examples:
4798+
request:
4799+
curl: >
4800+
curl -X POST
4801+
https://api.openai.com/v1/organization/projects/proj_abc/rate_limits/rl_xxx
4802+
\
4803+
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
4804+
-H "Content-Type: application/json" \
4805+
-d '{
4806+
"max_requests_per_1_minute": 500
4807+
}'
4808+
response: |
4809+
{
4810+
"object": "project.rate_limit",
4811+
"id": "rl-ada",
4812+
"model": "ada",
4813+
"max_requests_per_1_minute": 600,
4814+
"max_tokens_per_1_minute": 150000,
4815+
"max_images_per_1_minute": 10
4816+
}
4817+
error_response: |
4818+
{
4819+
"code": 404,
4820+
"message": "The project {project_id} was not found"
4821+
}
46674822
/organization/projects/{project_id}/service_accounts:
46684823
get:
46694824
summary: Returns a list of service accounts in the project.
@@ -10288,6 +10443,44 @@ components:
1028810443
id:
1028910444
type: string
1029010445
description: The project ID.
10446+
rate_limit.updated:
10447+
type: object
10448+
description: The details for events with this `type`.
10449+
properties:
10450+
id:
10451+
type: string
10452+
description: The rate limit ID
10453+
changes_requested:
10454+
type: object
10455+
description: The payload used to update the rate limits.
10456+
properties:
10457+
max_requests_per_1_minute:
10458+
type: integer
10459+
description: The maximum requests per minute.
10460+
max_tokens_per_1_minute:
10461+
type: integer
10462+
description: The maximum tokens per minute.
10463+
max_images_per_1_minute:
10464+
type: integer
10465+
description: The maximum images per minute. Only relevant for certain models.
10466+
max_audio_megabytes_per_1_minute:
10467+
type: integer
10468+
description: The maximum audio megabytes per minute. Only relevant for certain
10469+
models.
10470+
max_requests_per_1_day:
10471+
type: integer
10472+
description: The maximum requests per day. Only relevant for certain models.
10473+
batch_1_day_max_input_tokens:
10474+
type: integer
10475+
description: The maximum batch input tokens per day. Only relevant for certain
10476+
models.
10477+
rate_limit.deleted:
10478+
type: object
10479+
description: The details for events with this `type`.
10480+
properties:
10481+
id:
10482+
type: string
10483+
description: The rate limit ID
1029110484
service_account.created:
1029210485
type: object
1029310486
description: The details for events with this `type`.
@@ -10469,6 +10662,8 @@ components:
1046910662
- service_account.created
1047010663
- service_account.updated
1047110664
- service_account.deleted
10665+
- rate_limit.updated
10666+
- rate_limit.deleted
1047210667
- user.added
1047310668
- user.updated
1047410669
- user.deleted
@@ -12021,7 +12216,7 @@ components:
1202112216
x-oaiExpandable: true
1202212217
description: >
1202312218
Configuration for a [Predicted
12024-
Output](/docs/guides/latency-optimization#use-predicted-outputs),
12219+
Output](/docs/guides/predicted-outputs),
1202512220

1202612221
which can greatly improve response times when large parts of the
1202712222
model
@@ -17322,6 +17517,104 @@ components:
1732217517
- first_id
1732317518
- last_id
1732417519
- has_more
17520+
ProjectRateLimit:
17521+
type: object
17522+
description: Represents a project rate limit config.
17523+
properties:
17524+
object:
17525+
type: string
17526+
enum:
17527+
- project.rate_limit
17528+
description: The object type, which is always `project.rate_limit`
17529+
id:
17530+
type: string
17531+
description: The identifier, which can be referenced in API endpoints.
17532+
model:
17533+
type: string
17534+
description: The model this rate limit applies to.
17535+
max_requests_per_1_minute:
17536+
type: integer
17537+
description: The maximum requests per minute.
17538+
max_tokens_per_1_minute:
17539+
type: integer
17540+
description: The maximum tokens per minute.
17541+
max_images_per_1_minute:
17542+
type: integer
17543+
description: The maximum images per minute. Only present for relevant models.
17544+
max_audio_megabytes_per_1_minute:
17545+
type: integer
17546+
description: The maximum audio megabytes per minute. Only present for relevant
17547+
models.
17548+
max_requests_per_1_day:
17549+
type: integer
17550+
description: The maximum requests per day. Only present for relevant models.
17551+
batch_1_day_max_input_tokens:
17552+
type: integer
17553+
description: The maximum batch input tokens per day. Only present for relevant
17554+
models.
17555+
required:
17556+
- object
17557+
- id
17558+
- model
17559+
- max_requests_per_1_minute
17560+
- max_tokens_per_1_minute
17561+
x-oaiMeta:
17562+
name: The project rate limit object
17563+
example: |
17564+
{
17565+
"object": "project.rate_limit",
17566+
"id": "rl_ada",
17567+
"model": "ada",
17568+
"max_requests_per_1_minute": 600,
17569+
"max_tokens_per_1_minute": 150000,
17570+
"max_images_per_1_minute": 10
17571+
}
17572+
ProjectRateLimitListResponse:
17573+
type: object
17574+
properties:
17575+
object:
17576+
type: string
17577+
enum:
17578+
- list
17579+
data:
17580+
type: array
17581+
items:
17582+
$ref: "#/components/schemas/ProjectRateLimit"
17583+
first_id:
17584+
type: string
17585+
last_id:
17586+
type: string
17587+
has_more:
17588+
type: boolean
17589+
required:
17590+
- object
17591+
- data
17592+
- first_id
17593+
- last_id
17594+
- has_more
17595+
ProjectRateLimitUpdateRequest:
17596+
type: object
17597+
properties:
17598+
max_requests_per_1_minute:
17599+
type: integer
17600+
description: The maximum requests per minute.
17601+
max_tokens_per_1_minute:
17602+
type: integer
17603+
description: The maximum tokens per minute.
17604+
max_images_per_1_minute:
17605+
type: integer
17606+
description: The maximum images per minute. Only relevant for certain models.
17607+
max_audio_megabytes_per_1_minute:
17608+
type: integer
17609+
description: The maximum audio megabytes per minute. Only relevant for certain
17610+
models.
17611+
max_requests_per_1_day:
17612+
type: integer
17613+
description: The maximum requests per day. Only relevant for certain models.
17614+
batch_1_day_max_input_tokens:
17615+
type: integer
17616+
description: The maximum batch input tokens per day. Only relevant for certain
17617+
models.
1732517618
ProjectServiceAccount:
1732617619
type: object
1732717620
description: Represents an individual service account in a project.
@@ -18991,9 +19284,13 @@ components:
1899119284
"input_tokens":127,
1899219285
"output_tokens":148,
1899319286
"input_token_details": {
18994-
"cached_tokens":0,
19287+
"cached_tokens":384,
1899519288
"text_tokens":119,
18996-
"audio_tokens":8
19289+
"audio_tokens":8,
19290+
"cached_tokens_details": {
19291+
"text_tokens": 128,
19292+
"audio_tokens": 256
19293+
}
1899719294
},
1899819295
"output_token_details": {
1899919296
"text_tokens":36,
@@ -22265,6 +22562,22 @@ x-oaiMeta:
2226522562
- type: object
2226622563
key: ProjectApiKey
2226722564
path: object
22565+
- id: project-rate-limits
22566+
title: Project rate limits
22567+
description: >
22568+
Manage rate limits per model for projects. Rate limits may be configured
22569+
to be equal to or lower than the organization's rate limits.
22570+
navigationGroup: administration
22571+
sections:
22572+
- type: endpoint
22573+
key: list-project-rate-limits
22574+
path: list
22575+
- type: endpoint
22576+
key: update-project-rate-limits
22577+
path: update
22578+
- type: object
22579+
key: ProjectRateLimit
22580+
path: object
2226822581
- id: audit-logs
2226922582
title: Audit logs
2227022583
description: >

0 commit comments

Comments
 (0)