Skip to content

Version Packages#395

Merged
threepointone merged 2 commits intomainfrom
changeset-release/main
Feb 11, 2026
Merged

Version Packages#395
threepointone merged 2 commits intomainfrom
changeset-release/main

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented Feb 11, 2026

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@cloudflare/tanstack-ai@0.1.0

Minor Changes

  • #389 a4b756e Thanks @vaibhavshn! - Add @cloudflare/tanstack-ai — adapters for using TanStack AI with Cloudflare Workers AI and AI Gateway.

    Workers AI adapters

    All Workers AI adapters support four configuration modes: plain binding (env.AI), plain REST (account ID + API key), AI Gateway binding (env.AI.gateway(id)), and AI Gateway REST (account ID + gateway ID).

    • Chat (createWorkersAiChat) — Streaming chat completions via the OpenAI-compatible API. Includes tool calling with full round-trip support, structured output via json_schema, and reasoning text streaming (STEP_STARTED/STEP_FINISHED AG-UI events) for models like QwQ, DeepSeek R1, and Kimi K2.5. A custom fetch shim translates OpenAI SDK calls to env.AI.run() for binding mode, with a stream transformer that handles both Workers AI native format and OpenAI-compatible format.
    • Image generation (createWorkersAiImage) — Stable Diffusion and other text-to-image models.
    • Transcription (createWorkersAiTranscription) — Speech-to-text via Whisper and Deepgram Nova-3.
    • Text-to-speech (createWorkersAiTts) — Audio generation via Deepgram Aura-1.
    • Summarization (createWorkersAiSummarize) — Text summarization via BART-large-CNN.
    • Embeddings (createWorkersAiEmbedding) — Text embeddings (implemented but not yet exported, pending TanStack AI's BaseEmbeddingAdapter).

    AI Gateway adapters (third-party providers)

    Route requests through Cloudflare AI Gateway for caching, rate limiting, and unified billing. Each adapter injects a custom fetch (or httpOptions for Gemini) that handles both binding and credential-based gateway configurations.

    • OpenAI — Chat, summarize, image, transcription, TTS, video (createOpenAi*)
    • Anthropic — Chat, summarize (createAnthropic*)
    • Gemini — Chat, summarize, image, TTS (createGemini*). Credentials-only (Google GenAI SDK lacks custom fetch support).
    • Grok — Chat, summarize, image (createGrok*)
    • OpenRouter — Chat, summarize, image (createOpenRouter*). Accepts any model string.

    Utilities

    • createGatewayFetch — Shared fetch factory that routes requests through AI Gateway (binding or REST), with support for cache control headers (skipCache, cacheTtl, customCacheKey, metadata).
    • createWorkersAiBindingFetch — Fetch shim that makes env.AI look like an OpenAI endpoint, including stream transformation and tool call ID sanitization for the binding's strict [a-zA-Z0-9]{9} validation.
    • Config detection helpers (isDirectBindingConfig, isDirectCredentialsConfig, isGatewayConfig) using structural typing to discriminate env.AI from env.AI.gateway(id).
    • Shared binary utilities for normalizing Workers AI responses (Uint8Array, ArrayBuffer, ReadableStream, JSON wrapper) to base64.

    Robustness

    • Premature stream termination detection — if Workers AI truncates a response or the connection drops (no finish_reason), the adapter emits proper closing events so consumers don't hang.
    • Graceful non-streaming fallback — if a model returns a complete response despite stream: true, the binding shim wraps it into a valid response.
    • Deepgram Nova-3 transcription uses raw binary audio via REST (not JSON), automatically detected by model name.

    Testing

    • Comprehensive unit tests (186 tests) covering all adapters, config modes, stream transformation, message building, tool calling, reasoning events, premature termination, and public API surface.
    • E2E integration tests against real Workers AI APIs (both binding and REST paths) across 12 chat models + 4 transcription models + image/TTS/summarize, validating chat, multi-turn, tool calling, tool round-trips, structured output, reasoning, and all non-chat capabilities.
    • Tree-shakeable package exports with per-adapter entry points for ESM and CJS.

workers-ai-provider@3.1.0

Minor Changes

  • #389 8538cd5 Thanks @vaibhavshn! - Add transcription, text-to-speech, and reranking support to the Workers AI provider.

    New capabilities

    • Transcription (provider.transcription(model)) — implements TranscriptionModelV3. Supports Whisper models (@cf/openai/whisper, whisper-tiny-en, whisper-large-v3-turbo) and Deepgram Nova-3 (@cf/deepgram/nova-3). Handles model-specific input formats: number arrays for basic Whisper, base64 for v3-turbo via REST, and { body, contentType } for Nova-3 via binding or raw binary upload for Nova-3 via REST.

    • Speech / TTS (provider.speech(model)) — implements SpeechModelV3. Supports Workers AI TTS models including Deepgram Aura-1 (@cf/deepgram/aura-1). Accepts text, voice, and speed options. Returns audio as Uint8Array. Uses returnRawResponse to handle binary audio from the REST path without JSON parsing.

    • Reranking (provider.reranking(model)) — implements RerankingModelV3. Supports BGE reranker models (@cf/baai/bge-reranker-base, bge-reranker-v2-m3). Converts AI SDK's document format to Workers AI's { query, contexts, top_k } input. Handles both text and JSON object documents.

    Bug fixes

    • AbortSignal passthroughcreateRun REST shim now passes the abort signal to fetch, enabling request cancellation and timeout handling. Previously the signal was silently dropped.
    • Nova-3 REST support — Added createRunBinary utility for models that require raw binary upload instead of JSON (used by Nova-3 transcription via REST).

    Usage

    import { createWorkersAI } from "workers-ai-provider";
    import {
      experimental_transcribe,
      experimental_generateSpeech,
      rerank,
    } from "ai";
    
    const workersai = createWorkersAI({ binding: env.AI });
    
    // Transcription
    const transcript = await experimental_transcribe({
      model: workersai.transcription("@cf/openai/whisper-large-v3-turbo"),
      audio: audioData,
      mediaType: "audio/wav",
    });
    
    // Speech
    const speech = await experimental_generateSpeech({
      model: workersai.speech("@cf/deepgram/aura-1"),
      text: "Hello world",
      voice: "asteria",
    });
    
    // Reranking
    const ranked = await rerank({
      model: workersai.reranking("@cf/baai/bge-reranker-base"),
      query: "What is machine learning?",
      documents: ["ML is a branch of AI.", "The weather is sunny."],
    });

@github-actions github-actions Bot force-pushed the changeset-release/main branch from f246039 to 1238b05 Compare February 11, 2026 20:53
@github-actions github-actions Bot force-pushed the changeset-release/main branch from 1238b05 to a1826a3 Compare February 11, 2026 21:03
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Feb 11, 2026

Open in StackBlitz

npx https://pkg.pr.new/cloudflare/ai/ai-gateway-provider@395
npx https://pkg.pr.new/cloudflare/ai/@cloudflare/tanstack-ai@395
npx https://pkg.pr.new/cloudflare/ai/workers-ai-provider@395

commit: 896137c

@threepointone threepointone merged commit 122eae6 into main Feb 11, 2026
3 checks passed
@threepointone threepointone deleted the changeset-release/main branch February 11, 2026 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant