skillfed

cloudflare-workers-ai

Cloudflare Workers AI enables serverless GPU inference directly within Workers, supporting LLMs, embeddings, image generation, and vision models. Stream responses to avoid timeouts and buffer issues, integrate with AI Gateway for caching and cost tracking, and choose from optimized models like Llama, Qwen, and Flux.

Cloudflare Workers AI lets you run LLM inference with streaming on serverless GPU compute.

AI-generated summary based on this skill's SKILL.md

196 29 MIT updated by secondsky

Install

secondsky/claude-skills/cloudflare-workers-ai · repository language: TypeScript

git clone https://github.com/secondsky/claude-skills
cp -r claude-skills/plugins/cloudflare-workers-ai/skills/cloudflare-workers-ai ~/.claude/skills/cloudflare-workers-ai
npx skillfed install secondsky/claude-skills/cloudflare-workers-ai

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I use Workers AI for LLM inference on Cloudflare?

Cloudflare Workers AI enables serverless GPU inference directly within Workers. Bind the AI service to your Worker, then call models like Llama or Qwen using the `ai.run()` method. Stream responses using the `stream` option to avoid timeouts and buffer issues. Integrate with AI Gateway for caching, cost tracking, and rate-limit management across your deployments.

What is cloudflare workers ai setup and how do I start?

Cloudflare Workers AI setup begins by adding an AI binding to your `wrangler.toml` file, then importing and calling the AI service in your Worker code. The service supports LLMs, embeddings, image generation, and vision models. Choose optimized models like Llama, Qwen, or Flux based on your task, and enable streaming for text generation to handle large responses efficiently.

How can I build RAG applications using Workers AI embeddings?

Cloudflare Workers AI supports embeddings and vector search for RAG applications. Use the embeddings model to vectorize your documents, store vectors in Vectorize, then retrieve relevant context during inference. Combine this with LLM calls in your Worker to generate responses grounded in your data. Stream the final output to avoid token-exceeded errors in production.

How do I troubleshoot workers ai rate limit and token exceeded errors?

Workers AI rate-limit and token-exceeded errors occur when requests exceed model capacity or response length. Enable streaming to process tokens incrementally and avoid buffer overflow. Use AI Gateway to monitor usage and implement backoff strategies. Check your model's token limits and consider splitting large requests or using smaller models for high-volume workloads.

Can I integrate OpenAI SDK with Cloudflare Workers AI?

Yes, Cloudflare Workers AI integrates with the OpenAI SDK and Vercel AI on Workers. Use compatible models and configure the SDK to point to your Workers AI binding. This allows you to leverage familiar APIs while running inference serverlessly on Cloudflare's GPU infrastructure, reducing latency and cost compared to external API calls.

What image generation and vision models does Workers AI support?

Cloudflare Workers AI supports Flux for image generation and multiple vision models for processing images serverlessly. Use these models to generate images or analyze visual content directly within Workers without external dependencies. Stream responses and monitor token usage to stay within rate limits and avoid model-not-found errors in production deployments.

SKILL.md

rendered from the published skill — quoted content, verbatim

Cloudflare Workers AI - Complete Reference

Production-ready knowledge domain for building AI-powered applications with Cloudflare Workers AI.

Status: Production Ready ✅ Last Updated:

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 10 files
plugins/cloudflare-workers-ai/skills/cloudflare-workers-ai/SKILL.md
plugins/cloudflare-workers-ai/skills/cloudflare-workers-ai/references/best-practices.md
plugins/cloudflare-workers-ai/skills/cloudflare-workers-ai/references/integrations.md
plugins/cloudflare-workers-ai/skills/cloudflare-workers-ai/references/models-catalog.md
plugins/cloudflare-workers-ai/skills/cloudflare-workers-ai/templates/ai-embeddings-rag.ts
plugins/cloudflare-workers-ai/skills/cloudflare-workers-ai/templates/ai-gateway-integration.ts
plugins/cloudflare-workers-ai/skills/cloudflare-workers-ai/templates/ai-image-generation.ts
plugins/cloudflare-workers-ai/skills/cloudflare-workers-ai/templates/ai-text-generation.ts
plugins/cloudflare-workers-ai/skills/cloudflare-workers-ai/templates/ai-vision-models.ts
plugins/cloudflare-workers-ai/skills/cloudflare-workers-ai/templates/wrangler-ai-config.jsonc

Related skills

Tags

serverless-gpu edge-inference multi-model-support real-time-streaming cost-optimization error-recovery sdk-compatibility production-ready