Repolode
cloudflare

cloudflare/ai

TypeScript packages and examples for building AI apps on Cloudflare, with providers for the Vercel AI SDK and TanStack AI.

Stars
1,198
Forks
365
Open issues
86
Last commit
19 hours ago

What is it?

cloudflare/ai is a monorepo of npm packages that connect AI application code to Cloudflare's AI services. It provides provider packages for the Vercel AI SDK and TanStack AI, covering Workers AI, AI Gateway, and AI Search.

The packages include workers-ai-provider for chat, image generation, embeddings, transcription, text-to-speech, and reranking; ai-search-provider for uploading files to AI Search and running natural-language search or grounded chat; ai-gateway-provider for routing pre-built models through AI Gateway with caching, retries, and cross-vendor fallback; and @cloudflare/tanstack-ai adapters for Workers AI and AI Gateway.

The repository also contains a Workers AI playground example, a multi-provider TanStack AI demo, and focused demos for tool calling, structured output, agents, and MCP servers.

Key features

  • 01Workers AI provider for the Vercel AI SDK covering chat, images, embeddings, transcription, TTS, and reranking.
  • 02AI Search provider for indexing uploaded files and querying them with natural language.
  • 03AI Gateway provider adding caching, retries, and cross-vendor fallback to AI SDK models.
  • 04TanStack AI adapters for Workers AI and AI Gateway.

Use cases

  • Adding chat or image generation backed by Workers AI to a Vercel AI SDK app.
  • Building search over your own uploaded documents with AI Search.
  • Routing model calls through AI Gateway for caching and fallback between vendors.
  • Using the example playgrounds as a starting point for Workers AI or multi-provider apps.

Quick start

  1. 1

    Clone the repository

    git clone git@github.com:cloudflare/ai.git
  2. 2

    Enter the directory and install dependencies with pnpm

    cd ai && pnpm install
  3. 3

    Run the Workers AI example

    cd examples/workers-ai && pnpm dev

Things to know

  • Packages are built around Cloudflare services such as Workers AI and AI Gateway, so they are tied to that platform.
  • Some features, such as resumable streaming, are marked as coming soon.

Topics

FAQ

What is ai?
TypeScript packages and examples for building AI apps on Cloudflare, with providers for the Vercel AI SDK and TanStack AI. cloudflare/ai is a monorepo of npm packages that connect AI application code to Cloudflare's AI services. It provides provider packages for the Vercel AI SDK and TanStack AI, covering Workers AI, AI Gateway, and AI Search.
Is ai free to use? What license does it have?
ai is open source under the MIT license. Check the license terms before using it in commercial products.
Is ai still maintained?
Actively maintained. The last commit to ai was on Oct 21, 2026.
What can I use ai for?
Adding chat or image generation backed by Workers AI to a Vercel AI SDK app. Building search over your own uploaded documents with AI Search. Routing model calls through AI Gateway for caching and fallback between vendors. Using the example playgrounds as a starting point for Workers AI or multi-provider apps.
How do I install ai?
Clone the repository: git clone git@github.com:cloudflare/ai.git Enter the directory and install dependencies with pnpm: cd ai && pnpm install Run the Workers AI example: cd examples/workers-ai && pnpm dev
Where can I get ai?
The source code and installation instructions are on GitHub: https://github.com/cloudflare/ai

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects