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="space robots", model="black-forest-labs/FLUX.1-schnell", steps=4
)

print(response.data[0].url)
import { OpenAI } from "openai";

const client = new OpenAI({
  apiKey: process.env.TOGETHER_API_KEY,
  baseURL: "https://api.together.xyz/v1",
});

async function generateImage() {
  const response = await client.images.generate({
    prompt: "a flying cow",
    model: "black-forest-labs/FLUX.1.1-pro",
    n: 1,
  });
}

generateImage();

Supported image models

See our models page for supported image models.