Server only
Generate from trusted backend code — never ship keys to browsers.
FastAPI and Python image API patterns — typed requests, dimension normalization, idempotency, bounded retries, and stable errors you can map in code.
Wire image generation into FastAPI without turning one route into a provider-specific monolith. Thin client patterns, timeouts, idempotency, and typed errors.
Read the guide →Call an image generation API from Python with typed requests, Idempotency-Key discipline, and no duplicate paid work when a client retries the same business action.
Read the guide →One endpoint, one auth method, one error envelope, one idempotency rule. Provider credentials and model aliases stay behind the server. Thin clients. Fat control plane.
Generate from trusted backend code — never ship keys to browsers.
Retry transient work with idempotency; stop on invalid or policy errors.
Capture request ID, final size, route, duration, fallback state.