cloudflare-workers-ai
Run LLMs and AI models on Cloudflare's GPU network with Workers AI. Includes Llama 4, Gemma 3, Mistral 3.1, Flux images, BGE embeddings, streaming, and AI Gateway. Handles 2025 breaking changes. Prevents 7 documented errors. Use when: implementing LLM inference, images, RAG, or troubleshooting AI_ERROR, rate limits, max_tokens, BGE pooling, context window, neuron billing, Miniflare AI binding, NSFW filter, num_steps.
npx skills add majiayu000/claude-skill-registry --skill cloudflare-workers-ai-brendadeeznuts1111-tier-1380-omega --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Runs LLMs and AI models on Cloudflare's GPU network using Workers AI. Supports models such as Llama 4, Gemma 3, Mistral 3.1, and features like Flux image generation, BGE embeddings, streaming, and AI Gateway. Aims to handle 2025 breaking changes and prevent 7 documented errors. Used for implementing LLM inference, images, RAG, or troubleshooting AI_ERROR, rate limits, max_tokens, BGE pooling, context window, neuron billing, Miniflare AI binding, NSFW filter, and num_steps.
How it works
Includes a Quick Start snippet showing how to bind AI in wrangler.jsonc and how to run a model with streaming enabled, returning a text/event-stream. The API usage is described as env.AI.run(model, inputs, options), with optional gateway settings. The knowledge base provides several code examples for embedding generation, RAG workflow, image generation, and handling per-request cache control via AI Gateway headers. It documents model selection, including 2025 updates (new models, context window and pooling changes, per-model pricing, and adapters). It lists common patterns for RAG and structured output, and outlines per-request cache control through headers like cf-aig-cache-ttl, cf-aig-skip-cache, and cf-aig-cache-key.
When to use it
Use when implementing LLM inference, image generation, RAG workflows, or troubleshooting related AI errors (AI_ERROR, rate limits, max_tokens, BGE pooling, context window, neuron billing, Miniflare AI binding, NSFW filter, num_steps).
What it can touch
Env.AI.run interacts with the AI models and may be used with gateway options. The API reference shows inputs and an optional gateway object (e.g., { gateway: { id: string; skipCache?: boolean } }). Per-request cache control is achieved via HTTP headers in a fetch to the AI gateway endpoint, including cf-aig-cache-ttl, cf-aig-skip-cache, and cf-aig-cache-key.
Caveats
License is MIT. Known issues and preventive patterns are documented (context window tokenization, neuron consumption, local dev tooling, NSFW filter false positives, required num_steps for image generation, Zod compatibility notes). The skill emphasizes using streaming for text generation to avoid worker timeouts and to reduce in-memory buffering. It also notes platform changes such as token-based context windows and new per-model capabilities in 2025.
# Cloudflare Workers AI **Status**: Production Ready ✅ **Last Updated**: 2026-01-21 **Dependencies**: cloudflare-worker-base (for Worker setup) **Latest Versions**: wrangler@4.58.0, @cloudflare/workers-types@4.20260109.0, workers-ai-provider@3.0.2 **Recent Updates (2025)**: - **April 2025 - Performance**: Llama 3.3 70B 2-4x faster (speculative decoding, prefix caching), BGE embeddings 2x faster - **April 2025 - Breaking Changes**: max_tokens now correctly defaults to 256 (was not respected), BGE pooling parameter (cls NOT backwards compatible with mean) - **2025 - New Models (14)**: Mistral 3.1 24B (vision+tools), Gemma 3 12B (128K context), EmbeddingGemma 300M, Llama 4 Scout, GPT-OSS 120B/20B, Qwen models (QwQ 32B, Coder 32B), Leonardo image gen, Deepgram Aura 2, Whisper v3 Turbo, IBM Granite, Nova 3 - **2025 - Platform**: Context windows API change (tokens not chars), unit-based pricing with per-model granularity, workers-ai-provider v3.0.2 (AI SDK v5), LoRA rank up to 32 (was 8), 100 adapters per account - **October 2025**: Model deprecations (use Llama 4, GPT-OSS instead) --- ## Quick Start (5 Minutes) ```typescript // 1. Add AI binding to wrangler.jsonc { "ai": { "binding": "A
- Quick Start (5 Minutes)
- Known Issues Prevention
- Issue #1: Context Window Validation Changed to Tokens (February 2025)
- Issue #2: Neuron Consumption Discrepancies in Dashboard
- Issue #3: AI Binding Requires Remote or Latest Tooling in Local Dev
- Issue #4: Flux Image Generation NSFW Filter False Positives
- Issue #5: Image Generation Error 1000 - Missing numsteps Parameter
- Issue #6: Zod v4 Incompatibility with Structured Output Tools
- Issue #7: AI Gateway Cache Headers for Per-Request Control
- API Reference
- Model Selection Guide (Updated 2025)
- Text Generation (LLMs)
- Text Embeddings (2x Faster - 2025)
- Image Generation
Option 2: Update to latest tooling npm install -D @cloudflare/vite-plugin@latest Option 3: Use wrangler dev instead of custom Miniflare npm run dev Install Zod v3 specifically npm install zod@3 Or pin in package.json npx wrangler --version rm -rf ~/.wrangler npm install -D wrangler@latest
What does the cloudflare-workers-ai skill do?
Run LLMs and AI models on Cloudflare's GPU network with Workers AI. Includes Llama 4, Gemma 3, Mistral 3.1, Flux images, BGE embeddings, streaming, and AI Gateway. Handles 2025 breaking changes. Prevents 7 documented errors. Use when: implementing LLM inference, images, RAG, or troubleshooting AI_ERROR, rate limits, max_tokens, BGE pooling, context window, neuron billing, Miniflare AI binding, NSFW filter, num_steps.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill cloudflare-workers-ai-brendadeeznuts1111-tier-1380-omega --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
