Rate this page:

VoiceAgentAPIClientParameters

XAI.VoiceAgentAPIClient parameters. Can be passed as arguments to the XAI.createVoiceAgentAPIClient method.

Props

conversationId
Optional
Copy URL
conversationId: 

string

Optional. Conversation id from a previous XAI.VoiceAgentAPIEvents.ConversationCreated event. Pass it when creating a new client to resume the session after a WebSocket disconnect (xAI session resumption). Enable caching with resumption: { enabled: true } in XAI.VoiceAgentAPIClient.sessionUpdate.

model
Optional
Copy URL
model: 

string

Optional. The model to use for the XAI VoiceAgent API. https://docs.x.ai/developers/model-capabilities/audio/voice-agent#model-selection. Note: The default value is grok-voice-fast-1.0.

onWebSocketClose
Optional
Copy URL
onWebSocketClose: 

(event: WebSocketEvents.CLOSE) => void

Optional. A callback function that is called when the WebSocket connection is closed.

privacy
Optional
Copy URL
privacy: 

boolean

Optional. Whether to enable the privacy functionality.

If privacy is enabled, the logging for the WebSocket connection is disabled.

NOTE: the default value is false.

reasoningEffort
Optional
Copy URL
reasoningEffort: 

string

Optional. Controls whether the model uses reasoning (high | none). Passed as the WebSocket reasoning.effort query parameter. Defaults to high on the xAI side when omitted.

statistics
Optional
Copy URL
statistics: 

boolean

Optional. Enables statistics functionality.

trace
Optional
Copy URL
trace: 

boolean

Optional. Whether to enable the tracing functionality.

If tracing is enabled, a URL to the trace file appears in the 'websocket.created' message. The file contains all sent and received WebSocket messages in the plain text format. The file is uploaded to the S3 storage.

NOTE: enable this only for diagnostic purposes. You can provide the trace file to our support team to help investigate issues.

xAIApiKey
Copy URL
xAIApiKey: 

string

The xAI API key for the XAI VoiceAgent API.

Rate this page: