Skip to content

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.

text
GET https://api.rout.my/embed/image:{model}

Request

text
https://api.rout.my/embed/image:image-model-alias?key=sk_your_key_here&prompt=a+blue+glass+cube

Query parameters

ParameterTypeRequiredNotes
keystringYesrout.my API key. The route also works with compatible auth adapters.
promptstringYesURL-encoded image prompt. Spaces can be written as + or %20.
referencesstringNoComma-separated image URLs used as references.

Model path

{model} is the short model name in the path:

text
/embed/image:image-model-alias

This endpoint intentionally uses a whitelist of image aliases. If an alias is not enabled for this endpoint, the API returns 400.

HTML

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

md
![Generated image](https://api.rout.my/embed/image:image-model-alias?key=sk_your_key_here&prompt=a+blue+glass+cube)

References

text
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.png

Response

On success, the response body is the image itself:

HeaderMeaning
Content-TypeImage MIME type, for example image/png.
Content-LengthImage byte size.
X-CacheHIT when served from cache, MISS when newly generated.
Cache-ControlLong-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.

API documentation for rout.my.