cf_token, api gateway

I've been really struggling to get the ai gateway to work, I can't seem to get an api token that has the correct permissions.
curl https://gateway.ai.cloudflare.com/v1/{redacted}/{redacted}/workers-ai/@cf/huggingface/distilbert-sst-2-int8 \
--header 'Authorization: Bearer {redacted}' \
--header 'Content-Type: application/json' \
--data '{ "text": "Cloudflare docs are amazing!" }'
curl https://gateway.ai.cloudflare.com/v1/{redacted}/{redacted}/workers-ai/@cf/huggingface/distilbert-sst-2-int8 \
--header 'Authorization: Bearer {redacted}' \
--header 'Content-Type: application/json' \
--data '{ "text": "Cloudflare docs are amazing!" }'
gives me an error
{"success":false,"result":[],"messages":[],"error":[{"code":2009,"message":"Unauthorized"}]}
{"success":false,"result":[],"messages":[],"error":[{"code":2009,"message":"Unauthorized"}]}
2 Replies
Zack
ZackOP4w ago
I gave it access to read on workers ai
No description
Zack
ZackOP4w ago
anyone seen it?

Did you find this page helpful?