Stable Diffusion Custom Image Size: setting Height and Width causes Error

What is the name of the modal you’re running?

@cf/stabilityai/stable-diffusion-xl-base-1.0

What is the error number?

400

What is the error message?

400 - “{"errors":[{"message":"AiError: AiError: Invalid or incomplete input for the model: model returned: Invalid input","code":3010}],"success":false,"result":{},"messages":}”

What is the issue or error you’re encountering

I’m trying to generate an image via Workers using Stable Diffusion. According to the docs, I should be able to set the height and width of a generated image using this worker. Yet each time I try, there is a 400 error with code:3010. My API image generation request works when I submit it without specifying an image height and width. How can I set a custom height and width for the generated image?

What steps have you taken to resolve the issue?

I followed the documentation here: stable-diffusion-xl-base-1.0 · Cloudflare Workers AI docs

What are the steps to reproduce the issue?

curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run/@cf/stabilityai/stable-diffusion-xl-base-1.0
-X POST
-H “Authorization: Bearer $CLOUDFLARE_API_TOKEN”
-d ‘{ “prompt”: “Cat sleeping in a cozy modern living room.”, “height”: 1500, “width”: 1000 }’