4 ms·
Getting started with Workers AI + SDXL (via API) couldn’t be easier. Check out the example below: curl -X POST \ "https://api.cloudflare.com/client
by TekMol 3y ago
Getting started with Workers AI + SDXL (via API) couldn’t
be easier. Check out the example below:
curl -X POST \
"https://api.cloudflare.com/client/v4/accounts/{account-id}/ai/run/@cf/stabilityai/stable-diffusion-xl-base-1.0" \
-H "Authorization: Bearer {api-token}" \
-H "Content-Type:application/json" \
-d '{ "prompt": "A happy llama running through an orange cloud" }'
-o 'happy-llama.png'
First of all, there is a \ missing before the last line.
Second, what is my "{account-id}"? I can't find it anywhere in the Cloudflare dashboard.
I have the feeling it might be my email?
But when I use that, I get this error:
{"result":null,"success":false,"errors":[{"code":7003,"message":"Could not route to /client/v4/accounts/<my_email>/ai/run/@cf/stabilityai/stable-diffusion-xl-base-1.0, perhaps your object identifier is invalid?"}],"messages":[]}
- Gooblebrai 3y agohttps://developers.cloudflare.com/fundamentals/setup/find-account-and-zone-ids/ https://developers.cloudflare.com/fundamentals/setup/find-ac...
- TekMol 3y agoFrom that link: Log in to the Cloudflare dashboard and select your account and domain. What does that mean? Do I have to register a domain with Cloudflare first?
- chris_st 3y agoNo, you don't have to register a domain with them. Sign up (or log in), and you'll be taken to your Dashboard. On the left is a bunch of options. Click on the one labeled "Workers", and on that page in the top right you'll see "Account ID". That value should be the one you want.
- dumbo-octopus 3y agoOn any URL from Cloudflare regarding your account, it's the big ID in the URL. When you're logged in and navigate to https://dash.cloudflare.com/ https://dash.cloudflare.com/, you'll be redirected to https://dash.cloudflare.com/{account-id} https://dash.cloudflare.com/{account-id}