The Image function of the Together Python Library allows you to easily integrate the Together API's image generation functionality into your applications, allowing you to generate images with a single line of code.

See all commands with:

together image --help

To generate images, simply run:

together image "Space robots"

By default, complete will query runwayml/stable-diffusion-v1-5. You can pick a different model with --model or -m followed by the model string.

When using the CLI, the images are saved with the pattern image-X.png; the prefix can be changes with --output-prefix or -o followed by a string.

For example, to query stabilityai/stable-diffusion-2-1, generate 4 images, and save them to spacerobots-X.png, run:

$ together image --model stabilityai/stable-diffusion-2-1 "Space robots" -r 4 -o spacerobots
Image saved to spacerobots-0.png
Image saved to spacerobots-1.png
Image saved to spacerobots-2.png
Image saved to spacerobots-3.png

together image

  • PROMPT (string, required) -- A string providing context for the model to complete
  • --model,-m (string, optional) -- Model string to query. Default: runwayml/stable-diffusion-v1-5
  • --steps (integer, optional) -- Sampling steps is the number of iterations that the model runs to go from random noise to a recognizable image based on the text. Default: 20
  • --seed (integer, optional) -- Random seed used for generation. Default: 42
  • --results,-r (integer, optional) -- Number of result images to generate. Default: 1
  • --height (integer, optional) -- Height of the image to generate in number of pixels. Default: 256
  • --width (integer, optional) -- Width of the image to generate in number of pixels. Default: 256
  • --output-prefix,-o (string, optional) -- Prefix for the file names the output images will be saved to. An image number will be appended to this name. Default: image
  • --raw (bool, optional) -- Indicates whether to output raw image to CLI. Enabling this option does not save the image to disk. Default: False