Image generation

Generate an image from a text prompt. RelayX serves the result from its own R2 bucket — your code never sees an upstream URL.

POST /v1/images/generations

Try it

curl https://relayx.timor419.com/v1/images/generations \
  -H "Authorization: Bearer $RELAYX_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "rx-image-flux",
  "prompt": "A serene mountain lake at dusk, watercolor style",
  "size": "1024x1024"
}'

Reliability & fallback

By default RelayX serves exactly the model you request and never silently substitutes a backend. If the upstream fails you get a clean, retryable error (429 upstream_capacity with Retry-After, or 502) and decide what to do next. To opt into automatic failover, pass an ordered fallback_models list — each SKU is tried in turn when the primary fails. The image is billed at the price of whichever SKU actually served it; since you listed the fallback yourself, its price is known up front. For a reliable, low-latency tier on its own, call rx-image-z-pro directly.

{
  "model": "rx-image-z",
  "prompt": "...",
  "fallback_models": ["rx-image-z-pro"]
}

On success x_relayx reports served_model (the SKU that produced the image — equal to model when no fallback was used), served_by (the actual backend), fallback_used, and cost_usd priced by served_model.