Hola! I can't get the caching to work. Any hints here? The doc page says skipCache:false should

Hola!

I can't get the caching to work. Any hints here?
The doc page says skipCache:false should do it, but I'm seeing slow response times even with it set to 24hours. Does skipCache:false really work?

https://developers.cloudflare.com/ai-gateway/providers/workersai/


const aiResponse = await env.AI.run(
  '@cf/meta/llama-3.1-8b-instruct',
  {
    messages: [
      {
        role: 'system',
        content: 'You are a helpful assistant that transforms text into different tones and styles.'
      },
      {
        role: 'user',
        content: fullPrompt
      }
    ],
    max_tokens: 2048
  },
  {
    gateway: {
      skipCache: false,   // Enable caching (default behavior)
      cacheTtl: 86400     // Cache for 24 hours (24 * 60 * 60 seconds)
    }
  }
);
Cloudflare Docs
Use AI Gateway for analytics, caching, and security on requests to Workers AI. Workers AI integrates seamlessly with AI Gateway, allowing you to execute AI inference via API requests or through an environment binding for Workers scripts. The binding simplifies the process by routing requests through your AI Gateway with minimal setup.
Was this page helpful?