Documentation

Image generation

Requesting an image from a catalogued image model, and reading the URL or base64 payload it returns.

Requesting an image

Image models answer synchronously, like text models — one request, one response, no polling. The request goes to /v1/images/generations and needs only a model and a prompt.

1from openai import OpenAI23client = OpenAI(4    base_url="https://www.realrelay.ai/v1",5    api_key="sk-***",6)78image = client.images.generate(9    model="byteplus/seedream-4-5-251128",10    prompt="A quiet reading room at golden hour",11)1213print(image.data[0].url)
1import OpenAI from "openai";23const client = new OpenAI({4  baseURL: "https://www.realrelay.ai/v1",5  apiKey: process.env.REALRELAY_API_KEY,6});78const image = await client.images.generate({9  model: "byteplus/seedream-4-5-251128",10  prompt: "A quiet reading room at golden hour",11});1213console.log(image.data[0].url);
1curl https://www.realrelay.ai/v1/images/generations \2  -H "Authorization: Bearer $REALRELAY_API_KEY" \3  -H "Content-Type: application/json" \4  -d '{5    "model": "byteplus/seedream-4-5-251128",6    "prompt": "A quiet reading room at golden hour"7  }'

size, quality, n and response_format are accepted, and vendor-specific fields are forwarded unchanged. Which values a given model supports is the model provider's decision rather than ours, so check the provider's own reference before relying on one.

Some catalogued image models do not yet advertise this endpoint, and their catalog entry therefore shows no call example. That is a gap in what we publish, not a statement that the model cannot generate an image — ask support for the exact call while it is being fixed.

Reading the response

The response carries a data array. Each entry has either a url or a b64_json payload, depending on the model and on response_format. Handle both: we pass the provider's response through rather than normalising it, so a model that returns base64 will keep doing so.

1{2"created": 1754899200,3"data": [4  { "url": "https://..." }5]6}

A returned URL is the provider's, not ours, and providers expire them. Treat it as a short-lived handle: download the bytes as soon as you have them rather than storing the link.

Most image models are billed per call rather than per token, with the price varying by size, quality and the number of images requested. The catalog shows each model's per-call price.