tests/manual/test-create_image.R

create_image(
    prompt = "An astronaut riding a horse in a photorealistic style",
    n = 1,
    size = "256x256",
    response_format = "url"
)

# test `response_format = "b64_json"`

# response <- create_image(
#     prompt = "An astronaut riding a horse in a photorealistic style",
#     size = "256x256",
#     response_format = "b64_json"
# )
#
# image <- jsonlite::base64_dec(response$data$b64_json) %>%
#     png::readPNG()
#
# grid::grid.raster(image)

Try the openai package in your browser

Any scripts or data that you put into this service are public.

openai documentation built on March 31, 2023, 11:56 p.m.