← AI PulseAug 15, 2026

Deep · news · Single-source brief

Vercel AI SDK @ai-sdk/xai@4.0.40 Adds Speech Timestamps and Enhanced Error Parsing

The Vercel AI SDK's @ai-sdk/xai package, version 4.0.40, introduces new features for text-to-speech, including speech timestamps, pronunciation replacements, and improved error handling.

By Illumora Editorial

Source · Aug 15, 2026, 6:54 PM · On Illumora · Aug 15, 2026, 6:57 PM

Media from the primary source — shown here so you can stay on Illumora.

Rewritten from one allowlisted primary — not independent enterprise reporting. Lanes →

Brief drafted by Illumora’s editorial model from the linked primary source. Ops desk reviews flagged pieces. How we write →

Read the source →Vercel AI SDK Changelog — Release @ai-sdk/xai@4.0.40 · vercel/ai
Save

Vercel released version 4.0.40 of its @ai-sdk/xai package on August 15 at 18:54, introducing several enhancements for text-to-speech functionalities. These updates include the addition of speech timestamps, options for pronunciation replacements, and more detailed provider metadata.

Key Points

  • The @ai-sdk/xai package version 4.0.40 was released on August 15.
  • A new withTimestamps option decodes the JSON envelope for text-to-speech.
  • providerMetadata.xai now exposes duration, content type, and character-level alignment.
  • providerMetadata.xai.traceId is returned on every speech response, sourced from the x-trace-id response header.
  • The update includes replace provider options for text-to-speech.
  • Text-to-speech error parsing has been improved to convey xAI's specific error details, replacing generic HTTP reason phrases.

Context

According to the Vercel AI SDK Changelog, the withTimestamps feature processes the JSON envelope and delivers audio as before, but it now provides additional data through providerMetadata.xai. This metadata includes the duration, content type, and character-level alignment of the speech. Furthermore, the x-trace-id response header's value is now consistently returned as providerMetadata.xai.traceId in every speech response. The update also refines error handling for text-to-speech, ensuring that APICallError messages reflect the actual error details from xAI instead of standard HTTP reason phrases.

Why It Matters

These updates offer developers more granular control and insight into text-to-speech outputs and errors. The inclusion of timestamps and detailed metadata can facilitate more precise synchronization and analysis of generated speech, while improved error parsing provides clearer diagnostic information, potentially streamlining debugging processes.

What To Do

  • Review the @ai-sdk/xai package documentation for details on implementing withTimestamps.
  • Test the replace provider options to evaluate their impact on text-to-speech pronunciation.
  • Examine the providerMetadata.xai object in speech responses to utilize the new duration, content type, and character-level alignment data.
  • Note the providerMetadata.xai.traceId for enhanced traceability in speech responses.
  • Observe how APICallError messages for text-to-speech now present xAI's specific error details.