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
withTimestampsoption decodes the JSON envelope for text-to-speech. providerMetadata.xainow exposes duration, content type, and character-level alignment.providerMetadata.xai.traceIdis returned on every speech response, sourced from thex-trace-idresponse header.- The update includes
replaceprovider 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
replaceprovider options to evaluate their impact on text-to-speech pronunciation. - Examine the
providerMetadata.xaiobject in speech responses to utilize the new duration, content type, and character-level alignment data. - Note the
providerMetadata.xai.traceIdfor enhanced traceability in speech responses. - Observe how
APICallErrormessages for text-to-speech now present xAI's specific error details.
