Merge pull request #4401 from pipecat-ai/mb/grok-realtime-model

fix(xai/realtime): pass model as query param on connect
This commit is contained in:
Mark Backman
2026-05-04 09:44:33 -04:00
committed by GitHub
3 changed files with 10 additions and 2 deletions

View File

@@ -0,0 +1 @@
- Changed the default model for `GrokRealtimeLLMService` to `grok-voice-think-fast-1.0`, xAI's recommended Voice Agent model. The previous default of `grok-voice-fast-1.0` has been deprecated by xAI and is being removed.

1
changelog/4401.fixed.md Normal file
View File

@@ -0,0 +1 @@
- Fixed `GrokRealtimeLLMService` ignoring the configured model. The model was stored in `Settings` but never sent to xAI, so every session silently fell back to xAI's server-side default. The model is now passed via the `?model=` query parameter on the WebSocket URL as xAI's Voice Agent API requires.

View File

@@ -17,6 +17,7 @@ from collections.abc import Mapping
from dataclasses import dataclass, field
from dataclasses import fields as dataclass_fields
from typing import Any
from urllib.parse import quote
from loguru import logger
@@ -235,7 +236,7 @@ class GrokRealtimeLLMService(LLMService[GrokRealtimeLLMAdapter]):
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = self.Settings(
model=None,
model="grok-voice-think-fast-1.0",
system_instruction=None,
temperature=None,
max_tokens=None,
@@ -533,8 +534,13 @@ class GrokRealtimeLLMService(LLMService[GrokRealtimeLLMAdapter]):
if self._websocket:
return
# Model is selected via query param at connection time; xAI does
# not support changing it via session.update.
model = assert_given(self._settings.model)
uri = f"{self.base_url}?model={quote(model, safe='')}"
self._websocket = await websocket_connect(
uri=self.base_url,
uri=uri,
additional_headers={
"Authorization": f"Bearer {self.api_key}",
},