npm / @ai-sdk/xai
@ai-sdk/xai
What changed in @ai-sdk/xai 3 to 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-18.
3 breaking2 security26 new APIs and options4 behavior and defaults10 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@ai-sdk/xai 521 changes
Breaking changes 2
Together AI Gemini image inputs are marked unsupported by the current single-image request mapping.
The Chat Completions API was removed.
Security 1
@ai-sdk/provider-utils has an Uncontrolled Resource Consumption issue
New APIs and options 9
Adds opus as a supported audio format.
Adds grok-imagine-image-2.0 as an image model ID for use with the xAI provider.
Adds auto as an image quality option for the xAI provider.
Adds 1.5k as an image resolution provider option.
Adds support for transcription model IDs.
Adds vadThreshold support for transcription.
Adds missing Responses API provider options.
Adds missing video provider options.
Adds the grok 4.7 model ID for use with @ai-sdk/xai.
Behavior and default changes 4
The xSearch tool now allows up to 20 allowedXHandles.
The xSearch tool now allows up to 20 excludedXHandles.
Asynchronous capability lookups can resolve to unknown.
Middleware overrides can resolve capability lookups to unknown.
Fixes and other changes 5
Speaker diarization is preserved when available or reported as unavailable, avoiding silent loss of diarization information.
The User-Agent header is now standards-compliant.
QuiverAI Arrow 2 and Arrow 2 Telos are advertised as supporting file input.
Capability declarations use confirmed model IDs, leaving unrecognized model names unknown.
Together AI FLUX.2 Pro and Flex are advertised as supporting single-image editing.
@ai-sdk/xai 421 changes
Breaking changes 1
Unsupported batch request types are now rejected.
Security 1
Blank and dot-segment file IDs are rejected or encoded so they cannot retarget request paths.
New APIs and options 17
Image generation requests are now supported in batches.
Adds batch cancellation and listing capabilities.
Batch requests can now use per-request models.
The xAI batch input file upload accepts an inputFileExpiresAfter provider option.
Batch start results now expose the uploaded input file's expiration time in provider metadata.
Batch start results now expose the ID of the uploaded input file in provider metadata.
File operations now accept abortSignal.
Adds deleteFile to the xAI files interface.
Adds streaming downloadFile to the xAI files interface.
Adds getFileMetadata to the xAI files interface.
File operations now accept headers.
Upload results now expose byteSize.
Upload results now expose createdAt.
Supports streaming uploads using data with type set to stream.
Supports upload TTLs through expiresAfter, an integer from 3600 to 2592000 seconds, emitted before the file part as xAI requires.
Upload results now expose expiresAt.
Batch now supports tool calling.
Fixes and other changes 2
Tool schemas now preserve additionalProperties: false.
Preserves the web_search action fields query, sources, and open_page in responses tool results.
@ai-sdk/xai 33 changes
Fixes and other changes 3
Generated and streamed results now preserve complete xAI Chat Completions usage objects.
Raw usage metadata now preserves complete xAI Responses usage objects.
Image moderation blocks are reported as content policy errors.