Blog

Guide

flux-2-klein-9b Text-to-Image Prompt Recipes for E-commerce Product Images

Copy-paste prompt structures for text rendering and high-fidelity detail, plus curl and Python requests via the hiapi API

Nov 9, 2026 13 min read
Cover art: a flat faceted mineral cross-section in deep petrol, teal and malachite tones, printed gemology plate style.
On this page

Why Prompt Structure Beats Prompt Length

Most bad product renders are not caused by a shortage of adjectives. They are caused by a prompt that mixes subject, camera, lighting, and text requirements into one undifferentiated blob of words. When the output is wrong, you cannot tell which clause caused it, so you rewrite the whole thing and lose whatever was working.

A structured prompt fixes this because every part of the description has a home. You change one slot at a time and re-render. If the label text drifted, you edit the text slot. If the bottle looks plastic instead of frosted glass, you edit the material description. Everything else stays untouched, which makes iteration cheap and makes good results reproducible.

Longer prompts do not automatically improve fidelity. Past a certain length, extra adjectives start competing: "glossy" and "matte" in the same string, two different light directions, three plausible background tones. The model has to average them, and averaged prompts produce average images. A short prompt with clearly separated slots gives the model unambiguous instructions.

Throughout this guide we use a five-slot recipe format:

  • Subject — the product and its defining physical attributes
  • Composition — framing, angle, placement, background
  • Light — direction, quality, and shadow behavior
  • Text — exact copy, placement, and hierarchy
  • Negatives — a short list of artifacts to suppress

Each section below gives copy-paste strings for specific slots. You assemble them, run them through flux-2-klein-9b/text-to-image on the hiapi API, and adjust one slot per iteration.

The Recipe Skeleton: Subject, Composition, Light, Text, Negatives

Here is the template. Treat the bracketed parts as fill-in fields, not suggestions.

Subject: [product name], [primary material], [surface finish], [one distinguishing detail]
Composition: [shot type] of [subject placement], [background description], [camera angle]
Light: [direction] [quality] light, [shadow description]
Text: the words "[exact copy]" in [typeface style], positioned [location], sized [relative size]
Negatives: [artifact], [artifact], [artifact]

A filled example for a skincare product:

Subject: amber glass dropper bottle, frosted glass body, matte black cap, a thin label band near the base
Composition: product hero shot, bottle centered on a light stone surface, soft neutral background with slight gradient, eye-level camera angle
Light: large softbox from the upper left, gentle falloff toward the right, soft contact shadow under the bottle
Text: the words "DAILY SERUM" in a clean geometric sans-serif, positioned on the label band, sized to span most of the label width
Negatives: warped lettering, duplicate labels, harsh specular hotspots

Two rules keep this skeleton honest. First, order matters less than separation — the labels (Subject:, Light:) are for your own editing discipline, and you can drop them once the prompt is stable. Second, keep each slot to a handful of concrete descriptors. If a slot needs more than two lines, you are probably describing two different images.

Aim for fifteen to forty words per content slot. That range is enough to pin down the physical reality of a product without giving the model room to invent competing interpretations.

Recipes for Legible Text in Images

Text rendering is where prompt discipline pays off most visibly. Three habits move the needle: quote the exact copy, state where it goes, and keep the word count small.

Quote exactly, once

Put the desired copy in quotes and state it a single time. Repeating the string in different slots invites the model to render it twice.

Text: the words "AURORA" in a bold condensed sans-serif, centered on the front panel, large enough to dominate the upper third

Specify hierarchy explicitly

When there are two text elements, name which is primary and which is secondary, and describe their relative size.

Text: primary line "COLD BREW" in a heavy serif, centered; secondary line "single origin" in a smaller light sans-serif directly beneath it, roughly one quarter the height of the primary line

Anchor placement to physical features

"Centered" is weak. "Centered on the front label, between the top edge and the cap collar" gives the model geometry it can use.

Text: the words "SPF 30" in a rounded sans-serif, positioned in the lower right corner of the label, small relative to the product

Keep the text short

One to four words renders reliably. Full sentences, product claims, and ingredient lists are where legibility collapses into melted glyphs. If your packaging genuinely needs a paragraph, generate the clean product image first and composite real typography afterward — the model is not a layout engine.

Patterns that work for e-commerce labels

  • Short brand marks: the words "NORD" in an uppercase geometric sans-serif, tracking wide, centered on the bottle shoulder
  • Size or volume: the words "250ml" in a small regular sans-serif, bottom edge of the label, right-aligned
  • Category words: the words "BODY LOTION" in a medium-weight sans-serif, one line, spanning the label width

If a render comes back with garbled characters, shorten the string before you change anything else. Length is the most common failure axis.

Recipes for High-Fidelity Product Detail

Fidelity comes from physical specificity, not adjective density. Three slots carry most of the weight: material, surface finish, and framing.

Material

Name the substance and one or two of its visible consequences.

Subject: ceramic mug, thick stoneware body, slight irregularity along the rim, speckled clay visible through the glaze

Compare that to a beautiful high-quality mug, which tells the model nothing it can render.

Surface finish

Finish is where renders most often go wrong, because "shiny" and "premium" are not instructions. Describe how light behaves on the surface.

Subject: stainless steel thermos, brushed horizontal grain, satin finish that spreads highlights into wide soft bands rather than sharp points
Subject: glass perfume bottle, clear thick-walled glass, polished facets that produce crisp edges and a visible refraction through the body

Framing

Borrow camera vocabulary. It gives the model a consistent spatial model of the shot.

  • product hero shot, eye-level, centered, shallow depth of field with the background falling off softly
  • three-quarter angle, slightly above eye level, product occupying the lower two thirds of the frame
  • flat lay, directly overhead, product aligned to the frame edges with even margins

Texture descriptors that earn their place

Use these only when they are true of the product: brushed, frosted, matte, satin, polished, woven, knurled, embossed, anodized. Each maps to a specific light response, which is why they outperform generic praise words.

A complete detail-oriented subject line:

Subject: matte ceramic candle jar, unglazed exterior with fine grain, smooth glazed interior lip, thin wooden lid resting slightly ajar

Notice there are no superlatives. Every word constrains geometry or light.

Each prompt recipe peels the product shot into material, finish, lighting and framing facets.

Weights and a Short Negative List

Emphasizing and de-emphasizing terms

When a slot is being ignored, you have two levers: move the term earlier in the prompt, or weight it. Weighting syntax varies by tooling, so check what flux-2-klein-9b/text-to-image accepts on the hiapi API before relying on a specific notation in production payloads. In practice, reordering is the most portable fix — terms near the start of a slot carry more influence than terms buried at the end.

Use weights for genuine conflicts, not for routine emphasis. If the label text keeps shrinking, weight the text slot rather than weighting every word in the subject.

Keep negatives evidence-based

A negative list is a patch list, not a wish list. Start empty. Render. When you see a specific artifact, add it. When you stop seeing it, consider removing it.

A practical starting set for product work:

Negatives: warped lettering, duplicate text, extra fingers, distorted reflections

That is about the useful ceiling for most e-commerce prompts. Long negative lists cause two problems. First, they consume prompt budget that could be describing the product. Second, broad negatives like blurry or low quality can push the model away from legitimate soft-focus backgrounds and fine surface texture that you actually wanted.

Add negatives per artifact category:

  • Text failures: warped lettering, duplicate text, misspelled labels
  • Structural failures: asymmetric bottle, floating product, missing lid
  • Lighting failures: harsh specular hotspots, double shadows
  • Background failures: cluttered background, visible seams

Review the list every few renders. If an item has not appeared in a while, drop it and spend the words elsewhere.

Running It on the hiapi API: curl and Python

The model id is flux-2-klein-9b/text-to-image. Both clients send the same request shape: a model identifier plus a parameters object containing the assembled prompt. Replace the API key and base URL with the values from your hiapi account.

curl

curl -X POST "$HIAPI_BASE_URL/v1/images/generations" \
  -H "Authorization: Bearer $HIAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flux-2-klein-9b/text-to-image",
    "prompt": "Subject: amber glass dropper bottle, frosted glass body, matte black cap, thin label band near the base. Composition: product hero shot, bottle centered on a light stone surface, soft neutral gradient background, eye-level camera angle. Light: large softbox from the upper left, gentle falloff toward the right, soft contact shadow. Text: the words \"DAILY SERUM\" in a clean geometric sans-serif, on the label band, spanning most of the label width. Negatives: warped lettering, duplicate labels, harsh specular hotspots."
  }'

Python

import os
import requests

payload = {
    "model": "flux-2-klein-9b/text-to-image",
    "prompt": (
        "Subject: amber glass dropper bottle, frosted glass body, matte black cap, "
        "thin label band near the base. "
        "Composition: product hero shot, bottle centered on a light stone surface, "
        "soft neutral gradient background, eye-level camera angle. "
        "Light: large softbox from the upper left, gentle falloff toward the right, "
        "soft contact shadow. "
        "Text: the words \"DAILY SERUM\" in a clean geometric sans-serif, on the label band, "
        "spanning most of the label width. "
        "Negatives: warped lettering, duplicate labels, harsh specular hotspots."
    ),
}

response = requests.post(
    f"{os.environ['HIAPI_BASE_URL']}/v1/images/generations",
    headers={
        "Authorization": f"Bearer {os.environ['HIAPI_API_KEY']}",
        "Content-Type": "application/json",
    },
    json=payload,
    timeout=120,
)
response.raise_for_status()
print(response.json())

Adapting the payload

Keep the prompt as a single assembled string built from your slot variables — do not send one field per slot unless the API documents those fields. In code, store each slot as its own variable and join them, so you can vary the background or label copy per SKU without touching the rest of the recipe. Check the API reference for the exact endpoint path and accepted parameters on your account, and add output dimensions or seed controls there if your integration needs them.

One payload shape, two client paths — curl and Python feed the same request into a single returned image.

An E-commerce Product Image Example, End to End

Here is a complete, reusable example for a coffee brand launching a bagged roast. Every slot is filled, the negative list is short, and the text is small enough to render.

Subject: matte kraft paper coffee bag with a flat bottom, folded top with a tin tie, fine paper grain visible, a rectangular label panel on the front
Composition: product hero shot, bag standing slightly right of center on a dark walnut surface, muted warm background, three-quarter angle slightly above eye level
Light: soft window light from the left, gentle gradient across the bag face, long soft shadow falling right
Text: the words "NIGHT ROAST" in a bold condensed serif on the label panel, centered; the words "250g" in a small sans-serif beneath it
Negatives: warped lettering, duplicate text, torn paper edges, harsh specular hotspots

Send it through the same request shape shown earlier, swapping only the prompt string:

prompt = " ".join([
    "Subject: matte kraft paper coffee bag with a flat bottom, folded top with a tin tie,",
    "fine paper grain visible, a rectangular label panel on the front.",
    "Composition: product hero shot, bag standing slightly right of center on a dark walnut surface,",
    "muted warm background, three-quarter angle slightly above eye level.",
    "Light: soft window light from the left, gentle gradient across the bag face, long soft shadow falling right.",
    "Text: the words \"NIGHT ROAST\" in a bold condensed serif on the label panel, centered;",
    "the words \"250g\" in a small sans-serif beneath it.",
    "Negatives: warped lettering, duplicate text, torn paper edges, harsh specular hotspots.",
])

payload = {"model": "flux-2-klein-9b/text-to-image", "prompt": prompt}

Read the first render like a checklist. Lettering legible and correctly spelled? If not, shorten the copy or simplify the typeface description. Paper grain present? If the bag reads as plastic, strengthen the material slot and add a finish descriptor. Shadow direction consistent? If you see two shadows, the light slot has a conflict — remove one source.

Make exactly one change per iteration and keep the version that improves the targeted slot without degrading the others. Save each accepted prompt alongside its output so the recipe for a given SKU is never lost.

Iterating: From First Render to a Consistent Image Set

A single good render is a demo. A consistent set is what an e-commerce catalog needs. The goal is to vary composition while holding subject, light logic, and text treatment fixed.

Freeze the identity slots

Keep Subject and Light byte-identical across every image in the set. These define what the product is and how it is lit. Changing them between shots is what makes a set look like it came from different brands. Lock them as constants in your code and build variations only on top.

Vary composition deliberately

Write two or three composition strings up front and reuse them across SKUs:

  • product hero shot, centered, eye-level, neutral gradient background
  • three-quarter angle from above, product in the lower two thirds, surface visible
  • flat lay, directly overhead, even margins on all sides

Rotating through a fixed composition vocabulary produces a set that reads as intentional rather than random.

Swap only the text slot per variant

If a product line shares packaging, the text slot is usually the only thing that changes between SKUs. Parameterize it and leave everything else alone. This is also the slot most likely to fail, so test it in isolation with a single composition before generating the whole set.

Track changes as diffs

Keep prompts in version control. Each commit should change one slot and include the render it produced. When a later variant regresses — say, a label suddenly warps — you can trace it to the specific slot edit rather than re-deriving the whole recipe.

Know when to stop tuning

If three consecutive edits to a slot produce no visible improvement, the problem is likely outside the prompt: the request itself, or a physical detail the model cannot resolve at this framing. Move that detail out of the prompt and handle it in post, or change the composition so it is no longer load-bearing.

Once your constants and composition vocabulary are stable, generating a full product set becomes a loop over text and composition strings, not a fresh prompt-writing exercise each time. Keep the recipe skeleton fixed and the catalog scales with it.

Related articles

View all articles →

Start building with persistent AI artifacts

Get your API key and call image, video and audio models through one task-based API.

Read the API docs