Skip to content
Docs
ProvidersUpdated 2026-08-20

AI services

Use TanStack AI and Workers AI for text, streaming chat, image, image editing, and speech with deterministic local fallbacks.

Included tasks

The AI service exposes:

  • summarization;
  • translation;
  • streaming chat;
  • image generation;
  • image editing;
  • text-to-speech.

The public /ai playground exercises every contract.

Cloudflare binding

Wrangler declares:

json
{
  "ai": { "binding": "AI" }
}

Production uses Workers AI when the binding is available.

Local deterministic mode

Local development does not require remote Workers AI authentication. Deterministic fallbacks preserve response shapes, provider metadata, streaming events, generated image data, and a playable WAV response for speech.

This is an explicit test implementation, not a silent production fallback.

Streaming chat

The chat route emits AG-UI-compatible server-sent events:

text
RUN_STARTED
TEXT_MESSAGE_START
TEXT_MESSAGE_CONTENT
TEXT_MESSAGE_END
RUN_FINISHED

Clients should treat the stream contract as stable and avoid depending on a vendor-specific payload.

Image providers

The full AI service uses Cloudflare adapters. A dedicated image registry also exposes Cloudflare Workers AI and fal.ai so image infrastructure can be selected independently.

Extending the service

Add a stable task method first, implement the provider behavior second, and preserve deterministic local output for acceptance. Validate request sizes before sending prompts or images to an external provider.

TanStarter SES documentationBuilt with TanStack Start and Content Collections.