Packages and examples for building AI-powered applications on Cloudflare. Includes providers for the Vercel AI SDK and TanStack AI, with support for Workers AI and AI Gateway.
| Package | Description | npm |
|---|---|---|
workers-ai-provider |
Workers AI provider for the Vercel AI SDK. Chat, image generation, embeddings, transcription, text-to-speech, and reranking. | |
@cloudflare/tanstack-ai |
Workers AI and AI Gateway adapters for TanStack AI. Chat, image, transcription, TTS, summarization, plus gateway routing for OpenAI, Anthropic, Gemini, Grok, and OpenRouter. | |
ai-gateway-provider |
AI Gateway provider for the Vercel AI SDK. Route requests through Cloudflare's AI Gateway for caching, rate limiting, and observability. |
| Example | Description |
|---|---|
examples/workers-ai |
Full-featured Workers AI playground using the Vercel AI SDK. Demonstrates all 6 capabilities: chat (with tool calling and reasoning), image generation, embeddings, transcription, text-to-speech, and reranking. Supports both binding and REST API modes. |
examples/tanstack-ai |
Multi-provider demo using TanStack AI. Provider-first UI with Workers AI (binding and gateway), OpenAI, Anthropic, Gemini, Grok, and OpenRouter — each with capability sub-tabs for chat, image, summarize, transcription, and TTS. |
The demos/ directory contains additional focused demos for specific patterns — tool calling, structured output, agents, MCP servers, and more. See demos.json for the full list.
# Clone and install
git clone git@github.com:cloudflare/ai.git
cd ai
pnpm install
# Run an example
cd examples/workers-ai
pnpm dev
# Run tests for a package
cd packages/workers-ai-provider
pnpm test
# Run E2E tests (requires Cloudflare credentials)
pnpm test:e2e- Fork or clone the repo, then
pnpm installfrom the root. - Create a branch for your change.
- If your change affects a published package, run
pnpm changesetand describe what changed. - Submit a PR to
main.
This repo uses Changesets. When a PR with changesets merges to main, a "Version Packages" PR is created automatically. Merging that PR bumps versions and publishes to npm.