Skip to main content
skillsFirst-partyReview first Safety Privacy
Cloudflare logo

Cloudflare Workers AI Edge Functions Skill

Run AI inference and serverless functions on Cloudflare Workers AI: call hosted models like Llama, Whisper, and Stable Diffusion through the Workers AI binding, deploy with wrangler, and use D1/R2/KV storage plus the free daily Neuron allocation.

HarnessClaude CodeCodexWindsurfGeminiCursorCLI
Level:advancedType:generalVerified:draft
Review first review before installing

Open the source and read safety notes before installing.

Citation facts

Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.

Source URLs
https://developers.cloudflare.com/workers-ai/, https://github.com/JSONbored/awesome-claude/blob/main/content/skills/cloudflare-workers-ai-edge.mdx
Brand
Cloudflare
Brand domain
cloudflare.com
Brand asset source
brandfetch
Package URL
/downloads/skills/cloudflare-workers-ai-edge.zip
Package SHA256
8cf522b452d3699ef4bc63ebfb8e326609b053e7c7234a44aef1b2b2adeee6d8
Safety notes
Deploying with wrangler writes Workers and bindings to your Cloudflare account; review what you deploy, since it serves live traffic., Running Workers AI models consumes paid Neurons beyond the free daily allocation; set usage expectations before deploying inference at scale.
Privacy notes
Requests sent to Workers AI models are processed on Cloudflare's network; review what data your function forwards to the model., Keep Cloudflare API tokens in wrangler's secret store or environment variables, never hard-coded or committed.
Platform compatibility
claude-code (native-skill), codex (native-skill), windsurf (native-skill), gemini (native-skill), cursor (adapter), cli (manual-context)
Author
JSONbored
Claim status
unclaimed
Last verified
2025-10-16

Decision playbook

Ready to evaluate for your workflow

Signals are comparatively strong, but you should still validate source, privacy posture, and package provenance for your environment.

Compare context
Selected

0

Current score

96

Baseline

Delta

No baseline selected

No major trust-signal divergence detected in the current selection.

Source and provenance checks

Complete

Confirm ownership and provenance before trusting install instructions.

  • Source link availableRequired

    Open the canonical repository and verify ownership.

    Done
  • Source provenance statusRequired

    Marked as first-party.

    Done
  • Metadata reviewed

    Registry metadata indicates a reviewed listing.

    Done

Safety and privacy checks

Complete

Validate risk disclosures before installation or API wiring.

  • Safety notes presentRequired

    Review the listed safety guidance before running commands.

    Done
  • Privacy notes presentRequired

    Review data handling notes before connecting accounts or secrets.

    Done
  • Trust level risk gateRequired

    Trust level does not block evaluation.

    Done

Package and install checks

Complete

Check package metadata and artifact integrity signals.

  • Install payload available

    Install or copy payload is available for review.

    Done
  • Package verification flag

    Package marked verified.

    Done
  • Checksum metadata

    SHA-256 hash is present.

    Done

Compare-driven decision checks

Needs review

Use compare context to validate trade-offs before adoption.

  • Compare tray has multiple entries

    Add at least one more entry to compare trust differences.

    Pending
  • Baseline comparison available

    No baseline peer selected yet.

    Pending
  • Diverging trust signals identified

    No major trust-signal divergence found.

    Pending

Setup at a glance

Package install

Copy-ready — paste the snippet to get started.

Install command

Provided

Config snippet

Not provided

Copy snippet

Provided

Prerequisites

6 to clear

Platforms

6 listed

Difficulty

100/100

Adoption plan

Balanced adoption plan

Current risk score 0/100. Use staged verification before broader rollout.

Risk 0

Pre-adoption checks

Validate source and review signals before any execution.

  • Confirm source provenanceRequired

    Source URL/provenance metadata is present.

    Done
  • Confirm metadata review state

    Listing has review metadata.

    Done
  • Verify install payload

    Install/config payload exists and can be inspected.

    Done

Security checks

Confirm safety, privacy, and package integrity signals.

  • Review safety notesRequired

    Safety notes are present.

    Done
  • Review privacy notesRequired

    Privacy notes are present.

    Done
  • Verify package integrity metadata

    Package verification/checksum metadata is available.

    Done

Rollout

Adopt in controlled steps based on the selected plan.

  • Run in isolated sandbox firstRequired

    Use a constrained sandbox and observe behavior across multiple tasks.

    Pending
  • Roll out graduallyRequired

    Roll out to a small cohort before wider usage.

    Pending
  • Set monitoring and fallback

    Define rollback path and monitor errors after adoption.

    Pending

Evidence readiness

Evidence readiness matrix · balanced

Required evidence gates are covered (6/6 signals complete).

Risk 0

Source provenance

Present

Source repository/provenance is listed.

Required in this preset

Metadata review

Present

Review metadata is present.

Required in this preset

Safety notes

Present

Safety notes are present.

Required in this preset

Privacy notes

Present

Privacy notes are present.

Optional in this preset

Package integrity

Present

Package integrity metadata is present.

Optional in this preset

Install payload

Present

Install payload is available.

Required in this preset

Required evidence gates are covered for this preset.

Decision timeline

Decision timeline · balanced

6/6 steps complete with no blocking gaps for this preset.

Risk 0

triage

Confirm source provenanceRequired

Source/provenance metadata is available.

Done

triage

Check metadata review statusRequired

Review metadata is available.

Done

verify

Review safety notesRequired

Safety notes are available.

Done

verify

Review privacy notes

Privacy notes are available.

Done

verify

Validate package integrity metadata

Package integrity metadata is available.

Done

rollout

Verify install payload and commandsRequired

Install payload is available.

Done

No required blockers for this timeline preset.

Prerequisite readiness

Prerequisite readiness

6 prerequisites to line up before setup. Have accounts and credentials ready first.

0/6 ready
Account & credentials3Install & runtime2General1

Safety & privacy surface

Safety & privacy surface

2 safety and 2 privacy notes across 4 risk areas. Review closely: credentials & tokens, network access.

4 areas
  • SafetyGeneralDeploying with wrangler writes Workers and bindings to your Cloudflare account; review what you deploy, since it serves live traffic.
  • SafetyExecution & processesRunning Workers AI models consumes paid Neurons beyond the free daily allocation; set usage expectations before deploying inference at scale.
  • PrivacyNetwork accessRequests sent to Workers AI models are processed on Cloudflare's network; review what data your function forwards to the model.
  • PrivacyCredentials & tokensKeep Cloudflare API tokens in wrangler's secret store or environment variables, never hard-coded or committed.

Safety notes

  • Deploying with wrangler writes Workers and bindings to your Cloudflare account; review what you deploy, since it serves live traffic.
  • Running Workers AI models consumes paid Neurons beyond the free daily allocation; set usage expectations before deploying inference at scale.

Privacy notes

  • Requests sent to Workers AI models are processed on Cloudflare's network; review what data your function forwards to the model.
  • Keep Cloudflare API tokens in wrangler's secret store or environment variables, never hard-coded or committed.

Prerequisites

  • Cloudflare account
  • Wrangler CLI 3.0+
  • Node.js 18+
  • @cloudflare/workers-types
  • Cloudflare account with Workers AI enabled (available on Free and Paid plans)
  • Wrangler CLI authentication configured (wrangler login) for deployment access

Schema details

Install type
package
Reading time
6 min
Difficulty score
100
Troubleshooting
Yes
Breaking changes
No
Package metadata
Package verified
Yes
SHA-256
8cf522b452d3699ef4bc63ebfb8e326609b053e7c7234a44aef1b2b2adeee6d8
Skill and platform metadata
Skill type
general
Skill level
advanced
Verification
draft
Verified at
2025-10-16
Retrieval sources
https://developers.cloudflare.com/workers-ai/https://sdk.vercel.ai/docshttps://replicate.com/docs
Tested platforms
ClaudeCodexOpenClawCursorWindsurfGemini
PlatformSupportInstall path
claude-codeNative.claude/skills/<skill-name>/SKILL.md
codexNative.agents/skills/<skill-name>/SKILL.md
windsurfNative.windsurf/skills/<skill-name>/SKILL.md
geminiNative.gemini/skills/<skill-name>/SKILL.md or .agents/skills/<skill-name>/SKILL.md
cursorAdapter.cursor/rules/<skill-name>.mdc
cliManualAGENTS.md or tool-specific context file
Full copyable content
export interface Env {
  AI: any;
}

export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    if (request.method !== 'POST') {
      return new Response('Method not allowed', { status: 405 });
    }

    const { messages } = await request.json<{ messages: any[] }>();

    const response = await env.AI.run('@cf/meta/llama-2-7b-chat-int8', {
      messages: [
        { role: 'system', content: 'You are a helpful assistant.' },
        ...messages,
      ],
      stream: true,
    });

    return new Response(response, {
      headers: {
        'content-type': 'text/event-stream',
        'cache-control': 'no-cache',
      },
    });
  },
};

About this resource

Run AI inference and serverless functions on Cloudflare Workers AI. Call hosted open-source models such as Llama, Whisper, and Stable Diffusion through the Workers AI binding, with pay-per-use Neuron pricing (including a free daily allocation), integrated D1/R2/KV storage, and deployment to Cloudflare's global edge network.

Content

Cloudflare Workers AI Edge Functions Skill

What This Skill Enables

Claude can build and deploy AI-powered serverless functions on Cloudflare's global edge network. Workers run on V8 isolates (no per-request cold start), and the Workers AI binding (env.AI.run) gives functions direct access to Cloudflare's catalog of hosted models, bringing inference close to users worldwide.

Compatibility

Native

  • Claude Code / Claude: native skill usage via SKILL.md.
  • Codex/OpenAI workflows: compatible with Agent Skills-style SKILL.md content as reusable workflow instructions.

Manual Adaptation

  • Gemini CLI: native skill usage via .gemini/skills/<skill-name>/SKILL.md or .agents/skills/<skill-name>/SKILL.md where supported.
  • Cursor: use the generated .cursor/rules/*.mdc adapter for project rules.
  • OpenClaw and similar agents: use the same skill content as a reusable prompt/workflow file when native skill import is unavailable.

Prerequisites

Required:

  • Claude Pro subscription or Claude Code CLI
  • Cloudflare account (free tier available)
  • Wrangler CLI installed (npm install -g wrangler)
  • Basic understanding of JavaScript/TypeScript

What Claude handles automatically:

  • Writing Workers code with TypeScript types
  • Configuring wrangler.toml for deployments
  • Implementing AI model bindings (Llama-2, Whisper, Stable Diffusion)
  • Setting up D1 database and R2 storage integrations
  • Managing environment variables and secrets
  • Deploying to Cloudflare's edge network
  • Optimizing for V8 isolate performance

How to Use This Skill

Deploy a Basic Edge Function

Prompt: "Create a Cloudflare Worker that responds to HTTP requests with JSON data and deploys to the edge."

Claude will:

  1. Generate a Worker with proper fetch event handler
  2. Create wrangler.toml configuration
  3. Set up TypeScript types for Request/Response
  4. Add error handling and CORS headers
  5. Deploy with wrangler publish
  6. Provide the deployed Worker URL

AI Model Integration (Llama-2 Chat)

Prompt: "Build a Cloudflare Worker that uses Llama-2 to generate chat responses. Accept POST requests with user messages and stream the AI responses back."

Claude will:

  1. Configure AI binding in wrangler.toml
  2. Implement streaming response with ReadableStream
  3. Add proper prompt formatting for Llama-2
  4. Set up rate limiting to control costs
  5. Include request validation and error handling
  6. Deploy with Workers AI binding enabled

Image Generation with Stable Diffusion

Prompt: "Create an edge function that generates images using Stable Diffusion XL. Accept a text prompt via API and return the generated image URL stored in R2."

Claude will:

  1. Set up Workers AI binding for Stable Diffusion
  2. Configure R2 bucket for image storage
  3. Implement image generation with proper parameters
  4. Upload generated images to R2 with public URLs
  5. Add caching headers for CDN optimization
  6. Include usage analytics with D1 database

Real-Time Translation API

Prompt: "Build a translation API using Cloudflare Workers AI that detects the source language and translates to the target language. Support 50+ languages with edge caching."

Claude will:

  1. Use Workers AI translation models
  2. Implement language detection
  3. Set up KV namespace for translation caching
  4. Add rate limiting per IP address
  5. Configure CDN cache for common translations
  6. Include usage metrics and error logging

Edge / serverless AI inference compared

Workers AI is one of several ways to run model inference without managing GPUs:

Platform Model hosting Runs at the edge Notable for
Cloudflare Workers AI Built-in model catalog on Cloudflare's network Yes Run inference inside Workers, close to users
Vercel AI SDK Bring-your-own provider via a unified SDK Partial (serverless functions) One API across many model providers
Replicate Hosted API for a large open-model catalog No Run almost any open model via API

Choose Workers AI for low-latency inference co-located with your edge app; the Vercel AI SDK for provider-agnostic app code, or Replicate for breadth of open models behind an API.

Tips for Best Results

  1. Leverage V8 Isolates: Workers use V8 isolates that start in <5ms and use 1/10th the memory of Node.js. Design stateless functions that take advantage of this architecture.

  2. Use Durable Objects for State: For stateful operations (WebSockets, real-time collaboration), request Durable Objects implementation instead of external databases.

  3. Model Selection: Choose appropriate AI models based on latency requirements. Smaller models like Llama-2-7B offer faster inference than larger variants.

  4. Edge Caching: Implement Cache API or KV storage for frequently accessed data to reduce AI inference costs.

  5. Cost Optimization: Workers AI charges per request. Use caching, rate limiting, and request batching to optimize costs.

  6. Geographic Routing: Workers automatically route to the nearest data center. For AI models, consider pinning specific regions for data residency compliance.

Common Workflows

Full-Stack AI Application

"Create a complete AI-powered application on Cloudflare:
1. Workers AI for text generation (Llama-2)
2. D1 database for storing conversations
3. R2 for file uploads and generated content
4. KV for session management and caching
5. Pages for frontend deployment
6. Queue for background job processing
Include TypeScript types and deployment scripts."

Content Moderation API

"Build an edge API that:
1. Accepts text content via POST request
2. Uses Workers AI to detect harmful content
3. Classifies content as safe/unsafe with confidence scores
4. Logs results to D1 database
5. Returns moderation decision in <100ms
6. Handles 10,000 requests per minute"

Smart Image CDN

"Create a Cloudflare Worker that:
1. Intercepts image requests
2. Analyzes image with Workers AI (OCR, object detection)
3. Automatically optimizes images for device/bandwidth
4. Stores optimized versions in R2
5. Serves from edge cache on subsequent requests
6. Includes usage analytics and cost tracking"

Real-Time Sentiment Analysis

"Build a WebSocket-based sentiment analysis service:
1. Accept streaming text via WebSocket
2. Process chunks with Workers AI sentiment model
3. Return real-time sentiment scores
4. Store aggregate results in D1
5. Support 1000 concurrent connections
6. Deploy across all Cloudflare edge locations"

Troubleshooting

Issue: Worker exceeds CPU time limits Solution: Workers have a 50ms CPU time limit on free tier (30s on paid). Optimize by using streaming responses, reducing synchronous processing, or upgrading to Unbound workers for longer execution.

Issue: AI model inference too slow Solution: Use smaller model variants (e.g., Llama-2-7B instead of 13B), implement request queuing with Workers Queue, or cache common responses in KV storage.

Issue: CORS errors when calling from frontend Solution: Add proper CORS headers in Worker response. Ask Claude to include OPTIONS method handler and appropriate Access-Control-* headers.

Issue: Workers AI billing concerns Solution: Implement rate limiting with Durable Objects or KV, cache responses aggressively, use smaller models for simpler tasks, and set up billing alerts in Cloudflare dashboard.

Issue: Cannot access environment variables Solution: Ensure secrets are set with wrangler secret put and bindings are properly configured in wrangler.toml. Access via env.SECRET_NAME in Worker code.

Issue: Cold start latency for complex Workers Solution: Minimize dependencies (Workers bundle size should be <1MB), use dynamic imports for optional features, and consider splitting into multiple Workers for different routes.

Learn More

Features

  • Runs on V8 isolates (no per-request cold start)
  • Hosted models via the Workers AI catalog: Llama, Whisper, Stable Diffusion
  • Deploys to Cloudflare's global edge network
  • Integrated with D1, R2, KV, Queues
  • 50+ open-source AI models in catalog
  • Pay-per-use pricing with 10,000 free Neurons/day
  • Integrated with D1, R2, KV, Queues, Durable Objects
  • Real-time streaming responses with Server-Sent Events (SSE) support for AI model outputs, enabling progressive response delivery and improved user experience for long-running AI operations

Use Cases

  • Edge AI inference with minimal latency
  • Serverless APIs with global distribution
  • Real-time content moderation and analysis
  • Content moderation APIs with real-time classification
  • Multi-language translation services with edge caching
  • AI-powered image generation and processing pipelines

Source citations

Add this badge to your README

Show that Cloudflare Workers AI Edge Functions Skill is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.

Listed on HeyClaude
[![Listed on HeyClaude](https://heyclau.de/badge/skills/cloudflare-workers-ai-edge.svg)](https://heyclau.de/entry/skills/cloudflare-workers-ai-edge)

How it compares

Cloudflare Workers AI Edge Functions Skill side by side with 2 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.

2 trust signals differ across this comparison (Package trust, Source provenance).

Field

Run AI inference and serverless functions on Cloudflare Workers AI: call hosted models like Llama, Whisper, and Stable Diffusion through the Workers AI binding, deploy with wrangler, and use D1/R2/KV storage plus the free daily Neuron allocation.

Open dossier

Expert Cloudflare capability skill for designing workers that combine D1, KV, and R2 with clear consistency, caching, and security boundaries.

Open dossier

Expert OpenNext + Cloudflare capability skill for Next.js on Workers, runtime constraints, cache strategy, and production-safe deploy architecture.

Open dossier
Next steps
Trust
Review statusReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewed
Package trustDiffersPackage verified2025-10-16Package verified2026-04-10Package verified2026-04-10
Source provenanceDiffersSource-backedNo submission linkNo submission link
Submitter
Install riskReview firstLow riskLow risk
Notes Safety Privacy Safety Privacy Safety Privacy
BrandCloudflare logoCloudflareCloudflare logoCloudflareCloudflare logoCloudflare
Categoryskillsskillsskills
Sourcefirst-partyfirst-partyfirst-party
AuthorJSONboredJSONboredJSONbored
Added2025-10-162026-04-102026-04-10
Platforms
Claude CodeCodexWindsurfGeminiCursorCLI
Claude CodeCodexWindsurfGeminiCursorCLI
Claude CodeCodexWindsurfGeminiCursorCLI
Source repo
Safety notesDeploying with wrangler writes Workers and bindings to your Cloudflare account; review what you deploy, since it serves live traffic. Running Workers AI models consumes paid Neurons beyond the free daily allocation; set usage expectations before deploying inference at scale.May produce commands or configuration for live infrastructure, CI, releases, or indexing; test changes in staging or dry-run mode first. Use least-privilege API tokens and review workflow, deploy, DNS, cache, and release changes before applying them to production.May produce commands or configuration for live infrastructure, CI, releases, or indexing; test changes in staging or dry-run mode first. Use least-privilege API tokens and review workflow, deploy, DNS, cache, and release changes before applying them to production.
Privacy notesRequests sent to Workers AI models are processed on Cloudflare's network; review what data your function forwards to the model. Keep Cloudflare API tokens in wrangler's secret store or environment variables, never hard-coded or committed.Inputs can include repository metadata, workflow logs, deployment settings, domain names, analytics exports, and service configuration. Redact tokens, account IDs, private URLs, customer data, and proprietary deployment details before sharing generated reports or prompts.Inputs can include repository metadata, workflow logs, deployment settings, domain names, analytics exports, and service configuration. Redact tokens, account IDs, private URLs, customer data, and proprietary deployment details before sharing generated reports or prompts.
Prerequisites
  • Cloudflare account
  • Wrangler CLI 3.0+
  • Node.js 18+
  • @cloudflare/workers-types
  • Cloudflare account and worker project
  • D1/KV/R2 bindings access
  • Defined data model and SLA targets
  • Next.js codebase and Cloudflare account
  • Wrangler configuration access
  • Deployment environment separation (dev/prod)
Install
npm install -g wrangler
curl -L https://heyclau.de/downloads/skills/cloudflare-workers-d1-kv-r2-capability-pack.zip -o cloudflare-workers-d1-kv-r2-capability-pack.zip && unzip -o cloudflare-workers-d1-kv-r2-capability-pack.zip -d ./cloudflare-workers-d1-kv-r2-capability-pack
curl -L https://heyclau.de/downloads/skills/opennext-cloudflare-capability-pack.zip -o opennext-cloudflare-capability-pack.zip && unzip -o opennext-cloudflare-capability-pack.zip -d ./opennext-cloudflare-capability-pack
Config
Citations
ClaimUnclaimedUnclaimedUnclaimed
Open 3 picks in the interactive comparison tool

Signals

Loading live community signals…

More like this, weekly

A short, calm digest of reviewed Claude resources. Unsubscribe any time.