Gemini Live: Real-Time AI Sessions
GxP's Live AI path connects an AI session to a media session, authenticated signaling and WebRTC transport. It is separate from the ordinary AI message-response API. Initializing the backend record does not prove that microphone capture, signaling, WebRTC or the provider connection succeeded.
The bundled GeminiLiveChat component starts a conversation session and can request camera capture. Transcript display, playback interruption, provider turn completion and saved session assets are separate paths. Translation/transcription modes and provider tools require their actual model/media-service implementation; they are not enabled merely by adding arbitrary props to this component.
Prerequisites and access
Use the platform's local development setup and an operator-prepared media/signaling/TURN deployment. Provider credentials, signaling endpoints and shared server secrets belong in that environment, not browser source or a documentation snippet. A running Laravel container alone does not establish media connectivity.
Choose the intended project AI interface and its System AI Model. The initialization service checks that the associated model exists and has supports_live_api enabled. The reviewed service does not use the old overview's separate enable_live_mode interface prerequisite.
Use an authenticated route/principal supported by the intended dashboard or portal integration. The controller's existing-session path authorizes viewing that AI session, but new-session initialization does not perform the commented-out interface-use authorization. Its interface/session lookups do not by themselves establish complete project/principal isolation. Verify denied-principal, cross-project, interface/session consistency and attendee attribution before exposing this flow to an audience. A route's project prefix or a successful model-capability check is not that verification.
The supplied Vue component depends on the platform's route, HTTP and page context. It is an internal platform component, not a standalone SDK that can be pasted into an arbitrary public page.
Internal Vue integration
Supply all required string props from the current authenticated project context:
<template>
<GeminiLiveChat
:interface-id="interfaceId"
:team-slug="teamSlug"
:project-slug="projectSlug"
/>
</template>
<script setup>
import GeminiLiveChat from '@/Components/GeminiLive/GeminiLiveChat.vue'
defineProps({
interfaceId: { type: String, required: true },
teamSlug: { type: String, required: true },
projectSlug: { type: String, required: true },
})
</script>
interfaceId must identify the numeric interface accepted by the route. The component also accepts an optional Boolean debug prop. It does not declare the old example's mode or enable-video props. Its start handler uses conversation mode and passes its selected audio/video state to useLiveAi; provider configuration still comes from the backend/model path.
Browser microphone/camera permission, supported devices, a secure browser context and reachable signaling/ICE services are additional requirements. Test permission denial as well as a successful capture.
Initialization and lifecycle
Both dashboard and portal route definitions expose initialization under their project-scoped AI interface/session paths:
- Named dashboard action:
dashboard.project.live-ai.initialize. - Relative route suffix:
/ai/{interfaceId}/sessions/{session}/live/initialize, with a numeric interface ID andnewor an existing AI session. - Related media-session actions: status, complete, events and assets under
/live-sessions/{mediaSessionId}.
Use the actual named route or API documentation for the complete base/team/project/authentication path. The old /api/v1/ai/sessions/{id}/live/initialize example omitted required context and is not the current route contract.
The bundled client supplies a socket session ID and initializes a new AI session. The controller creates the AI session or loads an existing one, checks for a related media session already in initializing/active, then calls LiveAiSessionService. An existing active media session produces a 409 response with its identity/status; do not create repeated sessions to hide that conflict.
A successful initialization returns HTTP 201 with success and a data object containing media-session/connection identifiers, status, signaling URL, token and max_duration. ICE servers are deliberately not returned as a separate response field: configured TURN credentials and live configuration are embedded in the signed session token for the media service. This is setup data, not provider readiness. The frontend then establishes signaling, WebRTC and media capture; inspect those outcomes separately.
A new AI session can be created before the media initialization service fails. Preserve its identifiers and error rather than assuming a failed initialization left no records. The service also writes media state and updates model activity before all later session setup can complete; this is not documented as one atomic external transaction.
Configuration and actual limits
The backend reads the selected model's driver.live definitions and formats the supported configuration before creating the media session. It records mode (default conversation), configured maximum duration (default 1,800 seconds in this path), video enablement/frame rate/quality/dimensions and audio configuration.
The initialization record advertises input audio at 16,000 Hz and output at 24,000 Hz. This does not prove that browser capture, RTP bridging and provider audio use compatible formats; verify the actual media path when diagnosing audio.
| Configuration area | Source and interpretation |
|---|---|
| Model live definitions | SystemAiModel.driver.live; initialization's duration default is 1,800 seconds |
| General live settings | services.live_ai declares retention/duration/audio/logging and rate-limit defaults; a declared value is not proof every path enforces it |
| Signaling/service URLs | services.mediasoup.service_url and signaling_url, configured by MEDIASOUP_SERVICE_URL / MEDIASOUP_SIGNALING_URL |
| Session JWT signing | MEDIASOUP_JWT_SECRET, with the configured APP_KEY fallback; coordinate signing/verification through the deployment |
| Media webhook secret | MEDIASOUP_WEBHOOK_SECRET, falling back to LIVE_SESSION_WEBHOOK_SECRET |
| TURN configuration | services.turn URL, username, shared credential secret and TTL; deployment must supply compatible TURN service behavior |
The reviewed validateRateLimits() has commented-out project-hourly and user-concurrent checks. The rate-limit configuration defaults therefore do not establish enforced admission caps. A separate method increments a project-hourly counter when enabled, but counting is not enforcement. Do not advertise 100/hour, two concurrent sessions or a daily-minute cap as guaranteed current protections.
Likewise, a configured retention period is not proof of deletion in storage, and a maximum-duration field is not proof that every disconnected or failed session is terminated on schedule. These outcomes require service and deployed lifecycle acceptance.
Verify a controlled session
- Confirm the intended principal/project/interface/model and capability before initialization.
- Record the returned AI/media session and connection IDs without sharing session credentials.
- Check signaling connection, WebRTC transport and local capture independently.
- Verify the provider response, audible playback and transcript behavior with a controlled short interaction.
- End the session and inspect terminal platform state and the expected saved events/assets.
- Test interruption, permission denial, transport failure and expiry/reconnect using controlled data; confirm unwanted sessions or resources are not left active.
Authorization, actual provider calls, media recording and durable assets are environment acceptance steps. Source snippets and mocked tests do not establish them. Keep detailed service deployment, secret rotation and recovery in operator runbooks.
Troubleshooting
| Symptom | Check |
|---|---|
| Live capability rejected | Interface's associated System AI Model and supports_live_api |
| Initialization fails or conflicts | Response error/status, existing media state, AI session identity and required socket session ID |
| No microphone/camera capture | Browser permission, device availability, secure context and local media state |
| Signaling fails | Configured URL, route/authentication context and session token verification |
| Signaling connects but media fails | ICE/TURN reachability and WebRTC transport; a WebSocket connection is not media success |
| No provider response | Media/provider session configuration and provider errors, separately from capture/transport |
| Transcript timing differs from speech | Frontend transcript-finalization versus provider turn-completion paths |
| Unexpected concurrency or duration | Actual admission/termination implementation; configuration labels are not enforced limits |
| Missing saved assets/events | Completion/webhook/storage outcome and identifiers; successful live playback alone is not storage evidence |
Related documentation and source
The architecture guide and audio-turn guide cover additional implementation responsibilities; reconcile their details with current source before implementing a transport extension.
Current overview entry points are GeminiLiveChat.vue, useLiveAi.js, MediaSessionController, LiveAiSessionService, routes/api/v1/routes.php, routes/admin/dashboard.php and config/services.php. The previous overview is retained as repository design history rather than as a supported setup contract.