Image Generation
Generate images from text prompts on a dedicated host, in the OpenAI format that apps and SDKs expect, or as a plain image file.
Base URL
Image generation uses a separate host from the chat API:
https://image.literouter.com/v1
Each image model has a minimum plan; the Models section shows it.
OpenAI-compatible endpoint
POST /v1/images/generations takes the same request as OpenAI's image API and returns the image as base64 JSON.
| Parameter | Type | Description |
|---|---|---|
model | string | Image model. Optional, defaults to sdxl-turbo. |
prompt | string | Text description of the image. Required. |
size | string | Width x height, for example 1024x1024. Optional, defaults to 1024x1024. |
n | integer | Accepted, but each request returns one image. |
curl https://image.literouter.com/v1/images/generations \
-H "Authorization: Bearer $LITEROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "model": "sdxl-turbo", "prompt": "a serene mountain lake at sunset", "size": "1024x1024" }'
The response holds the image in data[0].b64_json:
{
"created": 1791794410,
"data": [{ "b64_json": "/9j/4AAQSkZJRg...", "revised_prompt": "a serene mountain lake at sunset" }]
}
Errors use the OpenAI shape, { "error": { "message": "...", "type": "..." } }.
Use it in an app
In RikkaHub or any app with an OpenAI-compatible provider, add a separate provider for images:
- Base URL:
https://image.literouter.com/v1 - API key: your LiteRouter key
- Add the model by name (for example
sdxl-turbo) and mark it as an image model.
Keep a second provider with https://api.literouter.com/v1 for chat.
Image file endpoint
POST /generate on https://image.literouter.com returns the image file itself, handy for scripts and websites.
| Parameter | Type | Description |
|---|---|---|
prompt | string | Text description of the image. Required. |
model | string | Image model. Optional, defaults to sdxl-turbo. |
width | integer | Pixel width. Optional, defaults to 1024. |
height | integer | Pixel height. Optional, defaults to 1024. |
seed | integer | Seed for reproducible results. Optional. |
curl -X POST https://image.literouter.com/generate \
-H "Authorization: Bearer $LITEROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "prompt": "a serene mountain lake at sunset", "model": "sdxl-turbo" }' \
--output image.jpg
Details come in the response headers:
| Header | Description |
|---|---|
X-Model | The image model that produced the result. |
X-Seed | The seed used, so you can reproduce it. |
X-Request-ID | Identifier for support and debugging. |
List image models
The model list on the chat API marks image models with "modality": ["image"] and shows each one's minimum_tier:
curl https://api.literouter.com/v1/models \
-H "Authorization: Bearer $LITEROUTER_API_KEY" \
| jq '.data[] | select(.modality == ["image"]) | {id, minimum_tier}'