Back to docs

Recipe

Image generation patterns

Meridian routes image generation across multiple providers behind one OpenAI-compatible endpoint. This recipe covers the three patterns we recommend for production: single-shot synthesis, prompt chaining with a vision verifier, and batched fan-out for product catalogs. Each pattern is tuned for cost, latency, and recoverability.

1. Single-shot synthesis

Send a single prompt to the /v1/images/generationsendpoint. Use this when latency matters more than fidelity. The gateway falls back across providers automatically if a primary route returns a transient 5xx.

2. Vision-verified chaining

Generate an image, then pass it back through a vision model with the original prompt to score adherence. Loop up to N times until the score clears your threshold. Costs more, but ships clean assets.

3. Batched fan-out

For catalog work, fan out N prompts concurrently and reconcile in a single response. Meridian rate-limits per key, so cap concurrency at the floor of your tier and the slowest provider in your route.

Example request

curl https://llm.getnimbus.net/v1/images/generations \
  -H "Authorization: Bearer $MERIDIAN_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "azure/image-router",
    "prompt": "a violet aurora over a dark city",
    "size": "1024x1024",
    "n": 1
  }'