together-images

📁 zainhas/togetherai-skills 📅 1 day ago
2
总安装量
1
周安装量
#65742
全站排名
安装命令
npx skills add https://github.com/zainhas/togetherai-skills --skill together-images

Agent 安装分布

amp 1
cline 1
opencode 1
cursor 1
kimi-cli 1
codex 1

Skill 文档

Together Image Generation

Overview

Generate images from text prompts and edit existing images via the Together AI API.

  • Endpoint: /v1/images/generations
  • Response: URL or base64-encoded image
  • Models: FLUX.1 family, Kontext, Seedream, Stable Diffusion, and more

Quick Start

Text-to-Image

from together import Together
client = Together()

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}")
import Together from "together-ai";
const together = new Together();

const response = await together.images.generate({
  prompt: "A serene mountain landscape at sunset with a lake reflection",
  model: "black-forest-labs/FLUX.1-schnell",
  steps: 4,
});
console.log(response.data[0].url);
curl -X POST "https://api.together.xyz/v1/images/generations" \
  -H "Authorization: Bearer $TOGETHER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"black-forest-labs/FLUX.1-schnell","prompt":"A serene mountain landscape","steps":4}'

Image Editing (Kontext)

Transform existing images using a reference:

response = client.images.generate(
    model="black-forest-labs/FLUX.1-kontext-pro",
    prompt="Transform this into a watercolor painting",
    image_url="https://example.com/photo.jpg",
    width=1024,
    height=768,
)
import Together from "together-ai";
const together = new Together();

const response = await together.images.generate({
  model: "black-forest-labs/FLUX.1-kontext-pro",
  width: 1024,
  height: 768,
  prompt: "Transform this into a watercolor painting",
  image_url: "https://example.com/photo.jpg",
});
curl -X POST "https://api.together.xyz/v1/images/generations" \
  -H "Authorization: Bearer $TOGETHER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "black-forest-labs/FLUX.1-kontext-pro",
    "width": 1024,
    "height": 768,
    "prompt": "Transform this into a watercolor painting",
    "image_url": "https://example.com/photo.jpg"
  }'

Multiple Variations

response = client.images.generate(
    prompt="A cute robot assistant",
    model="black-forest-labs/FLUX.1-schnell",
    n=4,
    steps=4,
)
for i, img in enumerate(response.data):
    print(f"Variation {i+1}: {img.url}")

Base64 Response

response = client.images.generate(
    model="black-forest-labs/FLUX.1-schnell",
    prompt="a cat in outer space",
    response_format="base64",
)
print(response.data[0].b64_json)
import Together from "together-ai";
const together = new Together();

const response = await together.images.generate({
  model: "black-forest-labs/FLUX.1-schnell",
  prompt: "a cat in outer space",
  response_format: "base64",
});
console.log(response.data[0].b64_json);
curl -X POST "https://api.together.xyz/v1/images/generations" \
  -H "Authorization: Bearer $TOGETHER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "black-forest-labs/FLUX.1-schnell",
    "prompt": "a cat in outer space",
    "response_format": "base64"
  }'

Parameters

Parameter Type Description Default
prompt string Text description (required)
model string Model ID (required)
width int Width in pixels 1024
height int Height in pixels 1024
n int Number of images (1-4) 1
steps int Diffusion steps (more = better quality) varies
seed int Random seed for reproducibility random
negative_prompt string What to exclude
response_format string “url” or “base64” “url”
image_url string Reference image (Kontext)
aspect_ratio string For Schnell/Kontext models
disable_safety_checker bool Disable NSFW filter false

Notes:

  • Schnell and Kontext models use aspect_ratio; FLUX.1 Pro/Dev use width/height
  • Dimensions should be multiples of 8

Common Dimensions

Use Case Width Height
Square (social media) 1024 1024
Landscape (banners) 1344 768
Portrait (mobile) 768 1344

Steps Guide

  • 1-4 steps: Fast preview (Schnell)
  • 6-12 steps: Good quality
  • 20-30 steps: High quality
  • 30-50 steps: Maximum quality (diminishing returns)

Resources