LiteRouter Docs

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:

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

ParameterTypeDescription
modelstringImage model. Optional, defaults to sdxl-turbo.
promptstringText description of the image. Required.
sizestringWidth x height, for example 1024x1024. Optional, defaults to 1024x1024.
nintegerAccepted, but each request returns one image.
bash
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:

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.

ParameterTypeDescription
promptstringText description of the image. Required.
modelstringImage model. Optional, defaults to sdxl-turbo.
widthintegerPixel width. Optional, defaults to 1024.
heightintegerPixel height. Optional, defaults to 1024.
seedintegerSeed for reproducible results. Optional.
bash
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:

HeaderDescription
X-ModelThe image model that produced the result.
X-SeedThe seed used, so you can reproduce it.
X-Request-IDIdentifier 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:

bash
curl https://api.literouter.com/v1/models \
  -H "Authorization: Bearer $LITEROUTER_API_KEY" \
  | jq '.data[] | select(.modality == ["image"]) | {id, minimum_tier}'