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.
models
class
files
class
fine_tuning
class
chat
class
audio
class
embeddings
class
images
class
moderations
class
assistants
class
threads
class
messages
class
runs
class
new()
Initialize the OpenAI API interface with the provided API key.
openai$new(api_key)
api_key
The OpenAI API key.
set_proxy()
Configure the proxy settings.
openai$set_proxy(proxy_ip, proxy_port)
proxy_ip
character Required. The IP address of the proxy.
proxy_port
character Required. The port number of the proxy.
clone()
The objects of this class are cloneable with this method.
openai$clone(deep = FALSE)
deep
Whether 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.