Image Generation
Generate images with any model available on ImageRouter.
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"}'const url = 'https://api.imagerouter.io/v1/openai/images/generations';const options = { method: 'POST', headers: {Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json'}, body: '{"prompt": "YOUR_PROMPT", "model": "test/test"}'};
const response = await fetch(url, options);const data = await response.json();console.log(data);import requests
url = "https://api.imagerouter.io/v1/openai/images/generations"payload = { "prompt": "YOUR_PROMPT", "model": "test/test",}headers = { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)print(response.json())Parameners:
Section titled “Parameners:”-
prompt* Text prompt for generating images. -
model* Image model to use for generation. -
qualityNot all models support this. Compatible models have “quality” feature label hereauto[default] - Usually points to “medium”, but some models (eg. gpt-image-1) automatically adjust quality based on your prompt.lowmediumhigh
-
size- Accepted values are different for each model. Some models and providers completely ignoresize.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_formaturl[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.