Generate an image
To generate an image, setinput to a text description of the image and
set generation parameters in provider_options.image.
The following example generates an image from a text prompt and saves it as
output-text-to-image.png.
- Python
- curl
Send a prompt, decode the returned image data, and save the image:
generate-image.py

Transform an image
To transform an image, setinput to a user message containing:
- An
input_imageblock with an image URL or base64-encoded data URI. - An
input_textblock describing the transformation.
input.png, encodes it as a
data URI, and saves the transformed image.
- Python
- curl
Encode the input image, send it with a prompt, and save the transformed image:
transform-image.py
