Images

Generate images with a text prompt.

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)
import Together from "together-ai";

const together = new Together();

async function main() {
  const response = await together.images.create({
    prompt: "a flying cat",
    model: "black-forest-labs/FLUX.1-schnell",
    steps: 4,
  });
  // @ts-ignore
  console.log(response.data[0].url);
}

main();

Supported image models

See our models page for supported image models.

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.

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)
import Together from 'together-ai';

const together = new Together();

async function main() {
  const response = await together.images.create({
    prompt: 'a flying cat',
    model: 'black-forest-labs/FLUX.1-schnell',
    steps: 4,
    // @ts-ignore
    disable_safety_checker: true,
  });
  console.log(response.data[0].url);
}

main();