| openai | R Documentation |
Provides methods to interact with OpenAI API including fetching model details, generating completions, managing files, and more. Always ensure that the API key is kept private.
modelsclass
filesclass
fine_tuningclass
chatclass
audioclass
embeddingsclass
imagesclass
moderationsclass
assistantsclass
threadsclass
messagesclass
runsclass
new()Initialize the OpenAI API interface with the provided API key.
openai$new(api_key)
api_keyThe OpenAI API key.
set_proxy()Configure the proxy settings.
openai$set_proxy(proxy_ip, proxy_port)
proxy_ipcharacter Required. The IP address of the proxy.
proxy_portcharacter Required. The port number of the proxy.
clone()The objects of this class are cloneable with this method.
openai$clone(deep = FALSE)
deepWhether to make a deep clone.
Sys.setenv(OPENAI_KEY="you openai key")
aaa <- openai$new(Sys.getenv("OPENAI_KEY"))
#if need proxy
#aaa$set_proxy("127.0.0.1", 10890)
# List model
aaa$models$list()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.