Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@ragpipe/plugin-cloudflare

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ragpipe/plugin-cloudflare

Cloudflare Workers AI embedding and generation plugin for ragpipe

Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
18
-43.75%
Maintainers
1
Weekly downloads
 
Created
Source

@ragpipe/plugin-cloudflare

Cloudflare Workers AI embedding and generation plugin for ragpipe.

Install

pnpm add ragpipe @ragpipe/plugin-cloudflare

Usage

import { defineConfig } from "ragpipe";
import { cloudflareEmbedding, cloudflareGeneration } from "@ragpipe/plugin-cloudflare";

export default defineConfig({
  embedding: cloudflareEmbedding({
    accountId: process.env.CLOUDFLARE_ACCOUNT_ID!,
    apiToken: process.env.CLOUDFLARE_API_TOKEN!,
    model: "@cf/qwen/qwen3-embedding-0.6b",
  }),
  generation: cloudflareGeneration({
    accountId: process.env.CLOUDFLARE_ACCOUNT_ID!,
    apiToken: process.env.CLOUDFLARE_API_TOKEN!,
    model: "@cf/openai/gpt-oss-20b",
    systemPrompt: "Answer based on the provided context.",
  }),
  // ... vectorStore
});

API

cloudflareEmbedding(options)

Returns an EmbeddingPlugin that calls the Cloudflare Workers AI Embedding API.

OptionTypeDefaultDescription
accountIdstringCloudflare account ID (required)
apiTokenstringCloudflare API token (required)
modelstringEmbedding model name (required)
  • Batch support: embedMany() sends an array of texts in a single API call

cloudflareGeneration(options)

Returns a GenerationPlugin that calls the Cloudflare Workers AI Generation API.

OptionTypeDefaultDescription
accountIdstringCloudflare account ID (required)
apiTokenstringCloudflare API token (required)
modelstringGeneration model name (required)
systemPromptstring"Answer based on the provided context."Default system instruction
  • Streaming: generateStream() returns an AsyncIterable<string> via SSE
  • History: Pass { history } to include conversation context
  • Per-call override: Pass { systemPrompt } at call time to override the default

Get an API Token

  • Go to Cloudflare Dashboard
  • Create a token with Workers AI read permission
  • Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your environment

License

MIT

Keywords

ragpipe

FAQs

Package last updated on 09 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts