test(realtime): expect session.created as xAI realtime initial event (#28424)

xAI's Grok Voice Agent API now sends session.created as its first
realtime event (matching OpenAI), followed by conversation.created.
The E2E canary pinned the old conversation.created value and failed.

LiteLLM's xAI realtime path is a verbatim passthrough (provider_config
is None, raw forwarding), so the event ordering is xAI's own — no
transformation on our side. Update the pinned expected value and the
now-stale comments to match the current API behavior.
This commit is contained in:
yuneng-jiang
2026-05-20 19:01:31 -07:00
committed by GitHub
parent f99fb5f27f
commit e23d06dda4
2 changed files with 4 additions and 4 deletions
@@ -79,7 +79,7 @@ class RealTimeWebSocketClient:
def _is_initial_event(self, msg_type: str) -> bool:
"""Check if message type is an initial connection event"""
# OpenAI sends "session.created", xAI sends "conversation.created"
# OpenAI and xAI send "session.created"; some providers send "conversation.created"
return msg_type in ["session.created", "conversation.created"]
async def receive_text(self):
@@ -19,8 +19,8 @@ class TestXAIRealtime(BaseRealtimeTest):
"""
E2E tests for xAI Realtime API.
xAI's Grok Voice Agent API is OpenAI-compatible but uses:
- Different initial event: "conversation.created" instead of "session.created"
xAI's Grok Voice Agent API is OpenAI-compatible:
- Initial event: "session.created" (matches OpenAI)
- Different endpoint: wss://api.x.ai/v1/realtime
- Model: grok-4-1-fast-non-reasoning
"""
@@ -32,4 +32,4 @@ class TestXAIRealtime(BaseRealtimeTest):
return "XAI_API_KEY"
def get_initial_event_type(self) -> str:
return "conversation.created"
return "session.created"