Image generation app

epithre-iris is our image generation and editing model. Style comes from the prompt.

Basic generation

import base64
resp = client.images.generate(
    model="epithre-iris",
    prompt="warung kopi pinggir jalan Jakarta malam, cinematic, golden hour, wide shot",
    size="768x768",
    num_steps=20,
)
open("warkop.png", "wb").write(base64.b64decode(resp.data[0].b64_json))

Multi-reference editing

import base64, httpx, os

refs = [base64.b64encode(open(f"ref_{i}.png", "rb").read()).decode()
        for i in range(3)]

resp = httpx.post(
    "https://api.epithre.com/v1/images/edits",
    headers={"Authorization": f"Bearer {os.environ['EPITHRE_KEY']}"},
    json={
        "model": "epithre-iris",
        "prompt": "the product from image 1, in the studio setting from image 2, "
                  "shot in the style of image 3",
        "images": refs,
        "size": "640x640",
    },
    timeout=60,
).json()

Useful for: product-in-context shots, style transfer, A/B compositions.

Common prompt patterns

Goal Prompt pattern
Photorealistic "photorealistic, [subject], [lighting], shot on [camera/lens], [setting]"
Illustration "illustration, [subject], [art style], [palette]"
Marketing thumbnail "professional marketing thumbnail for: [topic], vibrant colors, no text"
Product shot "studio product photo of [product], white background, soft lighting"
Concept art "concept art, [subject], cinematic, [mood], [color scheme]"

What works well

What works less well

Latency

Most requests finish in seconds; larger sizes take longer. For interactive UX, show a placeholder and keep the request timeout at 120 seconds or more.

Cost

Rp750 per image. A typical app generating 10 previews + 1 final per user-session = Rp8,250 / session.

Batch generation

For nightly poster/thumbnail/asset generation jobs, you can fire many requests in parallel within your concurrency cap. Image generation isn't yet a batch-API target (the input format is different from chat/embed). Use direct realtime calls with a semaphore.

import asyncio
sem = asyncio.Semaphore(3)  # Iris parallel cap

async def generate_one(prompt):
    async with sem:
        return await async_client.images.generate(
            model="epithre-iris", prompt=prompt, size="768x768")

results = await asyncio.gather(*[generate_one(p) for p in prompts])

See also