Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.together.ai/llms.txt

Use this file to discover all available pages before exploring further.

Using a coding agent? Install the together-images skill to let your agent write correct image generation code automatically. See agent skills for details.

Generate an image

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

client = Together()

# Generate an image from a text prompt
response = client.images.generate(
    prompt="A serene mountain landscape at sunset with a lake reflection",
    model="black-forest-labs/FLUX.1-schnell",
    steps=4,
)

print(f"Image URL: {response.data[0].url}")
Example response structure and output:
{
  "id": "oFuwv7Y-2kFHot-99170ebf9e84e0ce-SJC",
  "model": "black-forest-labs/FLUX.1-schnell",
  "data": [
    {
      "index": 0,
      "url": "https://api.together.ai/v1/images/..."
    }
  ]
}
Generated image of a serene mountain landscape at sunset with a lake reflection.

Supported models

For the current list of image-generation models, see the serverless catalog or the dedicated endpoint model catalog.

Parameters

The image generation endpoint accepts a common set of parameters across models, including prompt, model, width, height, n, steps, seed, and negative_prompt. For the full parameter reference (including image_url, reference_images, frame_images, and model-specific notes), see Image generation parameters. A few quick notes:
  • prompt is required for all models except Kling.
  • width and height rely on defaults unless otherwise specified. Available dimensions differ by model.
  • FLUX Schnell and Kontext (Pro/Max/Dev) models use the aspect_ratio parameter to set the output image size, whereas FLUX.1 Pro, FLUX 1.1 Pro, and FLUX.1 Dev use width and height.

Generate multiple variations

Generate multiple variations of the same prompt and choose between them:
response = client.images.generate(
    prompt="A cute robot assistant helping in a modern office",
    model="black-forest-labs/FLUX.1-schnell",
    n=4,
    steps=4,
)

print(f"Generated {len(response.data)} variations")
for i, image in enumerate(response.data):
    print(f"Variation {i+1}: {image.url}")
Example output: Multiple generated image variations

Next steps