GPTIMAGE

Returns an image URL generated from the given description.

Note: Due to the high token usage of generating images, GPTIMAGE is only available to Individual plans and above.

Syntax

=GPTIMAGE(description, size, cache)

With the following function parameters:

  • description: String (or cell reference) representing a description of an image.
  • size: [optional] Size of the image to generate. Can be one of "256x256", "512x512", or "1028x1028"
  • cache: [optional] Whether or not to cache the response. Setting to false will incur a re-execution on every cell refresh. Default is true.

Description

GPTIMAGE is a simple way to generate an image from OpenAI's DALL-E image generation model. Be as descriptive as possible to guide the output, e.g.,:

=GPTIMAGE("A Norman Rockwell painting of a boy in elementary school staring out the window in boredom")

Optional arguments

The GPT function accepts an optional size argument which affects the size of the generated image. The only options are square images with the following dimensions: "256x256", "512x512", or "1028x1028"

=GPTIMAGE("A picture of a happy labradoodle dog looking into the camera", "512x512")

Embedding images

GPTIMAGE returns an image URL which does not automatically display the image in the Sheet. To get the image to display in a call you need to use the built-in IMAGE function, which takes a URL and renders it in the cell. For example:

=IMAGE(GPTIMAGE("A picture of a happy labradoodle dog looking into the camera"))

Performance & caching

The completion that is returned is cached by SheetGPT to ensure that cell refreshes and other Sheet actions do not cause an unnecessary burn on your tokens. Any GPT request with the same arguments in a Sheet will return the cached value, indefinitely. This is well beyond the typical 6-hour cache limit of most Sheet plugins and is our attempt to make SheetGPT the most cost-effective way to utilize to various GPT functionality.

If you ever need to avoid hitting the cache and force the generation of a new response, you can set the cache argument to false to force re-generation:

=GPTIMAGE("Sunset over London in the style of Monet's The Starry Night",,false)

See Also

You may also find the following resources useful: