request {oaii} | R Documentation |
API request
Description
To get more details, visit https://platform.openai.com/docs/api-reference/making-requests
Usage
request(
endpoint,
api_key = api_get_key(),
body = NULL,
query = NULL,
encode = "json",
method = "POST",
content_class = NULL
)
Arguments
endpoint |
string, API endpoint url |
api_key |
string, OpenAI API key (see https://platform.openai.com/account/api-keys) |
body |
One of the following:
|
query |
NULL/list, query string elements as list(name1 = value1, name2 = value2) |
encode |
If the body is a named list, how should it be encoded? Can be one of form (application/x-www-form-urlencoded), multipart, (multipart/form-data), or json (application/json). For "multipart", list elements can be strings or objects created by
|
method |
string, request method |
content_class |
NULL/character vector, NULL or additional class name(s) (S3) appended to the response content |
Value
content of the httr response object or SimpleError (conditions) enhanced with two additional fields: 'status_code' (response$status_code) and 'message_long' (built on response content)