Skip to contents

This function sends a request to a specific OpenAI API task endpoint at the base URL https://api.openai.com/v1, and authenticates with an API key using a Bearer token.

Usage

request_base(task, token = Sys.getenv("OPENAI_API_KEY"))

Arguments

task

character string specifying an OpenAI API endpoint task

token

String containing an OpenAI API key. Defaults to the OPENAI_API_KEY environmental variable if not specified.

Value

An httr2 request object