rate_limits_per_minute
reports the rate limits for a given API model.
The function returns the available requests per minute (RPM) as well as tokens per minute (TPM).
Find general information at
https://platform.openai.com/docs/guides/rate-limits/overview.
Usage
rate_limits_per_minute(
model = "gpt-4o-mini",
AI_tool = "gpt",
api_key = get_api_key()
)
Arguments
- model
Character string with the name of the completion model. Default is
"gpt-4o-mini"
. Can take multiple values. Find available model at https://platform.openai.com/docs/models/model-endpoint-compatibility.- AI_tool
Character string specifying the AI tool from which the API is issued. Default is
"gpt"
.- api_key
Numerical value with your personal API key. Default setting draws on the
get_api_key()
to retrieve the API key from the R environment, so that the key is not compromised. The API key can be added to the R environment viaset_api_key()
or by usingusethis::edit_r_environ()
. In the.Renviron
file, writeCHATGPT_KEY=INSERT_YOUR_KEY_HERE
. After entering the API key, close and save the.Renviron
file and restartRStudio
(ctrl + shift + F10). Alternatively, one can usehttr2::secret_make_key()
,httr2::secret_encrypt()
, andhttr2::secret_decrypt()
to scramble and decrypt the API key.
Value
A tibble
including variables with information about the model used,
the number of requests and tokens per minute.
Examples
if (FALSE) { # \dontrun{
set_api_key()
rate_limits_per_minute()
} # }