[KongchangAI]
· 1 min read· 541 words

Vercel AI SDK Releases @ai-sdk/[email protected] Patch Update

Vercel AI SDK Releases @ai-sdk/openai@4.0.81 Patch Update

AI SDK patch fixes allOf wrapper incompatibility in recursive Zod schemas for OpenAI structured outputs.

`@ai-sdk/[email protected]` is a patch-level maintenance update for Vercel AI SDK, with a single core fix: resolving compatibility issues between recursive Zod schemas using `allOf` wrappers and the OpenAI API. When recursive Zod schemas (e.g., tree structures, self-referencing objects) are converted to JSON Schema, the resulting `allOf` wrapping is rejected by OpenAI's Structured Outputs feature, causing request failures. This update rewrites the conversion logic to eliminate the issue. No breaking changes — safe to upgrade directly.

Version Overview

Vercel's AI SDK project has released @ai-sdk/[email protected]. As a popular open-source project on GitHub with over 27k stars and 5.2k forks, the AI SDK is an essential toolkit for building AI-powered applications, with the @ai-sdk/openai package handling integration with OpenAI models.

This is a patch-level update, pushed to the main branch on September 29 via GitHub Actions automation. The commit's authenticity was verified through GitHub's GPG signature (key ID: B5690EEEBB952194).

rss source: @ai-sdk/openai@4.0.81

Core Fix

This update contains a single key change, focused on Zod schema handling logic. Commit 4e94782 describes the fix as:

fix(openai): rewrite recursive Zod schemas that use allOf wrappers

In short, this rewrites the handling of recursive Zod schemas that use allOf wrappers.

Why This Fix Matters

Zod is a widely used schema validation and type inference library in the TypeScript ecosystem. In the AI SDK, developers typically use Zod to define schemas for structured outputs or tool calling parameters, which the SDK then converts into JSON Schema format that OpenAI can understand.

When a Zod schema contains recursive references (e.g., tree structures, self-referencing nested objects) combined with the allOf keyword, the conversion process can break down — the resulting JSON Schema may not conform to what the OpenAI API expects, leading to failed requests or malformed structured outputs. This patch resolves compatibility issues in these edge cases by rewriting the relevant conversion logic.

allOf in JSON Schema is a composition keyword indicating that data must satisfy all listed sub-schemas simultaneously. When converting certain complex types — especially recursive ones — to JSON Schema, Zod generates structures with allOf wrappers, such as { "allOf": [{ "$ref": "#/$defs/Node" }] } instead of a direct { "$ref": "#/$defs/Node" }. While this "redundant wrapping" is semantically equivalent under the JSON Schema specification, OpenAI's Structured Outputs feature enforces stricter schema formatting requirements — all object fields must list required, additionalProperties is not allowed, and there are specific restrictions on how allOf can be used. When a recursive Zod schema triggers this wrapping pattern, the OpenAI API either rejects the request or returns unexpected output, and developers often struggle to trace the error back to its root cause. This fix addresses the issue by detecting and unwrapping these "redundant allOf wrappers" at the conversion layer, ensuring the generated JSON Schema directly complies with OpenAI's strict mode requirements.

Practical Impact for Developers

For teams that rely on complex data structure definitions in their projects, this fix directly reduces runtime errors. In particular, applications that use recursive schemas to describe hierarchical data — such as directory trees, organizational charts, or nested comment threads — can now avoid schema parsing failures caused by allOf wrapping after upgrading to this version.

Since this is a patch release, it contains no breaking changes. Developers can safely upgrade the dependency in existing projects without any additional migration work.

Summary

@ai-sdk/[email protected] is a typical maintenance release, focused on fixing a conversion bug with recursive Zod schemas under specific conditions. While the scope of the change is narrow, it represents a meaningful stability improvement for users who rely on structured output functionality. Developers in this space are encouraged to monitor the official release notes and upgrade promptly for more reliable schema handling.

#Vercel AI SDK#ai-sdk/openai#Zod schema#allOf wrapper#structured output#OpenAI API#recursive schema#patch update
Share:

Related articles