Skip to main content
Version: 21 R3 BETA

OpenAIImagesResult

Inherits

Computed properties

PropertyTypeDescription
imagesCollection of OpenAIImageReturns a collection of OpenAIImage objects.
imageOpenAIImageReturns the first OpenAIImage from the collection.
usageObjectReturns token usage information (inherited from OpenAIResult).

usage

The usage property returns an object containing token usage information for image generation (when supported by the provider).

FieldTypeDescription
total_tokensIntegerTotal tokens used.
input_tokensIntegerNumber of tokens in the input (prompt).
output_tokensIntegerNumber of tokens for the output (image).
input_tokens_detailsObjectBreakdown of input tokens (optional).

input_tokens_details

FieldTypeDescription
text_tokensIntegerNumber of text tokens in the prompt.
image_tokensIntegerNumber of image tokens (for image editing/variations).

Example response:

{
"total_tokens": 100,
"input_tokens": 50,
"output_tokens": 50,
"input_tokens_details": {
"text_tokens": 10,
"image_tokens": 40
}
}

Note: Image generation usage may not be available from all providers. The structure may vary depending on the specific image API endpoint used.

Functions

saveImagesToDisk()

saveImagesToDisk(folder : 4D.Folder; prefix : Text) : Boolean

ParameterTypeDescription
folder4D.FolderThe folder where images will be saved.
prefixTextThe prefix for the saved image file names.
Function resultBooleanReturns True if the images are successfully saved.

Saves images to the specified disk folder.

See also