Generate an image

Generate images with the Alibaba Cloud Model Studio qwen-image series

POST /v1/images/generations

Service root: https://getrouter.ai

Protocol: OpenAI Images

Authentication: Authorization: Bearer YOUR_API_KEY

Request body

The request body is optional. Media type: application/json

Request fields

FieldTypeRequiredDescription
modelstringYes
inputobjectYes
parametersobjectNo

Example request

curl --request POST \
  --url https://getrouter.ai/v1/images/generations \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "MODEL_ID",
  "input": {
    "messages": [
      {}
    ]
  }
}'

Responses

StatusDescription
200Image generated successfully

Success response fields

FieldTypeRequiredDescription
createdintegerNo
dataarray<object>No

Example response

{
  "created": 1,
  "data": [
    {
      "url": "https://example.com/resource",
      "b64_json": "string",
      "revised_prompt": "A futuristic city at sunset"
    }
  ]
}

For complete workflows and examples, read the Image Generation API Guide.


This page is generated from the public Relay OpenAPI specification. Browse the complete specification in the API Explorer.