Class RealtimeTurn


public class RealtimeTurn extends ObjectWithJsonToString
A provider-neutral description of one scripted assistant response in a realtime voice session — the realtime analogue of Completion. The codecs turn it into the provider-correct ordered WebSocket event sequence.
  • text — the visible/spoken text. In RealtimeModality.TEXT it is streamed as text deltas; in RealtimeModality.AUDIO it is streamed as the spoken-transcript delta stream.
  • audioTranscript — an explicit spoken transcript; when null the transcript is text. Only used in RealtimeModality.AUDIO.
  • audioBase64 — synthetic audio bytes (base64) to emit as the single audio payload. When null the codec emits a short silence placeholder per transcript token. The fidelity target is the event protocol, not audio DSP — these bytes are opaque placeholders.
  • inputTokens / outputTokens — usage reported on the final response.done (OpenAI) / usageMetadata (Gemini). When outputTokens is null the codec reports the streamed transcript token count.