Skip to content

Image Generation

Generate images with any model available on ImageRouter.

Terminal window
curl 'https://api.imagerouter.io/v1/openai/images/generations' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
--data-raw '{"prompt": "YOUR_PROMPT", "model": "test/test"}'

Parameners:

  • prompt* Text prompt for generating images.
  • model* Image model to use for generation.
  • quality Not all models support this. Compatible models have “quality” feature label here
    • auto [default] - Usually points to “medium”, but some models (eg. gpt-image-1) automatically adjust quality based on your prompt.
    • low
    • medium
    • high
  • size - Accepted values are different for each model. Some models and providers completely ignore size.
    • auto [default] - Uses the default recommended size for each model. Some models (eg. gpt-image-1) automatically adjust size based on your prompt.
    • WIDTHxHEIGHT (eg 1024x1024)
  • response_format
    • url [default] - Returns the image URL hosted on ImageRouter’s servers. The image is saved in your logs. and is publicly accessible with the URL if you share it.
    • b64_json - Returns the image as base64-encoded JSON data. The image is saved in your logs. and is publicly accessible with the URL if you share it.
    • b64_ephemeral - Same as b64_json but the image is not saved in our system. The provider may still have it.
  • image[] Input image(s) for supported image editing models.
  • mask[] Some models require a mask file to specify areas to edit.

Please contact me if you miss anything.