Workers AI Update: Stable Diffusion, Code Llama and Workers AI in 100 Cities
blog.cloudflare.com
blog.cloudflare.com
I gather $0.01 / 1k neurons. Which apparently is "130 LLM responses, 830 image classifications, or 1,250 embeddings."
What's that in sane measurements like dollars per 1k tokens?
As much as I enjoy measuring my cars speed in beard seconds...could we fkin not?
- relatively slow at around 15 seconds per generated image, although still faster than a cold start from replicate.
- No ability to specify resolution/aspect ratios
- no way to specify the sampler
- limited to 20 steps maximum
It's primarily a benefit for Cloudflare. Instead of huge and expensive mega-datacenters that AWS/GCP/Azure operates, they can rent cheaper colo space and better distribute workloads. The latter is, I think, the key... AWS basically incentivises you to stay in a single region as long as possible (mostly because the UX of both the web UI and the CLI just sucks when dealing with multiple regions), which means that a lot of users tend to stick in the AWS region most close to themselves, the services aren't really interconnected between regions because that's a headache to set up, while Cloudflare runs "at the edge" from the beginning and people don't even think about introducing silent dependencies on any specific region. And if a Cloudflare DC/region has a massive outage, chances are high no one will notice it because the workloads will just silently shift to somewhere else.
For voice recognition, latency absolutely matters.
We integrate with Replicate for SDXL but if this was production ready it would have been likely we went with this instead
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":[]} 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?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.
> Users will be able to choose from two ways to run Workers AI:
> Regular Twitch Neurons (RTN) - running wherever there's capacity at $0.01 / 1k neurons
> Fast Twitch Neurons (FTN) - running at nearest user location at $0.125 / 1k neurons
> Neurons are a way to measure AI output that always scales down to zero (if you get no usage, you will be charged for 0 neurons).
Here's the key detail:
> To give you a sense of what you can accomplish with a thousand neurons, you can: generate 130 LLM responses, 830 image classifications, or 1,250 embeddings.
[0] - https://developers.cloudflare.com/workers/platform/pricing
I'm not yet committed to this because I know that many (most?) people cannot express their intentions in plain English concisely and precisely enough to be implemented as an algorithm. As my first formal instructor of programming taught me, a lot of programming just that: thinking through what one wants, with sufficient rigor. Support for such a feature could be a nightmare, making it more trouble than it is worth. However, I may offer it as an experiment. It might work well enough to, say, draft Google Sheets formulas that power users could tweak.