@ai-sdk/xai 5.0.34 Adds Flexible Credential Resolution and Async WebSocket Config
The @ai-sdk/xai package now supports promises and asynchronous callbacks for API credentials, and its experimental OpenAI Live WebSocket config method can resolve asynchronously. Developers gain more control over authentication in dynamic or distributed environments.
What changed?
@ai-sdk/xai version 5.0.34 introduces support for promises as well as synchronous or asynchronous callbacks in provider API key and token settings. This means that credential information can now be resolved per authenticated request, including through asynchronous operations. The authentication logic from previous versions remains compatible, and synchronous credential serialization is preserved for backward compatibility. The experimental getServerWebSocketConfig() method for OpenAI Live also now supports asynchronous resolution, and its result must be awaited before establishing connection settings.
Why does it matter to an everyday developer?
Developers can now dynamically retrieve and resolve API credentials at runtime using asynchronous or synchronous callbacks, making it easier to integrate with secrets managers, dynamic authentication systems, or distributed infrastructure. This update improves security and flexibility by resolving credentials only when needed, per request. Developers using OpenAI Live through @ai-sdk/xai can now handle asynchronous configuration when establishing WebSocket connections, supporting non-blocking credential fetching or external configuration sources.
What can the developer do now?
Developers should update to @ai-sdk/xai 5.0.34 to access these capabilities. Credential settings can now use promises or callback functions, enabling on-demand secrets retrieval. When using the experimental OpenAI Live WebSocket APIs, developers must await getServerWebSocketConfig() before using the returned settings. Existing synchronous behavior is preserved, so existing code will continue to work unless new asynchronous credential resolution is desired.

