Skip to main content

Documentation Index

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

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

Generate images from text prompts using FLUX.1, FLUX.2, Stable Diffusion, and Ideogram through a single API. One API key, one endpoint, eight model families — no GPU management.

Available models

ModelSpeedQualityFeatures
FLUX.1 SchnellFastGoodText-to-image, best for prototyping
FLUX.1 DevMediumHighOpen weights, img2img support
FLUX.1 ProMediumVery HighProduction-grade
FLUX.1.1 ProMediumVery HighUpdated Pro model
FLUX.2 ProMediumHighestUp to 4MP, multi-reference images
FLUX KontextMediumHighImage editing with text instructions
Stable Diffusion 3.5MediumHighOpen weights
Ideogram v2MediumHighBest text rendering in images

Basic text-to-image

curl https://api.runcrate.ai/v1/images/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer rc_live_YOUR_API_KEY" \
  -d '{
    "model": "black-forest-labs/FLUX.1-schnell",
    "prompt": "A minimalist product photo of wireless earbuds on a marble surface, soft studio lighting, white background",
    "aspect_ratio": "1:1"
  }'

Image editing with FLUX Kontext

FLUX Kontext models accept an existing image and a text instruction describing the edit. Pass a file path, URL, or base64 string as the image parameter.
from runcrate import Runcrate

client = Runcrate(api_key="rc_live_YOUR_API_KEY")

# Edit an existing image with a text instruction
edited = client.models.generate_image(
    model="black-forest-labs/FLUX.1-kontext-pro",
    prompt="Change the background to a tropical beach at sunset",
    image="./product-photo.png",  # file path (auto base64-encoded)
)

edited.data[0].save("product-beach.png")
The image field accepts three formats:
  • File path"./photo.png" (auto-detected, read and base64-encoded)
  • URL"https://..." (passed through as-is)
  • Base64 string — raw base64 data (passed through as-is)

Batch generation — product catalog

Generate a full set of product images in one script. This example creates hero images for an e-commerce catalog:
from runcrate import Runcrate

client = Runcrate(api_key="rc_live_YOUR_API_KEY")

products = [
    {"name": "Running Shoe", "prompt": "A sleek running shoe, white background, studio lighting"},
    {"name": "Backpack", "prompt": "A modern laptop backpack, minimalist, product photography"},
    {"name": "Watch", "prompt": "A luxury watch on marble surface, soft shadows"},
]

for product in products:
    image = client.models.generate_image(
        model="black-forest-labs/FLUX.1-schnell",
        prompt=product["prompt"],
    )
    filename = f"{product['name'].lower().replace(' ', '-')}.png"
    image.data[0].save(filename)
    print(f"Saved {filename}")
For higher throughput, run generations in parallel:
from runcrate import Runcrate
from concurrent.futures import ThreadPoolExecutor

client = Runcrate(api_key="rc_live_YOUR_API_KEY")

products = [
    {"name": "Running Shoe", "prompt": "A sleek running shoe, white background, studio lighting"},
    {"name": "Backpack", "prompt": "A modern laptop backpack, minimalist, product photography"},
    {"name": "Watch", "prompt": "A luxury watch on marble surface, soft shadows"},
    {"name": "Sunglasses", "prompt": "Designer sunglasses on a reflective surface, dramatic lighting"},
    {"name": "Headphones", "prompt": "Over-ear headphones floating, dark background, rim lighting"},
]

def generate(product):
    image = client.models.generate_image(
        model="black-forest-labs/FLUX.1-schnell",
        prompt=product["prompt"],
    )
    filename = f"{product['name'].lower().replace(' ', '-')}.png"
    image.data[0].save(filename)
    print(f"Saved {filename}")

with ThreadPoolExecutor(max_workers=5) as pool:
    pool.map(generate, products)

print("All product images generated.")

Parameters reference

Parameters vary by model. These are the most common:
ParameterTypeDescription
modelstringModel ID (required)
promptstringText description of the image (required)
aspect_ratiostringOutput ratio: 1:1, 16:9, 9:16, 4:3, 3:2
seedintegerReproducibility seed (omit for random)
num_inference_stepsintegerNumber of diffusion steps — more steps = more detail, slower
guidancenumberHow closely to follow the prompt
negative_promptstringWhat to avoid in the image

Model-specific parameters

  • FLUX Kontext models: Accept image for image editing
  • FLUX Canny: Requires control_image for edge-guided generation
  • FLUX.2 Pro: Accepts up to 8 input_images for reference-based generation
  • FLUX Dev/Krea: Accept image for img2img mode with prompt_strength control
Check the Playground to see the exact parameters available for each model.

Next.js API route

Add image generation to a web app with a single API route:
// app/api/generate-image/route.ts
import { runcrate } from '@runcrate/ai';
import { generateImage } from 'ai';

export async function POST(req: Request) {
  const { prompt, model, aspectRatio } = await req.json();

  const { image } = await generateImage({
    model: runcrate.imageModel(model || 'black-forest-labs/FLUX.1-schnell'),
    prompt,
    size: aspectRatio === '16:9' ? '1792x1024' : '1024x1024',
  });

  return Response.json({ image: image.base64 });
}
Call it from the frontend:
const response = await fetch('/api/generate-image', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    prompt: 'A mountain landscape at golden hour',
    model: 'black-forest-labs/FLUX.1-schnell',
    aspectRatio: '16:9',
  }),
});

const { image } = await response.json();
// image is a base64 string — render it in an <img> tag

Response format

All image generation requests return the same shape:
{
  "data": [
    {
      "url": "https://...",
      "b64_json": "..."
    }
  ]
}
The response includes either a url to the generated image or b64_json base64-encoded image data. The Runcrate SDKs provide a .save() helper that handles both formats automatically.

Pricing

Image generation pricing varies by model. FLUX.1 Schnell starts at ~$0.003/image. Higher-quality models like FLUX.2 Pro cost more per generation. Check the Model Catalog for current per-model pricing.