504 error when calling the Text-to-Image model

When I called the AI model through the ai.run function, it returned a document like the attachment 504.html:
model="@cf/stabilityai/stable-diffusion-xl-base-1.0";
inputs={
  prompt: "cyberpunk cat",
  num_steps: 20
}
ai.run(model, inputs)

The AI model can be called normally by the API endpoint:
fetch(
  "https://api.cloudflare.com/client/v4/accounts/"+env.CLOUDFLARE_ACCOUNT+"/ai/run/"+model, 
  { 
    method: "POST", 
    headers:{
      "Content-Type":"application/json",
      "User-Agent":"awwbot/10",
      "Authorization":"Bearer "+env.CLOUDFLARE_TOKEN
    } ,
    body:JSON.stringify(inputs)
  })
504.html6.28KB
Was this page helpful?