Images
OpenRouter's Image API: a text prompt in, images out, never streamed. The request resolves to one size the model declares: an explicit size; else resolution keeps the sizes of that tier and aspect_ratio picks the first of them with that ratio; with neither, the model's first size. Only the parameters the model declares reach the provider. A provider may return fewer images than n, and you pay for the images returned: a model priced per image bills each image, one priced per token the tokens the provider reports. A high-quality image can take minutes, so allow a long client timeout. GET /api/v1/images/models lists the image models your key can call and the values each takes.
curl -X POST https://api.llm.buzz/api/v1/images \
-H "Authorization: Bearer $LLM_BUZZ_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen/qwen-image-3",
"prompt": "A honeycomb engraved on a copper plate",
"aspect_ratio": "16:9"
}'{
"created": 1792900000,
"data": [
{
"b64_json": "iVBORw0...",
"media_type": "image/png"
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 4175,
"total_tokens": 4175,
"cost": 0.03
}
}{
"error": {
"code": 400,
"message": "qwen/qwen-image-3 serves aspect_ratio 1:1, 4:3, 3:4, 16:9, 9:16, 3:2, 2:3; resend with one of them.",
"metadata": {
"error_type": "invalid_request",
"gateway_code": "invalid_parameter",
"param": "aspect_ratio"
}
}
}{
"error": {
"code": 401,
"message": "A valid gateway Bearer key is required. Send the virtual key as 'Authorization: Bearer <key>'.",
"metadata": {
"error_type": "authentication",
"gateway_code": "invalid_key"
}
}
}{
"error": {
"code": 402,
"message": "...",
"metadata": {
"error_type": "payment_required",
"gateway_code": "insufficient_credits"
}
}
}{
"error": {
"code": 404,
"message": "The requested model does not exist or is not granted to this key. GET /api/v1/models lists the model aliases available to this key.",
"metadata": {
"error_type": "not_found",
"gateway_code": "model_not_found",
"param": "model"
}
}
}{
"error": {
"code": 429,
"message": "...",
"metadata": {
"error_type": "rate_limit_exceeded",
"gateway_code": "unavailable_route"
}
}
}Authorization
An inference key, as Authorization: Bearer KEY.
Body application/json
modelstringrequiredAn image model from
GET /api/v1/images/models, such asqwen/qwen-image-3; a chat or embeddings model is a 400 onmodel. The:floorand:nitrosuffixes work as on chat.promptstringrequiredWhat to draw, 1 to 32,000 characters.
nintegerdefault 1How many images, 1 to 10 and at most the model's most images per request.
sizestringA size the model declares,
WIDTHxHEIGHTorauto, or a resolution tier such as1Kor2K, read asresolution.aspect_ratiostringA ratio the model declares, such as
16:9: the first declared size with that ratio.resolutionstringA tier the model declares, such as
1Kor2K.qualitystringA value the model declares; a model that declares none ignores the field.
backgroundstringA value the model declares; a model that declares none ignores the field.
output_formatstringA format the model declares; a model that declares none ignores the field.
pngjpegwebpoutput_compressioninteger0 to 100, forwarded only to a model that takes it.
seedintegerForwarded only to a model that takes it.
providerobjectSteers one request across the model's providers. With the OpenAI SDK, send it in
extra_body. Every field acceptsnull. A name matches a provider's display name, its tag or the tag's first part, ignoring case:llm.buzzorllm-buzznames llm.buzz's own provider, andllm-buzz/euonly its capacity in the EU.Show 7 child fields
orderstring[]Try these providers first, in this order, then the others. At most 64 names.
onlystring[]Use only these providers.
ignorestring[]Never use these providers.
allow_fallbacksbooleanfalsestops moving to other providers.sortstringThe order to try providers in. Ignored when
orderis set.pricethroughputlatencysmartzdrbooleantruekeeps the request on providers that declare 0 days of retention.data_collectionstringdenykeeps the request on providers that declare no training and 0 days of retention.allowdeny
userstringYour end user's label, recorded and never forwarded.
Response 200
The images, each as b64_json with the media_type its bytes show (PNG, JPEG or WebP), and usage, whose cost is in US dollars. The X-Generation-Id header names the call's generation record, GET /api/v1/generation.
Errors
400Before any provider call: a field is missing or malformed, or names a size, ratio, tier or value the model does not declare, or
nis above its most images.metadata.paramnames the field, and the message what to send. A chat or embeddings model,input_references,stream: true,output_format: "svg"andresponse_format: "url"are refused the same way.401No key, or the key is unknown, expired, revoked or disabled.
402Your balance is spent and the model is not free, or the request could cost more than your balance.
404No model has this name, or your key may not call it.
429Providers are throttling, or the model is at capacity (
unavailable_route): retry afterRetry-Afterseconds. Or a free offer's allowance is used (free_allowance_exceeded): your organization's tokens, or your key's requests per minute. Choose a paid model, or for the per-minute limit retry afterRetry-Afterseconds.