Check if your AI request works with `curl` and when it does implement it inside the worker. Example

Check if your AI request works with
curl
and when it does implement it inside the worker. Example request that works for me ->
curl -X POST \
  https://api.cloudflare.com/client/v4/accounts/${CLOUDFLARE_ACCOUNT_ID}/ai/run/@cf/meta/llama-3-8b-instruct \
  -H "Authorization: Bearer ${CLOUDFLARE_API_TOKEN}" \
  -d '{
  "messages": [
    {
      "role": "system",
      "content": "You are a friendly assistant that helps write stories"
    },
    {
      "role": "user",
      "content": "Write a short story about a llama that goes on a journey to find an orange cloud "
    }
  ]
}' \
  | jq
Was this page helpful?