@ai-sdk/xai
The official provider package in the Vercel AI SDK ecosystem for accessing xAI (Grok) models, implemented on an OpenAI-compatible layer and supporting capabilities such as streaming responses and tool calling.
Core Facts
@ai-sdk/provider-utils is responsible for the general-purpose utility functions in the AI SDK for interacting with model providers, including low-level logic such as streaming response parsing, tool call formatting, and error handling.
@ai-sdk/zai is built on the @ai-sdk/openai-compatible compatibility layer and only requires configuring Zhipu-specific endpoint addresses and parameters.
xAI provides an OpenAI-compatible API interface, which was the basis for early @ai-sdk/xai being able to adapt via the Chat Completions endpoint.
Timeline (last 90 days)
For applications that depend on @ai-sdk/xai, using the ^2.0.0 or ~2.0.106 range in package.json is sufficient to automatically obtain patch updates; combined with a lock file (package-lock.json / pnpm-lock.yaml), reproducible CI environments can be ensured.
This release involves a total of 3659 commits merged into the main branch that triggered the version release.
In the npm/pnpm/yarn dependency tree, @ai-sdk/xai usually declares provider-utils and openai-compatible as ^ range dependencies; when upgrading the xai package, the package manager may reuse the old versions in the lock file, causing the actual installed combination to differ from what the publisher tested.
AI SDK released the @ai-sdk/xai@5.0.52 patch version, fixing the issue in xAI streaming responses where an error was only reported after all images had been delivered.
The risk of upgrading to @ai-sdk/xai 3.0.155 is low, but if a project directly pins the versions of provider-utils or openai-compatible, it needs to check whether the lockfile conflicts.
When @ai-sdk/xai declares its dependency range as ^4.0.68, which version of provider-utils is actually installed is determined by the consuming project's lockfile, so a situation may arise where "the xai package was upgraded but provider-utils remains an old version."
@ai-sdk/xai follows Semantic Versioning (SemVer); an increment in the patch position denotes backward-compatible fixes or internal refactoring, adding no new public APIs and changing none.
The @ai-sdk/xai 5.0.50 version is a patch-level update, whose core change is declaring language model capabilities by model ID in the model catalog.
The pattern of declaring capabilities by model ID lays a structural foundation for subsequently integrating more xAI models; when new models are added, only the declaration in the catalog needs to be supplemented.
Before 5.0.50, the model catalog mainly carried model identifiers and basic metadata; this version makes the catalog also carry capability dimensions, so that the instance returned by languageModel() can directly expose capability information.
40 more timeline events
All Facts (20)
@ai-sdk/provider-utils is responsible for the general-purpose utility functions in the AI SDK for interacting with model providers, including low-level logic such as streaming response parsing, tool call formatting, and error handling.
90%Verified@ai-sdk/zai is built on the @ai-sdk/openai-compatible compatibility layer and only requires configuring Zhipu-specific endpoint addresses and parameters.
90%VerifiedxAI provides an OpenAI-compatible API interface, which was the basis for early @ai-sdk/xai being able to adapt via the Chat Completions endpoint.
90%Verified@ai-sdk/xai is the adapter-layer provider package in the AI SDK targeting the xAI Grok series of models.
90%VerifiedThis update upgrades the dependency ai to 7.0.102 and @ai-sdk/provider-utils to 5.0.41.
90%VerifiedPatch-level updates generally do not introduce breaking changes and can typically be applied directly without modifying existing code.
90%Verified@ai-sdk/zai is the official Provider in the Vercel AI SDK for Zhipu AI models.
90%VerifiedThe AI SDK adopts a Provider architecture in which each Provider package implements standardized interfaces such as LanguageModelV1, which is an engineering practice of the strategy pattern.
90%Verified@ai-sdk/togetherai is the official Vercel AI SDK adapter for the TogetherAI platform, built on top of the openai-compatible base package.
90%Verified@ai-sdk/xai is an official adapter for integrating xAI's Grok series of models, encapsulating details such as authentication, request construction, and streaming response parsing.
85%VerifiedxAI's Grok series models follow OpenAI's interface specification in API design.
85%VerifiedPatch version upgrades generally do not require modifications to existing business code, but it is recommended to run integration tests after upgrading to confirm dependency version compatibility.
80%VerifiedPatch versions follow the Semantic Versioning (SemVer) specification and should theoretically not introduce breaking changes.
80%Verified@ai-sdk/openai-compatible's core responsibilities include: converting the AI SDK's unified call parameters into OpenAI format, parsing responses and mapping them back to the AI SDK's standardized results, and handling chunking and errors in streaming responses.
80%Verified@ai-sdk/xai@3.0.134 was automatically built by GitHub Actions.
80%VerifiedIt is recommended to run existing test cases after upgrading to confirm that streaming output and message handling logic work correctly.
80%VerifiedDue to version linkage among AI SDK packages, it is recommended to keep @ai-sdk/provider, @ai-sdk/provider-utils, and the voyage package within compatible version ranges.
80%VerifiedThe AI SDK's core package `ai` provides unified APIs such as `generateText` and `streamText`, and each provider corresponds to an independent adapter package, such as `@ai-sdk/openai`, `@ai-sdk/anthropic` and `@ai-sdk/xai`.
75%VerifiedIn a dependency chain, patch versions can still introduce behavioral changes through upgraded transitive dependencies, so it is recommended to run the test suite even for patch updates.
75%VerifiedUpgrading @ai-sdk/xai to 2.0.100 requires no code changes and is an optimization that "works better if installed, and does not error if not installed."
75%