Embed Images
The Embed Images endpoint generates an image and returns raw image bytes. It can be used directly in HTML <img> tags or Markdown image syntax.
GET https://api.rout.my/embed/image:{model}Request
https://api.rout.my/embed/image:image-model-alias?key=sk_your_key_here&prompt=a+blue+glass+cubeQuery parameters
| Parameter | Type | Required | Notes |
|---|---|---|---|
key | string | Yes | rout.my API key. The route also works with compatible auth adapters. |
prompt | string | Yes | URL-encoded image prompt. Spaces can be written as + or %20. |
references | string | No | Comma-separated image URLs used as references. |
Model path
{model} is the short model name in the path:
/embed/image:image-model-aliasThis endpoint intentionally uses a whitelist of image aliases. If an alias is not enabled for this endpoint, the API returns 400.
HTML
<img
src="https://api.rout.my/embed/image:image-model-alias?key=sk_your_key_here&prompt=a+blue+glass+cube"
alt="Generated blue glass cube"
/>Markdown
References
https://api.rout.my/embed/image:image-model-alias?key=sk_your_key_here&prompt=same+object+in+a+studio&references=https://example.com/ref1.png,https://example.com/ref2.pngResponse
On success, the response body is the image itself:
| Header | Meaning |
|---|---|
Content-Type | Image MIME type, for example image/png. |
Content-Length | Image byte size. |
X-Cache | HIT when served from cache, MISS when newly generated. |
Cache-Control | Long-lived browser cache header for generated image bytes. |
On error, the endpoint returns the standard JSON error object.
Cache behavior
Generated images are cached by model, normalized prompt, and sorted reference URLs. A cache hit returns the stored image without a new generation call and without quota deduction.
Security note
This route places the key in a URL query parameter because image tags cannot send custom headers. Avoid using a private key in public pages unless every viewer is allowed to use that key.