alepha@docs:~/docs/.content/release/framework/docs/packages/alepha/ai$
cat cloudflare.md | pretty
2 min read
Last commit:

#Alepha - Ai Cloudflare

#Installation

Part of the alepha package. Import from alepha/ai/cloudflare.

npm install alepha

#Overview

Plugin for Alepha AI that runs models on the Workers AI binding (env.AI): no API key, no HTTP.

On Workers, registering it makes WorkersAiProvider the AiProvider, and the Cloudflare build declares the ai binding. Off Workers (yarn dev on Node, the specs) it registers only the binding declaration, so the provider is whatever the next vendor module substitutes (AlephaAiOpenai on Workers AI's REST endpoint reaches the same models), or MemoryAiProvider without one.

⚠️ Register it BEFORE another vendor module: the first substitution wins, which is what lets the binding answer on Workers and the other vendor everywhere else.

#API Reference

#Providers

  • WorkersAiProvider - AI provider on the Workers AI binding (env.AI.run): no API key, no

#Environment Variables

Environment variables used to configure this module. These can be set in your .env file or through your deployment configuration.

Variable Type Default Description
AI_BINDING text AI Name of the Workers AI binding (env.AI) the Workers AI provider calls. The Cloudflare build declares it under this name.
AI_GATEWAY_ID text - Optional Cloudflare AI Gateway id the binding routes its calls through, for logs, caching and rate limits.