Generating an image

To query an image model, use the .images method and specify the image model you want to use.
from together import Together

client = Together()

response = client.images.generate(
    prompt="a flying cat", model="black-forest-labs/FLUX.1-schnell", steps=4
)

print(response.data[0].url)

Supported image models

See our models page for supported image models.

Model Specific Parameters

Flux Schnell and Kontext [Pro/Max/Dev] models use the aspect_ratio parameter to set the output image size. Flux.1 Pro, Flux 1.1 Pro, and Flux.1 Dev use width and height parameters.

Safety Checker

We have a built in safety checker that detects NSFW words but you can disable it by passing in "disable_safety_checker": "true". This works for every model except Flux Schnell Free and Flux Pro. If the safety checker is triggered and not disabled, it will return a 422 Unprocessable Entity.
from together import Together

client = Together()

response = client.images.generate(
    prompt="a flying cat",
    model="black-forest-labs/FLUX.1-schnell",
    steps=4,
    disable_safety_checker=True,
)

print(response.data[0].url)