Skip to content

build(deps): bump workers-ai-provider from 2.0.0 to 3.2.1#716

Closed
dependabot[bot] wants to merge 1 commit into
masterfrom
dependabot/npm_and_yarn/workers-ai-provider-3.2.1
Closed

build(deps): bump workers-ai-provider from 2.0.0 to 3.2.1#716
dependabot[bot] wants to merge 1 commit into
masterfrom
dependabot/npm_and_yarn/workers-ai-provider-3.2.1

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Jun 25, 2026

Copy link
Copy Markdown
Contributor

Bumps workers-ai-provider from 2.0.0 to 3.2.1.

Release notes

Sourced from workers-ai-provider's releases.

workers-ai-provider@3.2.1

Patch Changes

workers-ai-provider@3.2.0

Minor Changes

  • #573 4f19489 Thanks @​threepointone! - Add AI Gateway routing for third-party catalog models to createWorkersAI, with capability-driven transport selection, the full provider registry, a bring-your-own-provider wrapper, typed errors, and client/server fallback.

    Experimental. This is a substantial new surface for the package — well beyond its original job of wrapping Workers AI — and several behaviors rely on undocumented AI Gateway internals (the cf-aig-run-id resume buffer, per-provider run-path wire formats). Treat the entire third-party / gateway surface as experimental: the API may change, and provider coverage maturity varies (only the run-catalog providers are live-verified end-to-end). It does not affect the existing stable Workers AI / AI Search APIs.

    createWorkersAI is the single public entry point. Pass an optional providers array (wire-format plugins from the sub-paths below). When set, a "<provider>/<model>" catalog slug passed to the provider (or .chat) is routed through AI Gateway automatically, while @cf/... ids continue to build Workers AI models. Each slug is resolved against a registry of every AI Gateway provider, and the transport is picked from the requested options: the run path (env.AI.run) for resumable streaming (cf-aig-run-id, the default, on the unified-billing run catalog), or the gateway path (env.AI.gateway(id).run([…])) for BYOK providers, server-side fallback, and caching. Incompatible option combinations (e.g. resume: true with fallback.mode: "server", or resume/transport: "run" on a BYOK provider) throw a clear GatewayDelegateError; resume-disabling combinations warn loudly. This is fully additive: leaving providers unset preserves the prior behavior exactly, and passing a catalog slug without it throws a helpful error. The chat factory's settings argument is typed from the model id literal — a "<provider>/<model>" slug autocompletes DelegateCallOptions, while a @cf/... id autocompletes WorkersAIChatSettings. gateway is optional for catalog routing — when unset, requests use the account's "default" AI Gateway; set gateway (here or per call) to target a specific one.

    New sub-path exports:

    • workers-ai-provider/openai, workers-ai-provider/anthropic, workers-ai-provider/google — provider plugins keyed by wire format. One openai plugin serves the OpenAI-compatible long tail (deepseek, xai/grok, groq, mistral, perplexity, cerebras, openrouter, fireworks) plus the unified-catalog chat providers alibaba (Qwen) and minimax. @ai-sdk/openai, @ai-sdk/anthropic, and @ai-sdk/google are optional peer dependencies; install only the ones whose wire formats you use. The openai plugin is required for the run path (see below). Providers whose gateway-path URL isn't reproducible from the shared builder (cohere, baseten, parallel, azure-openai, google-vertex) and provider-native/non-chat providers are bring-your-own-provider only.
    • workers-ai-provider/gatewaycreateGatewayFetch / createGatewayProvider wrap any @ai-sdk/* provider so its traffic flows through AI Gateway (provider id detected from the request URL, or set explicitly). Use it for provider-native or non-chat providers the slug routing can't auto-wire (bedrock, replicate, audio/image), or for full control of the underlying provider.

    The transport types, error classes (WorkersAIGatewayError, WorkersAIFallbackError, GatewayDelegateError), the registry helpers, DelegateCallOptions, and createResumableStream are re-exported from the package root.

    Features:

    • Provider registry (GATEWAY_PROVIDERS, findProviderBySlug, detectProviderByUrl) maps slugs to gateway provider ids, wire formats, billing model, and run-catalog membership. Covers every provider in the AI Gateway directory (OpenAI, Anthropic, Google AI Studio/Vertex, xAI, Groq, DeepSeek, Mistral, Perplexity, Cerebras, OpenRouter, Cohere, Baseten, Parallel, Azure OpenAI, Amazon Bedrock, HuggingFace, Replicate, Fal, Ideogram, Cartesia, Deepgram, ElevenLabs — plus Fireworks), with URL host patterns so createGatewayFetch auto-detects each from the wrapped provider's request URL. Also includes the unified-catalog chat providers alibaba (Qwen) and minimax on the resumable run catalog (verified live: OpenAI-wire, cf-aig-run-id on streams); these are run-path only (gatewayPath: false — not native gateway providers), so caching, server-side fallback, and transport: "gateway" are rejected with a clear GatewayDelegateError instead of failing upstream.
    • Metadata & loggingmetadata (custom log attributes for spend attribution) and collectLog are first-class call options on both transports. On the run path they fold into the typed gateway options; on the gateway path they become cf-aig-metadata / cf-aig-collect-log headers (bigint metadata values are coerced to strings). Call-level metadata merges over (and wins against) any metadata set via gateway: { metadata }.
    • BYOK — set byok: true (+ supply the key via extraHeaders) to forward the upstream provider key on the gateway path; otherwise provider auth headers are stripped so unified billing / the gateway's stored key applies.
    • Client-side fallback (fallback.mode: "client") keeps resume per leg — a failed pre-stream dispatch falls through to the next model; if all fail, a WorkersAIFallbackError carries the per-attempt tree. Server-side fallback (fallback.mode: "server") routes same-vendor fallbacks through the gateway path.
    • Typed errorsWorkersAIGatewayError (with a coarse code, a recoverable hint, and the parsed CF/provider envelope) and WorkersAIFallbackError (attempt tree). Helpers classifyStatus / extractErrorMessage are exported.
    • Abort + gateway options are passed through on both transports.

    On the run path, the response stream is wrapped so a transient mid-stream drop reconnects through the gateway resume endpoint (resume?from=N) transparently — the @ai-sdk parser never sees the break. from is an SSE event index, so the wrapper emits only complete events and realigns on the boundary after a drop (no duplicated or truncated bytes). When the gateway buffer expires (404, ~5.5 min TTL), an onResumeExpired policy controls whether the stream errors ("error", the default) or ends with partial output ("accept-partial").

    For cross-invocation recovery (e.g. a new Durable Object invocation after eviction), createResumableStream is exported and accepts no initial body plus a fromEvent offset — it re-attaches by resuming directly from that event index. An onProgress(eventOffset) callback (also surfaced on the delegate as a call option) reports the live SSE event offset so callers can persist { runId, eventOffset } and re-attach later.

    Run-path wire format (per-provider): on the resumable run path (env.AI.run), Cloudflare's unified catalog normalizes most providers to OpenAI chat-completions wire (so google/… is parsed with the openai plugin on the run path, even though the gateway path uses the native google plugin), but passes Anthropic through natively (content[].text, native tool shape) — so anthropic/… is parsed with the anthropic plugin on both paths. The registry records this as runWireFormat (defaults to "openai"). Include openai for the openai-wire run-path providers (openai, google, xai/grok, groq) and anthropic to use anthropic/…; the delegate throws a clear GatewayDelegateError naming the exact plugin a transport needs if it's missing.

Patch Changes

  • #563 231c19b Thanks @​slegarraga! - Validate file parts in chat messages before sending them to Workers AI.

    Previously every file part in a user message was unconditionally wrapped as an image_url, regardless of its mediaType. Non-image files (e.g. application/pdf, audio/*, video/*, application/octet-stream) were forwarded as if they were valid vision inputs, and a missing mediaType silently defaulted to image/png, producing a corrupt data URL.

    Now convertToWorkersAIChatMessages:

    • throws an UnsupportedFunctionalityError when a file part has a non-image/* mediaType, or no mediaType at all, instead of forwarding

... (truncated)

Commits
  • 73aad61 Merge pull request #586 from cloudflare/changeset-release/main
  • 4c5a40e Version Packages
  • e81a95f Merge pull request #585 from cloudflare/fix/workers-ai-dynamic-routes
  • bbcc4d1 fix(workers-ai-provider): support dynamic gateway routes
  • b02939b fix deps
  • 632e561 Merge pull request #571 from cloudflare/changeset-release/main
  • 86469d8 Version Packages
  • 7810707 Merge pull request #576 from cloudflare/fix/workers-ai-provider-structured-ou...
  • a360e7a fix(workers-ai-provider): preserve structured-output name/description on nati...
  • cd3a1be Merge pull request #575 from cloudflare/fix/workers-ai-provider-forced-tool-c...
  • Additional commits viewable in compare view
Maintainer changes

This version was pushed to npm by GitHub Actions, a new releaser for workers-ai-provider since your current version.


@dependabot dependabot Bot added dependencies Pull requests that update a dependency file javascript Pull requests that update javascript code labels Jun 25, 2026
@mergify

mergify Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@dependabot dependabot Bot force-pushed the dependabot/npm_and_yarn/workers-ai-provider-3.2.1 branch from 32eeb6b to 8de924e Compare June 25, 2026 01:07
Bumps [workers-ai-provider](https://github.com/cloudflare/ai) from 2.0.0 to 3.2.1.
- [Release notes](https://github.com/cloudflare/ai/releases)
- [Commits](https://github.com/cloudflare/ai/compare/workers-ai-provider@2.0.0...workers-ai-provider@3.2.1)

---
updated-dependencies:
- dependency-name: workers-ai-provider
  dependency-version: 3.2.1
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot force-pushed the dependabot/npm_and_yarn/workers-ai-provider-3.2.1 branch from 8de924e to b54f98c Compare June 26, 2026 01:07
@dependabot @github

dependabot Bot commented on behalf of github Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #727.

@dependabot dependabot Bot closed this Jun 30, 2026
@dependabot dependabot Bot deleted the dependabot/npm_and_yarn/workers-ai-provider-3.2.1 branch June 30, 2026 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file javascript Pull requests that update javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants