Creates an image given a prompt. See this page for details.
create_image(
prompt,
n = 1,
size = c("1024x1024", "256x256", "512x512"),
response_format = c("url", "b64_json"),
user = NULL,
openai_api_key = Sys.getenv("OPENAI_API_KEY"),
openai_organization = NULL
)required; a length one character vector.
required; defaults to 1; a length one numeric vector with the
integer value greater than 0.
required; defaults to "1024x1024"; a length one character
vector, one among "256x256", "512x512", and "1024x1024".
required; defaults to "url"; a length one character
vector, one among "url" and "b64_json".
optional; defaults to NULL; a length one character vector.
required; defaults to Sys.getenv("OPENAI_API_KEY")
(i.e., the value is retrieved from the .Renviron file); a length one
character vector. Specifies OpenAI API key.
optional; defaults to NULL; a length one
character vector. Specifies OpenAI organization.
Returns a list, an element of which contain either a link to the generated image or the generated image decoded in Base64.
For arguments description please refer to the official documentation.
Other image functions:
create_image_edit(),
create_image_variation()
if (FALSE) { # \dontrun{
create_image("An astronaut riding a horse in a photorealistic style")
} # }