Learn R Programming

openaiRtools (version 0.2.2)

retrieve_model: Retrieve a Model (Convenience Function)

Description

Shortcut that creates an OpenAI client from the OPENAI_API_KEY environment variable and retrieves details for a specific model.

Usage

retrieve_model(model)

Value

A named list with model metadata: $id, $object, $created (Unix timestamp), $owned_by.

Arguments

model

Character. Required. The model ID to look up. Examples: "gpt-4o", "gpt-3.5-turbo", "whisper-1", "text-embedding-3-small", "dall-e-3".

Examples

Run this code
if (FALSE) {
Sys.setenv(OPENAI_API_KEY = "sk-xxxxxx")

info <- retrieve_model("gpt-4o")
cat("ID:", info$id, "\n")
cat("Owner:", info$owned_by, "\n")
}

Run the code above in your browser using DataLab