[KongchangAI]
· 2 min read· 1,198 words

AI SDK Batch Update: Workflow Streaming Fixes and Multi-Provider Metadata Alignment

AI SDK Batch Update: Workflow Streaming Fixes and Multi-Provider Metadata Alignment

AI SDK ships coordinated patches focused on streaming data fidelity and model metadata consistency.

The AI SDK ecosystem released a broad patch, with core `ai` at 7.1.1 and dozens of provider and framework packages updated. Changes center on streaming fidelity and metadata consistency: `@ai-sdk/workflow` delegates `toUIMessageChunk` to AI SDK Core to stop losing custom parts, tool metadata, and citations; Anthropic fixes stream interruptions when resumed responses carry server-side tool results in `message_start`, propagating to Bedrock and Vertex; `openai-compatible` fixes cache write token mapping to avoid double-counting as non-cached input; Google adds mid-conversation system instructions and JAILBREAK/image safety categories. Deprecated models are now uniformly declared in catalog entries.

AI SDK release page

The AI SDK ecosystem has rolled out a wide-ranging patch release, with the core ai package bumped to 7.1.1, bringing dozens of provider packages and framework adapters along for the ride. The focus of this release isn't a pile of new features, but rather fixing data fidelity issues in streaming and unifying model capability metadata across providers.

Workflow Package: Streaming Transform Logic Consolidated into Core

The change in @ai-sdk/workflow@2.0.123 is the most noteworthy. Previously, this package maintained its own toUIMessageChunk switch branches; now it delegates directly to the same implementation in AI SDK Core.

This change addresses a long-standing data loss risk. The standalone implementation couldn't cover fields newly added to the core layer, causing custom parts (such as openai.compaction), tool result metadata (preliminary, providerExecuted, providerMetadata, toolMetadata, dynamic), reasoning-file, tool-approval-response, and citation information to be dropped during transformation. With delegation, these are preserved in sync with the core layer.

Error redaction strategy and the sendSources default (false) are now aligned as well. Both toUIMessageChunk and createModelCallToUIChunkTransform now accept and forward four parameters—sendReasoning, sendSources, onError, and redactToolErrors—giving callers more consistent error handling behavior at the UI layer.

Why This Kind of Fix Matters

Debugging streaming UI is costly. Fields silently disappearing along the transformation chain often manifests as "tool call results not showing" or "reasoning missing," and it's hard to trace back to the transformation layer when troubleshooting. Consolidating transformation logic into a single implementation structurally eliminates the source of these discrepancies—a classic case of small change, big payoff.

toUIMessageChunk is the function in AI SDK that converts a model output stream into UI message chunks; its output directly determines what frontend components can render. UI message chunks are structured data with type tags. Common types include text-delta, tool-call, reasoning, source, and custom parts that can carry arbitrary custom payloads. When the transformation function doesn't recognize a field, it silently skips it rather than throwing an error, so metadata loss doesn't raise an exception at runtime—it just manifests as missing content in the UI. This is why consolidating transformation logic into a single implementation is more reliable than patching branches individually—once the core layer adds a new field type, all delegating parties automatically gain support.

Anthropic Provider: Fix for Streaming Interruption in Resumed Responses

@ai-sdk/anthropic@4.0.115 handles a specific edge case: streaming fails when a resumed Anthropic response includes server-side tool results in the message_start content.

The fix treats these results as independent content blocks, preserving tool results and citation sources. The fix propagates to packages that depend on the Anthropic implementation, including @ai-sdk/amazon-bedrock, @ai-sdk/anthropic-aws, @ai-sdk/google-vertex, and @ai-sdk/minimax.

Anthropic Messages API streaming responses are returned as event sequences, with message_start being the first event, typically containing only message ID, role, and initial usage info. A "resumed response" refers to continuing generation from an existing message after a streaming session is interrupted; in this case, message_start may carry server-side tool call results produced earlier. If the client parses under the assumption that "message_start only contains metadata," encountering embedded content blocks causes parsing to fail and the stream to break. Treating server-side tool results as independent content blocks amounts to relaxing that assumption, allowing the resume path and the initial request path to share the same content block parsing logic.

Google Provider: Mid-Conversation System Instructions and Safety Category Expansion

@ai-sdk/google@4.0.133 brings three changes. First, it supports mid-conversation system instructions and function tool updates in the Google Interactions API, preserving system message position via system_input steps while keeping baseline instructions and tool definitions stable for prompt caching. Second, it adds HARM_CATEGORY_JAILBREAK and HARM_CATEGORY_IMAGE_* categories to safetySettings[].category. Third, it declares deprecated models directly in catalog entries, replacing separate model ID lists or comments, while preserving historical capabilities and model ID compatibility.

Unifying How Deprecated Models Are Declared

The third change also appears in @ai-sdk/openai and @ai-sdk/mistral. Writing deprecation info in catalog entries rather than maintaining a side-channel list reduces inconsistencies from forked data sources. @ai-sdk/mistral and @ai-sdk/togetherai also aligned model availability and feature limitation metadata based on December capability audit results.

openai-compatible: Billing Semantics for Cache Write Tokens

@ai-sdk/openai-compatible@3.0.100 corrects the token statistics mapping: it maps prompt_tokens_details.cache_write_tokens to inputTokens.cacheWrite and deducts cache write tokens from inputTokens.noCache.

This change directly affects applications that rely on token breakdowns for cost accounting. Previously, cache writes were double-counted as non-cached input, inflating usage statistics; after the fix, billing semantics match actual caching behavior. The fix propagates through dependency relationships to a range of compatible implementations including Bedrock, Azure, Cerebras, DeepInfra, Fireworks, HuggingFace, and Tencent.

In OpenAI-compatible usage statistics, prompt_tokens_details splits input tokens into several sub-items: cached_tokens represents tokens that hit the prompt cache, and cache_write_tokens represents tokens written to cache in this request. AI SDK's normalized usage object expresses total input via inputTokens and subdivides it into cacheRead, cacheWrite, and noCache. Semantically, these three should be mutually exclusive and sum to the total input. Tokens written to cache belong simultaneously to "has cache behavior" and "not read" categories; if only cacheRead is deducted from the total during mapping, cacheWrite gets counted into noCache as well, causing double counting. Different providers are inconsistent about whether cache writes are billed separately, so this mapping step must follow the principle of "no duplication, no omission" rather than reusing the deduction logic from the read path.

Core Package and Other Adapters

ai@7.1.1 itself adds a read-only settings getter to ToolLoopAgent, making it easier to inspect agent configuration at runtime. Also updated around the core package are adapter layers for React, Vue, Svelte, RSC, LangChain, LlamaIndex, OTel, and the @ai-sdk/harness series of wrapper packages for coding agents like Claude Code, Codex, Cursor, and GitHub Copilot.

From the release structure, this is a typical monorepo coordinated patch: individual provider behavior fixes propagate automatically up through the dependency chain to framework and tooling packages. Despite the many version bumps, the substantive changes center on two main threads—streaming fidelity and metadata consistency.

Upgrade Recommendations

If your project uses the Workflow package for streaming UI, or does token cost accounting via the openai-compatible series, we recommend prioritizing this patch. Projects using Anthropic's resume capability or the Google Interactions API should also upgrade in sync to avoid known streaming interruption and missing safety category issues. The remaining packages are dependency-driven updates and can follow your regular release cadence.

One-line Summary

AI SDK releases coordinated patches focused on streaming data fidelity and model metadata consistency.

Paragraph Summary

The AI SDK ecosystem has released a wide-ranging patch, with the core ai package bumped to 7.1.1 and dozens of provider and framework adapter packages updated in sync. The substantive changes center on two main threads: streaming fidelity and metadata consistency. @ai-sdk/workflow now delegates toUIMessageChunk to the AI SDK Core implementation, fixing the loss of custom parts, tool metadata, and citations during transformation; the Anthropic provider fixes streaming interruption when resumed responses contain server-side tool results in message_start, propagating to Bedrock, Vertex, and other packages; openai-compatible corrects cache write token mapping to avoid double-counting as non-cached input and inflating usage statistics; the Google provider supports mid-conversation system instructions and function tool updates and adds JAILBREAK and image safety categories. Deprecated models are now uniformly declared in catalog entries.

#AI SDK#streaming#Workflow#Anthropic#openai-compatible#token billing#metadata
Share:

Related articles