workers-ai

workers-ai is a skill for Claude Code from null-shot/cloudflare-skills. It costs 54 tokens per session (3,127 once invoked), scanned A, original, from a forked repository, Apache-2.0.

A skill for running language models and related AI tasks at the edge with Cloudflare Workers AI and the OpenAI SDK. It covers text generation, structured data extraction, chat, moderation, embeddings, and retrieval-based applications.

In plain words
What is it for?
Building AI-powered applications that generate or extract text, stream chat responses, create embeddings for search, moderate content, or use AI Gateway with Workers AI.
Why use it?
It provides setup and implementation guidance for adding AI features without assembling the integration from scratch.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the cloudflare plugin — 19 skills, 2 commands shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/null-shot/cloudflare-skills/workers-ai
Any agent
npx skills add null-shot/cloudflare-skills --skill workers-ai
Clone the repo
git clone --depth 1 https://github.com/null-shot/cloudflare-skills

Made for: Claude Code.

Or install cloudflare, the plugin that ships this one along with the rest of its 19 skills, 2 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for workers-ai

README.md
[![agentmods](https://agentmods.dev/badge/skills/null-shot/cloudflare-skills/workers-ai.svg)](https://agentmods.dev/skills/null-shot/cloudflare-skills/workers-ai)
Your own site
<a href="https://agentmods.dev/skills/null-shot/cloudflare-skills/workers-ai"><img src="https://agentmods.dev/badge/skills/null-shot/cloudflare-skills/workers-ai.svg" alt="Measured on agentmods" height="20"></a>
Per session 54 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,127 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin fork From a forked repository.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00054 $0.03127
Opus 5 $0.00027 $0.01563
Sonnet 5 $0.00011 $0.00625
Haiku 4.5 $0.00005 $0.00313

Measured 5d ago against content hash 384b29f86d58, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

workers-ai scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (test-models-list.ts), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

async fetch(request: Request, env: Env) {
workers-ai/SKILL.md · 469 lines

How it starts

The opening of the file, as written. The whole thing — 469 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Workers AI

Run AI inference at the edge using Workers AI and industry-standard SDKs like OpenAI. Deploy LLM-powered applications with structured outputs, streaming responses, and AI Gateway integration.

FIRST: Installation

npm install openai

Optional dependencies for advanced use cases:

npm install ai @ai-sdk/openai  # For streaming with Vercel AI SDK

When to Use

Use Case Description
Text Generation Generate content, summaries, translations
Structured Extraction Extract structured data from unstructured text
Chat Interfaces Build conversational AI applications
Content Moderation Analyze and filter user-generated content
Embeddings Generate vector embeddings for semantic search
RAG Pipelines Combine with Vectorize for retrieval-augmented generation

Quick Reference

Task API
Structured JSON output response_format: { type: 'json_schema', schema }
JSON mode (parse yourself) response_format: { type: 'json_object' }
Stream responses Use Vercel AI SDK's streamText()
Enable AI Gateway Set baseUrl in OpenAI client config
Generate embeddings client.embeddings.create({ model, input })

Structured JSON Outputs

Workers AI supports structured JSON outputs using the OpenAI SDK's response_format API. This ensures the model returns data matching your schema.

import { OpenAI } from "openai";

interface Env {
  OPENAI_API_KEY: string;
}

// Define your JSON schema
const CalendarEventSchema = {
  type: 'object',
  properties: {
    name: { type: 'string' },
    date: { type: 'string' },
    participants: { type: 'array', items: { type: 'string' } },
  },
  required: ['name', 'date', 'participants']
};

export default {
  async fetch(request: Request, env: Env) {
    const client = new OpenAI({
      apiKey: env.OPENAI_API_KEY,
    });

    const response = await client.chat.completions.create({
      model: 'gpt-4o-2024-08-06',
      messages: [
        { role: 'system', content: 'Extract the event information.' },
        { role: 'user', content: 'Alice and Bob are going to a science fair on Friday.' },
      ],
      // Request structured JSON output with schema validation
      response_format: {
        type: 'json_schema',
        schema: CalendarEventSchema,
      },
    });

    // Parsed according to your schema
    const event = response.choices[0].message.parsed;

    return Response.json({
      calendar_event: event,
    });
  }
}

Read the full file on GitHub · 469 lines

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 469 lines · 54 tokens per session scan A 384b29f86d58

Subscribe to this mod's changes

workers-ai is a skill published in the GitHub repository null-shot/cloudflare-skills (0 stars, last pushed 7mo ago), licensed Apache-2.0. It adds 54 tokens to every session and 3,127 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). It comes from a forked repository.

Related

Other skills, from other repositories

gemini-api-agent-platform

Guides the usage of the Gemini API on Agent Platform with the Google Gen AI SDK for enterprise AI applications. Covers SDK usage (Python, JS/TS, Go, Java, C#), capabilities like Live API, tools, multimedia generation, caching, and batch prediction.

davila7/claude-code-templates · 61 tokens

open-source

Documentation reference for writing Python code using the browser-use open-source library. Use this skill whenever the user needs help with Agent, Browser, or Tools configuration, is writing code that imports from browseruse, asks about @sandbox deployment, supported LLM models, Actor API, custom tools, lifecycle…

browser-use/browser-use · 137 tokens

gemini-api-dev

Use this skill when writing code that calls the Gemini API for text generation, multi-turn chat, multimodal understanding, image generation, video generation, streaming responses, background research tasks, function calling, structured output, or migrating from the old generateContent API. Covers SDK usage and best…

google-gemini/gemini-skills · 73 tokens

deepstream-sop

Use this skill when building, deploying, evaluating, debugging, or measuring latency for the DeepStream SOP Inference Microservice — a GPU-accelerated FastAPI service that detects whether operators perform assembly-line steps in order via event boundary detection (GEBD) plus VLM classification. Trigger even if the…

NVIDIA/skills · 219 tokens

azure-search-documents-dotnet

Azure AI Search SDK for .NET (Azure.Search.Documents). Use for building search applications with full-text, vector, semantic, and hybrid search. Covers SearchClient (queries, document CRUD), SearchIndexClient (index management), and SearchIndexerClient (indexers, skillsets). Triggers: "Azure Search .NET"…

microsoft/skills · 102 tokens

azure-search-documents-ts

Build search applications using Azure AI Search SDK for JavaScript (@azure/search-documents). Use when creating/managing indexes, implementing vector/hybrid search, semantic ranking, or building agentic retrieval with knowledge bases.

microsoft/skills · 48 tokens