Version Packages#591
Merged
Merged
Conversation
0fe632b to
9162d08
Compare
9162d08 to
ec1d54b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
ai-gateway-provider@3.2.0
Minor Changes
#590
fe0d182Thanks @threepointone! - New gateway options, plus the provider routing table andcf-aig-*headerbuilding are now shared with the
workers-ai-providerAI Gateway delegate(bundled inline — no new dependency), so the two stay in lockstep.
AiGatewayOptionsgains two universal-endpoint controls:byokAlias(
cf-aig-byok-alias, select a stored BYOK key by alias) andzdr(
cf-aig-zdr, per-request Zero Data Retention override for Unified Billing).cf-aig-cache-ttl/cf-aig-skip-cacheheader names instead of the upstream-deprecated
cf-cache-ttl/cf-skip-cache.not generally available yet while the AI Gateway resume backend rolls out;
treat as experimental): pass
resume(
{ binding: env.AI, gateway, onResumeExpired?, maxReconnects? }) and astreaming run that surfaces a
cf-aig-run-idwill transparently reconnect on atransient mid-stream drop, reusing the same resumable-stream engine as the
workers-ai-providerdelegate. No-op on the REST/API-key path and onnon-streaming calls.
retriesoption type is renamedAiGatewayReties→AiGatewayRetries; the old name stays exported as a deprecated alias, so thisis non-breaking.
Existing behavior is otherwise unchanged.
@cloudflare/tanstack-ai@0.2.0
Minor Changes
#590
fe0d182Thanks @threepointone! - - Add resumable streaming to the Workers AI adapter (coming soon — notgenerally available yet while the AI Gateway resume backend rolls out; treat as
experimental): catalog models dispatch through the AI Gateway run path, so
transient mid-stream drops reconnect transparently via
cf-aig-run-id.Configure with
resume/onResumeExpired(no-op + warning where no run id isavailable, e.g. REST).
graceful-degradation, now shared with
workers-ai-provider.@tanstack/aiand the@tanstack/ai-*adapter peers to current versions(adapts to the multimodal
MediaPromptAPI).@ai-sdk/*is intentionally notbumped.
#594
12fb307Thanks @threepointone! - Retry transient Workers AI failures and normalize errors across every adapter.(e.g. "out of capacity"
3040→429, "no such model"5007→400) so theOpenAI SDK's status-based retry engages and honors
Retry-After. Aborts andunrecognized errors propagate untouched. Non-OK gateway run-path responses are
returned verbatim instead of being swallowed into an empty completion.
bounded exponential-backoff retry (the OpenAI SDK isn't in play for these) and
normalize binding / REST / gateway failures into a single
WorkersAiRequestErrorcarrying the HTTP
status(and the raw Workers AIcodewhen recognized). Theretry loop honors a server
Retry-Afterheader. Non-OK gateway responses are nolonger swallowed.
maxRetriesoption to the adapter config: forwarded to the OpenAI SDK onthe chat path, and used by the non-chat retry loop. Defaults to
2; set to0to disable.
workers-ai-provider@3.3.0
Minor Changes
#590
fe0d182Thanks @threepointone! - The AI Gateway delegate gains cross-vendor server-side fallback(
fallback: { mode: "server" }) — multiple vendors in one gateway run, with thewinner selected via
cf-aig-step.The gateway delegate now reaches header parity with the run path: the gateway
path forwards
cacheKey,eventId,requestTimeoutMs, andretriesfrom thegateway options as
cf-aig-*headers, andDelegateCallOptionsgains two newuniversal-endpoint controls —
byokAlias(cf-aig-byok-alias, select a storedBYOK key by alias) and
zdr(cf-aig-zdr, per-request Zero Data Retentionoverride for Unified Billing, applied on both transports).
Internally, the provider registry,
cf-aig-*header building, resumable-streamengine, and Workers AI SSE helpers are now shared across the Cloudflare AI
packages (bundled inline — no new dependency for you to install).
#593
1c6afd0Thanks @threepointone! - Native Workers AI failures are now surfaced as AI SDKAPICallErrors so the AISDK's built-in retry (
maxRetries) can engage on transient errors.Previously the binding path (
env.AI.run) threw plainErrors and the RESTpath threw a generic
Error, so the AI SDK never retried them — most notablythe common "out of capacity" failure (internal code
3040, HTTP429) andother 5xx blips just failed the call outright.
env.AI.runare normalized into anAPICallErroracross every Workers AI model — chat, embedding, image, speech,transcription, and reranking. The Workers AI internal error code is parsed from
the message (or a numeric
codeproperty) and mapped to the documented HTTPstatus (e.g.
3040/3036→429,3007/3008→408,5007→400), andAPICallErrorderivesisRetryablefrom that status (retryable on408/409/429/5xx). Unrecognized errors get no status and stay non-retryable
(prior behavior).
AbortError/TimeoutErrorcancellations propagateunchanged.
APICallErrorcarrying the realstatusCode, response headers (soRetry-Afteris honored), and body, insteadof a generic
Error. The error message keeps the sameWorkers AI API error (<status> <statusText>): <body>shape.This means transient capacity/5xx errors are now automatically retried with
exponential backoff by
generateText/streamText(default 2 retries; tune viamaxRetries). SetmaxRetries: 0to opt out.