A production text-to-image API should give backends a stable contract, normalized sizes, and clear failure modes — not a different SDK per vendor.
“Luxury solid ceramic perfume bottle, completely opaque matte lilac glaze, rectangular modern flacon, matching ceramic stopper, thin polished chrome collar, warm travertine plinth, soft peach studio backdrop, commercial product photography, portrait composition”
FLUX Dev · premium · 960 × 1472Describe intent without leaking provider complexity into your app
The core request is intentionally small: prompt, optional negative prompt, width, height, image count, quality, and response format. Provider selection defaults to auto. That keeps ordinary product code readable while preserving an escape hatch for teams that need to pin an exact vendor model.
RenderRoute validates the payload before spending money. It limits prompt length and batch size, normalizes whitespace, checks safety mode authorization, and makes image dimensions compatible with the configured model fleet. The normalized dimensions are echoed back so billing and layout logic never has to guess.
- Use quality=fast for previews, feeds, and iteration
- Use quality=premium for hero art and final review
- Pass a user reference for your own abuse tracing without sending personal data
Write prompts for composition, not for a particular vendor UI
Portable prompts describe the subject, scene, composition, light, material, and intended use. They avoid provider-only magic words unless a model is explicitly pinned. This makes fallback output more consistent and keeps content reusable as the routing table evolves.
A useful production pattern separates immutable product facts from creative direction. For example, the server can assemble a trusted product description, a campaign-specific visual brief, and a final safety-reviewed style phrase. Store the components in your own system and send only the assembled prompt for generation.
| Prompt layer | Example purpose | Owner |
|---|---|---|
| Subject facts | Shape, material, required details | Product data |
| Composition | Camera angle, framing, negative space | Creative template |
| Art direction | Lighting, palette, medium | Campaign |
| Policy constraints | No logos, no text, adult-only gating | Platform |
Read routing metadata alongside the image
The image is only one part of a useful response. RenderRoute also returns the provider and provider model, actual and requested dimensions, request duration, whether a fallback occurred, and a compact list of attempts. This is the data support teams need when a customer asks why one result took longer than another.
For synchronous product flows, URL output minimizes response size. Base64 can be useful inside closed pipelines where external URLs are inconvenient. Generated vendor URLs may be temporary, so production systems should copy approved output to owned object storage and apply retention rules before showing it to end users.
import httpx
payload = {
"prompt": "Minimal ceramic desk lamp, soft studio shadows, catalog photography",
"quality": "fast",
"width": 1024,
"height": 1024,
}
response = httpx.post(
"https://renderroute.app/v1/images/generations",
headers={"Authorization": f"Bearer {API_KEY}"},
json=payload,
timeout=90,
)
response.raise_for_status()
result = response.json()
print(result["data"][0]["url"], result["meta"]["provider"])Launch with a defined quality and safety evaluation set
Do not judge a text-to-image route with five attractive prompts. Build a fixed evaluation set that represents your real demand: portraits, products, text-heavy requests, difficult aspect ratios, prohibited prompts, ambiguous prompts, and expected provider outages. Record output acceptance, latency, cost, and moderation behavior by version.
That dataset becomes a release gate. A routing change should improve a measured outcome without weakening safety or breaking client expectations. The repository includes an initial benchmark harness and a place to document evidence, but your own prompts and review rubric are the defensible advantage.
Questions about text to image API
What is the difference between fast and premium?
Fast is the default low-latency, low-cost lane. Premium selects a higher-fidelity model path intended for final or hero assets. Both use the same request format.
Can I request more than one image?
Yes. The API supports one to four images per request, with a deployment setting to lower the maximum.
Are dimensions changed automatically?
By default, incompatible dimensions are snapped to the nearest multiple of 64 within configured bounds and reported in response metadata. Disable auto adjustment for strict validation.
Should I expose the API key in a browser?
No. Call RenderRoute from your own backend and keep provider and RenderRoute credentials server-side.