Back to home
Lanson Flow Docs

Client Messages

Messages the client sends over the WebSocket connection.

Overview

typeTransportPurpose
input_audio_buffer.appendText frame (JSON)Send base64-encoded PCM audio
(binary frame)Binary frameSend raw PCM audio data
input_audio_buffer.flushText frame (JSON)Trigger manual flush
flushText frame (JSON)Alias for input_audio_buffer.flush
session.updateText frame (JSON)Update session parameters

input_audio_buffer.append

Send base64-encoded PCM16LE audio data.

{
  "type": "input_audio_buffer.append",
  "audio": "<PCM16LE base64>"
}

FieldTypeRequiredDescription
typestringyesMust be "input_audio_buffer.append"
audiostringyesBase64-encoded PCM16LE audio data

Errors:

  • invalid_audio: audio is empty or not valid base64
  • Binary audio frames

    Send raw PCM binary data directly as an ArrayBuffer. Same effect as input_audio_buffer.append but without base64 encoding overhead.

    Limits:

  • Max frame size: 1 MiB (1,048,576 bytes). Exceeding this returns audio_frame_too_large and closes the connection (1009).
  • Frames are dropped when concurrent utterance limit is exceeded (concurrent_utterance_limit)
  • Frames are dropped or connection closed (1013) on upstream backpressure
  • input_audio_buffer.flush

    Trigger a manual flush of the upstream buffer, ending the current speech segment.

    { "type": "input_audio_buffer.flush" }
    

    "flush" is an alias with the same effect.

    session.update

    Update session parameters. Can be sent at any time after connection.

    {
      "type": "session.update",
      "language": "zh",
      "prompt": "Optional context hint"
    }
    

    Supported fields

    FieldSnake-case aliasTypeDescription
    language—stringAudio language (e.g. zh, en, auto)
    prompt—stringContext hint, max 2000 characters
    backend—stringUpstream backend selection
    sttModelstt_modelstringSTT model
    normalizerModelnormalizer_modelstringText normalizer model
    vad—booleanEnable VAD
    vadThresholdvad_thresholdnumberVAD sensitivity threshold
    vadSilenceMsvad_silence_msnumberSilence duration to trigger end-of-speech
    vadPrefixMsvad_prefix_msnumberPrefix padding duration
    vadMinSpeechMsvad_min_speech_msnumberMinimum speech segment duration
    vadTargetSpeechMsvad_target_speech_msnumberTarget speech segment duration
    vadMaxSpeechMsvad_max_speech_msnumberMaximum speech segment duration
    vadSmartSplitWindowMsvad_smart_split_window_msnumberSmart split window

    ::callout{icon="i-lucide-triangle-alert" color="amber"} Tenant isolation All fields not listed above are stripped before forwarding to the upstream. Identity and credential fields (request_id, session_id, user_id) are injected by the gateway and cannot be overridden by the client. ::

    Errors

  • bad_json: JSON parse failure
  • bad_message: Not a JSON object or unsupported type
  • invalid_audio: Invalid audio data
  • Related

  • Server Events — server-pushed events
  • Session Configuration — session config details
  • Audio Input — audio format reference