Image Generations

Generate images from a text description, compatible with the OpenAI Images API. Generate one or more images per call.

Basics

MethodPOST Endpointhttps://koprouter.kopglobal.com/v1/images/generations AuthenticationAuthorization: Bearer sk-...

Request Parameters

Parameter Type Required Description
model string Yes Image generation model ID
prompt string Yes Image description
size string No Image size, e.g. 1024x1024
n number No Number of images to generate
quality string No Quality tier, e.g. standard, hd
response_format string No Return format, url or b64_json

Example Request

curl https://koprouter.kopglobal.com/v1/images/generations \
  -H "Authorization: Bearer sk-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MODEL_ID",
    "prompt": "A cat sitting on a windowsill at sunset",
    "size": "1024x1024",
    "n": 1
  }'

Example Response

{
  "created": 1720000000,
  "data": [
    {
      "url": "https://example.com/image.png"
    }
  ]
}
With `response_format: "b64_json"`, images are returned Base64-encoded inline in the `b64_json` field — handy for writing straight to a file. You are billed per image generated, so a larger `n` costs more.