RelayRouterRelayRouter
HomeModelsPricingDocsGet API Key

Docs / API Reference / Generate Image

POST/v1/images/generations

Generate Image

OpenAI-compatible image generation. The response contains image URLs directly; no task polling is involved.

#Request body

ParameterTypeRequiredDescription
modelstringYesImage model ID, e.g. gpt-image-1
promptstringYesText description of the image
nintegerNoNumber of images to generate. Default: 1
sizestringNoOutput size, model-dependent (e.g. "1024x1024")

#Example request

terminalbash
curl https://relayrouter.io/v1/images/generations \
  -H "Authorization: Bearer $RELAYROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-1",
    "prompt": "A photorealistic sunset over snow-capped mountains",
    "n": 1
  }'

#Response

response.jsonjson
{
  "data": [
    { "url": "https://..." }
  ]
}
The OpenAI SDK works too: client.images.generate(...) with the base URL set to https://relayrouter.io/v1. See the Image Generation guide for SDK samples.