> This page is for Expression Measurement.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://dev.hume.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://dev.hume.ai/_mcp/server.

# Stream audio

GET /v1/expression/audio/realtime

Stream audio from a microphone or a file and receive expression measurements as speech happens. You do not need to detect speech or split it into segments: the server detects each stretch of speech and measures it while it is still being spoken.

## Sending audio

Send audio as binary messages of signed 16-bit little-endian PCM, mono, 16 kHz, with no header. Frames of around 100 ms work well. You can cut the audio at any sample boundary; the server joins the frames into one continuous stream.

- **Configuration:** send `session.update` before your first audio frame. A `session.update` after your first audio frame ends the session with `config_invalid`.
- **Rejected frames:** a frame that is empty, has an odd number of bytes, or holds more than 10 seconds of audio gets `invalid_audio_frame`, and the session continues. A message over 1MiB ends the session with `message_too_large`. Accepted frames are not acknowledged.
- **Send rate:** stream audio in close to real time, no faster than 1 second of audio per second. A frame sent faster can get `rate_limited`, and none of its audio is measured. Wait briefly and resend the same frame, so that the stream stays continuous. To measure a recording faster than it plays, use the audio file endpoint.
- **Failures:** if measurement fails, you receive `internal_error` and the session ends. Open a new connection.

## How measurements are produced

The server detects when speech starts and stops. Each continuous stretch of speech is an **utterance**, bracketed by `utterance.start` and `utterance.end`.

- **During speech:** a `measurement.result` arrives every `measurement_timer_ms` milliseconds of speech, with `trigger` set to `interval`.
- **When speech ends:** a final measurement arrives with `trigger` set to `speech_ended`, unless the previous measurement ended less than one second earlier. Every utterance gets at least one measurement.
- **Span:** each measurement covers the most recent 10 seconds of the utterance, or the whole utterance if it is shorter, so consecutive measurements can overlap. `audio_start_ms` and `audio_end_ms` give the span, counted from the start of the audio the server has accepted.
- **Ending the session:** `session.close` during speech ends the utterance. You receive its final measurement, if one is due, then `utterance.end`, then `session.closed`. A session that ends with an error can leave its last utterance without an `utterance.end`.

## Limits

| Limit | Value |
|---|---|
| Audio per frame | 10 seconds (320KB) |
| Message size | 1MiB (1,048,576 bytes) |
| Send rate | 1 second of audio per second |

## Message flow

A session at the default `measurement_timer_ms` of 3000, with one utterance: speech begins 98 ms into the audio and is still in progress at 26000 ms, when `session.close` ends it.

| Time in audio | Direction | Message |
|---|---|---|
| on connect | receive | `session.created` |
| before audio | send | `session.update` (if you change the configuration) |
| before audio | receive | `session.updated` (if you sent `session.update`) |
| 0 ms onward | send | audio frames |
| 98 ms | receive | `utterance.start` (utterance 0) |
| 3098 ms | receive | `measurement.result` (98 to 3098 ms, `interval`) |
| 6098 ms | receive | `measurement.result` (98 to 6098 ms, `interval`) |
| 9098 to 24098 ms | receive | `measurement.result` every 3000 ms of speech (six more, each covering at most the most recent 10 seconds) |
| 26000 ms | send | `session.close` |
| 26000 ms | receive | `measurement.result` (16000 to 26000 ms, `speech_ended`) |
| 26000 ms | receive | `utterance.end` (utterance 0) |
| 26000 ms | receive | `session.closed` (`produced.utterances` 1, `produced.measurements` 9) |

Reference: https://dev.hume.ai/expression-measurement/reference/audio/stream-audio

## AsyncAPI Specification

```yaml
asyncapi: 2.6.0
info:
  title: Stream audio
  version: subpackage_audio.Stream audio
  description: >-
    Stream audio from a microphone or a file and receive expression measurements
    as speech happens. You do not need to detect speech or split it into
    segments: the server detects each stretch of speech and measures it while it
    is still being spoken.


    ## Sending audio


    Send audio as binary messages of signed 16-bit little-endian PCM, mono, 16
    kHz, with no header. Frames of around 100 ms work well. You can cut the
    audio at any sample boundary; the server joins the frames into one
    continuous stream.


    - **Configuration:** send `session.update` before your first audio frame. A
    `session.update` after your first audio frame ends the session with
    `config_invalid`.

    - **Rejected frames:** a frame that is empty, has an odd number of bytes, or
    holds more than 10 seconds of audio gets `invalid_audio_frame`, and the
    session continues. A message over 1MiB ends the session with
    `message_too_large`. Accepted frames are not acknowledged.

    - **Send rate:** stream audio in close to real time, no faster than 1 second
    of audio per second. A frame sent faster can get `rate_limited`, and none of
    its audio is measured. Wait briefly and resend the same frame, so that the
    stream stays continuous. To measure a recording faster than it plays, use
    the audio file endpoint.

    - **Failures:** if measurement fails, you receive `internal_error` and the
    session ends. Open a new connection.


    ## How measurements are produced


    The server detects when speech starts and stops. Each continuous stretch of
    speech is an **utterance**, bracketed by `utterance.start` and
    `utterance.end`.


    - **During speech:** a `measurement.result` arrives every
    `measurement_timer_ms` milliseconds of speech, with `trigger` set to
    `interval`.

    - **When speech ends:** a final measurement arrives with `trigger` set to
    `speech_ended`, unless the previous measurement ended less than one second
    earlier. Every utterance gets at least one measurement.

    - **Span:** each measurement covers the most recent 10 seconds of the
    utterance, or the whole utterance if it is shorter, so consecutive
    measurements can overlap. `audio_start_ms` and `audio_end_ms` give the span,
    counted from the start of the audio the server has accepted.

    - **Ending the session:** `session.close` during speech ends the utterance.
    You receive its final measurement, if one is due, then `utterance.end`, then
    `session.closed`. A session that ends with an error can leave its last
    utterance without an `utterance.end`.


    ## Limits


    | Limit | Value |

    |---|---|

    | Audio per frame | 10 seconds (320KB) |

    | Message size | 1MiB (1,048,576 bytes) |

    | Send rate | 1 second of audio per second |


    ## Message flow


    A session at the default `measurement_timer_ms` of 3000, with one utterance:
    speech begins 98 ms into the audio and is still in progress at 26000 ms,
    when `session.close` ends it.


    | Time in audio | Direction | Message |

    |---|---|---|

    | on connect | receive | `session.created` |

    | before audio | send | `session.update` (if you change the configuration) |

    | before audio | receive | `session.updated` (if you sent `session.update`)
    |

    | 0 ms onward | send | audio frames |

    | 98 ms | receive | `utterance.start` (utterance 0) |

    | 3098 ms | receive | `measurement.result` (98 to 3098 ms, `interval`) |

    | 6098 ms | receive | `measurement.result` (98 to 6098 ms, `interval`) |

    | 9098 to 24098 ms | receive | `measurement.result` every 3000 ms of speech
    (six more, each covering at most the most recent 10 seconds) |

    | 26000 ms | send | `session.close` |

    | 26000 ms | receive | `measurement.result` (16000 to 26000 ms,
    `speech_ended`) |

    | 26000 ms | receive | `utterance.end` (utterance 0) |

    | 26000 ms | receive | `session.closed` (`produced.utterances` 1,
    `produced.measurements` 9) |
channels:
  /v1/expression/audio/realtime:
    description: >-
      Stream audio from a microphone or a file and receive expression
      measurements as speech happens. You do not need to detect speech or split
      it into segments: the server detects each stretch of speech and measures
      it while it is still being spoken.


      ## Sending audio


      Send audio as binary messages of signed 16-bit little-endian PCM, mono, 16
      kHz, with no header. Frames of around 100 ms work well. You can cut the
      audio at any sample boundary; the server joins the frames into one
      continuous stream.


      - **Configuration:** send `session.update` before your first audio frame.
      A `session.update` after your first audio frame ends the session with
      `config_invalid`.

      - **Rejected frames:** a frame that is empty, has an odd number of bytes,
      or holds more than 10 seconds of audio gets `invalid_audio_frame`, and the
      session continues. A message over 1MiB ends the session with
      `message_too_large`. Accepted frames are not acknowledged.

      - **Send rate:** stream audio in close to real time, no faster than 1
      second of audio per second. A frame sent faster can get `rate_limited`,
      and none of its audio is measured. Wait briefly and resend the same frame,
      so that the stream stays continuous. To measure a recording faster than it
      plays, use the audio file endpoint.

      - **Failures:** if measurement fails, you receive `internal_error` and the
      session ends. Open a new connection.


      ## How measurements are produced


      The server detects when speech starts and stops. Each continuous stretch
      of speech is an **utterance**, bracketed by `utterance.start` and
      `utterance.end`.


      - **During speech:** a `measurement.result` arrives every
      `measurement_timer_ms` milliseconds of speech, with `trigger` set to
      `interval`.

      - **When speech ends:** a final measurement arrives with `trigger` set to
      `speech_ended`, unless the previous measurement ended less than one second
      earlier. Every utterance gets at least one measurement.

      - **Span:** each measurement covers the most recent 10 seconds of the
      utterance, or the whole utterance if it is shorter, so consecutive
      measurements can overlap. `audio_start_ms` and `audio_end_ms` give the
      span, counted from the start of the audio the server has accepted.

      - **Ending the session:** `session.close` during speech ends the
      utterance. You receive its final measurement, if one is due, then
      `utterance.end`, then `session.closed`. A session that ends with an error
      can leave its last utterance without an `utterance.end`.


      ## Limits


      | Limit | Value |

      |---|---|

      | Audio per frame | 10 seconds (320KB) |

      | Message size | 1MiB (1,048,576 bytes) |

      | Send rate | 1 second of audio per second |


      ## Message flow


      A session at the default `measurement_timer_ms` of 3000, with one
      utterance: speech begins 98 ms into the audio and is still in progress at
      26000 ms, when `session.close` ends it.


      | Time in audio | Direction | Message |

      |---|---|---|

      | on connect | receive | `session.created` |

      | before audio | send | `session.update` (if you change the configuration)
      |

      | before audio | receive | `session.updated` (if you sent
      `session.update`) |

      | 0 ms onward | send | audio frames |

      | 98 ms | receive | `utterance.start` (utterance 0) |

      | 3098 ms | receive | `measurement.result` (98 to 3098 ms, `interval`) |

      | 6098 ms | receive | `measurement.result` (98 to 6098 ms, `interval`) |

      | 9098 to 24098 ms | receive | `measurement.result` every 3000 ms of
      speech (six more, each covering at most the most recent 10 seconds) |

      | 26000 ms | send | `session.close` |

      | 26000 ms | receive | `measurement.result` (16000 to 26000 ms,
      `speech_ended`) |

      | 26000 ms | receive | `utterance.end` (utterance 0) |

      | 26000 ms | receive | `session.closed` (`produced.utterances` 1,
      `produced.measurements` 9) |
    publish:
      operationId: subpackage_audio.Stream audio-publish
      summary: Server messages
      message:
        oneOf:
          - $ref: >-
              #/components/messages/subpackage_audio.Stream
              audio-server-0-audioReceiveSessionCreated
          - $ref: >-
              #/components/messages/subpackage_audio.Stream
              audio-server-1-audioReceiveSessionUpdated
          - $ref: >-
              #/components/messages/subpackage_audio.Stream
              audio-server-2-audioReceiveUtteranceStart
          - $ref: >-
              #/components/messages/subpackage_audio.Stream
              audio-server-3-audioReceiveMeasurementResult
          - $ref: >-
              #/components/messages/subpackage_audio.Stream
              audio-server-4-audioReceiveUtteranceEnd
          - $ref: >-
              #/components/messages/subpackage_audio.Stream
              audio-server-5-audioReceiveError
          - $ref: >-
              #/components/messages/subpackage_audio.Stream
              audio-server-6-audioReceiveSessionClosed
    subscribe:
      operationId: subpackage_audio.Stream audio-subscribe
      summary: Client messages
      message:
        oneOf:
          - $ref: >-
              #/components/messages/subpackage_audio.Stream
              audio-client-0-audioSendSessionUpdate
          - $ref: >-
              #/components/messages/subpackage_audio.Stream
              audio-client-1-audioSendSessionClose
          - $ref: >-
              #/components/messages/subpackage_audio.Stream
              audio-client-2-audioSendAudioFrame
servers:
  Production:
    url: wss://api.cloud.hume.ai/
    protocol: wss
    x-default: true
components:
  messages:
    subpackage_audio.Stream audio-server-0-audioReceiveSessionCreated:
      name: audioReceiveSessionCreated
      title: session.created
      description: >-
        Sent when the connection opens, before you send anything. Carries the
        session ID and the default configuration, which stays in effect unless
        you change it with `session.update`.
      payload:
        $ref: '#/components/schemas/audio_sessionCreated'
    subpackage_audio.Stream audio-server-1-audioReceiveSessionUpdated:
      name: audioReceiveSessionUpdated
      title: session.updated
      description: >-
        Sent when a `session.update` is accepted. Carries the full configuration
        now in effect, including defaults for any fields you omitted.
      payload:
        $ref: '#/components/schemas/audio_sessionUpdated'
    subpackage_audio.Stream audio-server-2-audioReceiveUtteranceStart:
      name: audioReceiveUtteranceStart
      title: utterance.start
      description: >-
        Sent when speech starts. Every `measurement.result` until the matching
        `utterance.end` belongs to this utterance.
      payload:
        $ref: '#/components/schemas/audio_utteranceStart'
    subpackage_audio.Stream audio-server-3-audioReceiveMeasurementResult:
      name: audioReceiveMeasurementResult
      title: measurement.result
      description: >-
        Sent every `measurement_timer_ms` of speech while an utterance is in
        progress, and once more when the utterance ends unless the previous
        measurement ended less than one second earlier. Each measurement covers
        up to the most recent 10 seconds of the utterance.
      payload:
        $ref: '#/components/schemas/audio_measurementResult'
    subpackage_audio.Stream audio-server-4-audioReceiveUtteranceEnd:
      name: audioReceiveUtteranceEnd
      title: utterance.end
      description: >-
        Sent when speech stops, after the utterance's final
        `measurement.result`, so every measurement for the utterance has arrived
        by the time you receive it.
      payload:
        $ref: '#/components/schemas/audio_utteranceEnd'
    subpackage_audio.Stream audio-server-5-audioReceiveError:
      name: audioReceiveError
      title: error
      description: >-
        Sent when a message you sent is rejected or the server fails to process
        it. For a recoverable error the message is rejected and the session
        continues; for a session-ending error, `session.closed` with `reason`
        `error` follows. `ErrorCode` lists each code, its class, and what to do.
      payload:
        $ref: '#/components/schemas/audio_error'
    subpackage_audio.Stream audio-server-6-audioReceiveSessionClosed:
      name: audioReceiveSessionClosed
      title: session.closed
      description: >-
        Sent as the last message of the session, after any final measurement and
        `utterance.end`. Carries the reason the session ended and totals of what
        was received and produced. The connection closes immediately after it,
        with the close code for the `reason`.
      payload:
        $ref: '#/components/schemas/audio_sessionClosed'
    subpackage_audio.Stream audio-client-0-audioSendSessionUpdate:
      name: audioSendSessionUpdate
      title: session.update
      description: >-
        Replaces the whole configuration; any field you omit returns to its
        default. Send it before your first audio frame, because once audio has
        been accepted a `session.update` ends the session with `config_invalid`.
        The server confirms with `session.updated`, or ends the session with
        `config_invalid` if the message contains an unrecognized field or an
        unsupported value.
      payload:
        $ref: '#/components/schemas/audio_sessionUpdate'
    subpackage_audio.Stream audio-client-1-audioSendSessionClose:
      name: audioSendSessionClose
      title: session.close
      description: >-
        Ends the session. The server sends any final results, then
        `session.closed`, and closes the connection with code 1000; on the audio
        endpoint, if the final measurement fails, `error` and `session.closed`
        with `reason` `error` follow instead. Prefer this to closing the
        WebSocket yourself, which ends the session immediately and discards any
        final results and the totals.
      payload:
        $ref: '#/components/schemas/audio_sessionClose'
    subpackage_audio.Stream audio-client-2-audioSendAudioFrame:
      name: audioSendAudioFrame
      title: audio frame
      description: >-
        A binary message of signed 16-bit little-endian PCM audio, mono, 16 kHz,
        with no header. The server appends it to the session's audio and
        measures speech as it is detected; accepted frames are not acknowledged.
        A frame that is empty, does not contain whole samples, or exceeds the
        frame limit is rejected with `invalid_audio_frame`, and a frame that
        arrives faster than the send rate can be rejected with `rate_limited`;
        in both cases the session continues.
      payload:
        $ref: '#/components/schemas/audio_audioFrame'
  schemas:
    SessionId:
      type: string
      format: uuid
      description: >-
        Unique identifier for the session. It is also the `run_id` of the run
        the session is recorded as. Include it when contacting support about a
        session.
      title: SessionId
    AudioConfig:
      type: object
      properties:
        type:
          type: string
          enum:
            - audio/pcm
        encoding:
          type: string
          enum:
            - s16le
          description: The sample encoding. `s16le` is signed 16-bit little-endian PCM.
        sample_rate:
          type: integer
          description: The sample rate in Hz.
        channels:
          type: integer
      required:
        - type
        - encoding
        - sample_rate
        - channels
      description: The audio format.
      title: AudioConfig
    MeasurementTimerMs:
      type: integer
      minimum: 3000
      maximum: 10000
      description: >-
        The interval between measurements while speech is in progress, in
        milliseconds of speech.
      title: MeasurementTimerMs
    audio_sessionCreated:
      type: object
      properties:
        type:
          type: string
          enum:
            - session.created
        session_id:
          $ref: '#/components/schemas/SessionId'
        audio:
          $ref: '#/components/schemas/AudioConfig'
        measurement_timer_ms:
          $ref: '#/components/schemas/MeasurementTimerMs'
      required:
        - type
        - session_id
        - audio
        - measurement_timer_ms
      description: >-
        The session ID and the configuration in effect when the connection
        opened.
      title: audio_sessionCreated
    audio_sessionUpdated:
      type: object
      properties:
        type:
          type: string
          enum:
            - session.updated
        audio:
          $ref: '#/components/schemas/AudioConfig'
        measurement_timer_ms:
          $ref: '#/components/schemas/MeasurementTimerMs'
      required:
        - type
        - audio
        - measurement_timer_ms
      description: >-
        The full configuration in effect after a `session.update`, including
        defaults for any fields you omitted.
      title: audio_sessionUpdated
    audio_utteranceStart:
      type: object
      properties:
        type:
          type: string
          enum:
            - utterance.start
        utterance_id:
          type: integer
          minimum: 0
          description: >-
            Sequential identifier of the utterance within the session, starting
            at 0.
        audio_start_ms:
          type: integer
          minimum: 0
          description: >-
            Where speech started, in milliseconds from the start of the
            session's audio.
      required:
        - type
        - utterance_id
        - audio_start_ms
      description: >-
        The start of an utterance. Every `measurement.result` until the matching
        `utterance.end` belongs to it.
      title: audio_utteranceStart
    MeasurementTrigger:
      type: string
      enum:
        - interval
        - speech_ended
      description: >-
        Why the measurement was produced.


        - `interval`: the measurement interval (`measurement_timer_ms`) elapsed
        while speech continued.

        - `speech_ended`: the utterance ended, or the audio ended while speech
        was in progress.


        A final measurement is skipped when the previous one ended less than one
        second earlier, so the last measurement of an utterance may carry the
        trigger `interval`. Where an utterance ended is reported separately: as
        an `utterance.end` message in a realtime session, and in `utterances` in
        an audio file response.
      title: MeasurementTrigger
    AudioExpressionName:
      type: string
      description: >-
        The name of an expression that can be detected in speech; see the [full
        list of audio
        expressions](/expression-measurement/docs/audio/measurements#expressions).
        Names are lowercase and may contain spaces and punctuation. New names
        may be added over time; treat a name you do not recognize as a new
        prediction.
      title: AudioExpressionName
    AudioExpressionScore:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/AudioExpressionName'
        probability:
          type: number
          format: double
          minimum: 0
          maximum: 1
          description: >-
            The probability that this expression is present, rounded to four
            decimal places.
      required:
        - name
        - probability
      description: A scored expression detected in the speech.
      title: AudioExpressionScore
    VoiceAttributeName:
      type: string
      description: >-
        The name of a quality of the voice or the audio, such as a manner of
        speaking, a vocal timbre or a background sound; see the [full list of
        voice
        attributes](/expression-measurement/docs/audio/measurements#voice-attributes).
        Names are lowercase and may contain spaces and punctuation. New names
        may be added over time; treat a name you do not recognize as a new
        prediction.
      title: VoiceAttributeName
    VoiceAttributeScore:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/VoiceAttributeName'
        probability:
          type: number
          format: double
          minimum: 0
          maximum: 1
          description: >-
            The probability that this quality is present, rounded to four
            decimal places.
      required:
        - name
        - probability
      description: A scored quality of the voice or the audio.
      title: VoiceAttributeScore
    audio_measurementResult:
      type: object
      properties:
        type:
          type: string
          enum:
            - measurement.result
        measurement_id:
          type: integer
          minimum: 0
          description: >-
            Sequential identifier of the measurement within the session,
            starting at 0.
        utterance_id:
          type: integer
          minimum: 0
          description: >-
            The utterance this measurement belongs to, as given in
            `utterance.start`.
        audio_start_ms:
          type: integer
          minimum: 0
          description: >-
            Start of the window measured, in milliseconds from the start of the
            session's audio. Never earlier than the start of the utterance.
        audio_end_ms:
          type: integer
          minimum: 0
          description: >-
            End of the window measured, in milliseconds from the start of the
            session's audio.
        trigger:
          $ref: '#/components/schemas/MeasurementTrigger'
        expressions:
          type: array
          items:
            $ref: '#/components/schemas/AudioExpressionScore'
          description: >-
            Expressions detected in the speech, such as `joy`, `anger` and
            `chuckling`, in descending order of probability. Scores with equal
            probability are ordered by the model's underlying score, then by
            name. Only expressions judged present are included, each against a
            threshold set for that expression, so the array may be empty.
            `probability` is the measured chance that the expression is truly
            present.
        voice_attributes:
          type: array
          items:
            $ref: '#/components/schemas/VoiceAttributeScore'
          description: >-
            Qualities of the voice and the audio, such as `husky`, `fast` and
            `background music`, in descending order of probability. Scores with
            equal probability are ordered by the model's underlying score, then
            by name. Only scores of 0.725 or above are included, so the array
            may be empty. `probability` is calibrated: the expected intensity a
            human rater would give the quality.
      required:
        - type
        - measurement_id
        - utterance_id
        - audio_start_ms
        - audio_end_ms
        - trigger
        - expressions
        - voice_attributes
      description: >-
        Expression measurements for a window of an utterance. The window spans
        `audio_start_ms` to `audio_end_ms` and covers up to the most recent 10
        seconds of the utterance. An interval measurement taken as speech stops
        can end shortly after the utterance does. Consecutive measurements of an
        utterance overlap, except interval measurements at a
        `measurement_timer_ms` of 10000, which meet end to end.
      title: audio_measurementResult
    audio_utteranceEnd:
      type: object
      properties:
        type:
          type: string
          enum:
            - utterance.end
        utterance_id:
          type: integer
          minimum: 0
          description: The utterance that ended, as given in `utterance.start`.
        audio_start_ms:
          type: integer
          minimum: 0
          description: >-
            Where the utterance started, in milliseconds from the start of the
            session's audio. Matches the `utterance.start` message.
        audio_end_ms:
          type: integer
          minimum: 0
          description: >-
            Where the utterance ended, in milliseconds from the start of the
            session's audio.
      required:
        - type
        - utterance_id
        - audio_start_ms
        - audio_end_ms
      description: The end of an utterance, with its full extent in the audio.
      title: audio_utteranceEnd
    ErrorCode:
      type: string
      enum:
        - invalid_audio_frame
        - invalid_image_frame
        - message_invalid
        - rate_limited
        - config_invalid
        - message_too_large
        - internal_error
      description: >-
        Identifies what went wrong and whether the session continues.


        **Recoverable.** The message is rejected and the session continues.


        - `invalid_audio_frame`: the audio frame was empty, had an odd number of
        bytes, or held more than 10 seconds of audio. Check how you slice audio
        and keep sending. Audio only.

        - `invalid_image_frame`: the frame was empty, was not a JPEG, or
        exceeded the pixel limit. Check the image and keep sending. Video only.

        - `message_invalid`: a text message was not valid JSON, had no `type`,
        or had an unrecognized `type`. Correct the message and keep sending.

        - `rate_limited`: media arrived faster than the send rate and was not
        processed. Audio: wait briefly and send the same frame again, so that
        the stream stays continuous. Video: from a live camera, drop the frame
        and send the next; from a recording, wait briefly and send the same
        frame again.


        **Depends on the endpoint.**


        - `internal_error`: the server failed while processing media. Audio: the
        session ends as for a session-ending error; open a new connection.
        Video: the frame is skipped and the session continues; resend it if you
        need a result for it. Five consecutive failures end the session; frames
        that are rejected or have no faces to measure do not reset the count.


        **Session-ending.** `error` is followed by `session.closed` with
        `reason` `error`, and the connection closes with code 1008.


        - `config_invalid`: a `session.update` contained an unrecognized field
        or an unsupported value, or arrived after you started sending media.
        Correct the message and open a new connection.

        - `message_too_large`: a message exceeded the size limit. Reduce the
        frame size and open a new connection.
      title: ErrorCode
    audio_error:
      type: object
      properties:
        type:
          type: string
          enum:
            - error
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          description: >-
            A human-readable description of the error, intended for logging and
            debugging. The wording may change; use `code` for programmatic
            handling.
        retryable:
          type: boolean
          description: >-
            `false` for every error that ends the session. `true` for every
            error the session survives, except `internal_error` on the video
            endpoint, where it reports whether the failure was temporary and the
            frame is worth resending.
      required:
        - type
        - code
        - message
        - retryable
      description: >-
        A rejected message or a processing failure. `code` says what happened
        and whether the session continues.
      title: audio_error
    CloseReason:
      type: string
      enum:
        - client_request
        - server_shutdown
        - idle_timeout
        - error
      description: >-
        Why the session ended. `session.closed` is the last message, and the
        WebSocket close code that follows it depends on the reason.


        - `client_request`: you sent `session.close`. Close code 1000.

        - `server_shutdown`: the server is restarting; reconnect at once to
        start a new session. Close code 1012.

        - `idle_timeout`: the server received no media frame it could use for 30
        seconds; open a new session to continue. Close code 1000.

        - `error`: a session-ending error, reported in the preceding `error`
        message. Close code 1008.
      title: CloseReason
    AudioReceived:
      type: object
      properties:
        audio_duration_ms:
          type: integer
          minimum: 0
          description: >-
            Total duration of audio accepted, in milliseconds, whether or not it
            contained speech.
        frames:
          type: integer
          minimum: 0
          description: >-
            Number of audio frames accepted. Frames rejected with an error are
            not counted, so comparing this with the number you sent tells you
            how many were rejected.
      required:
        - audio_duration_ms
        - frames
      description: What the server received during the session.
      title: AudioReceived
    AudioProduced:
      type: object
      properties:
        utterances:
          type: integer
          minimum: 0
          description: Number of utterances detected.
        measurements:
          type: integer
          minimum: 0
          description: >-
            Number of `measurement.result` messages sent. This counts messages;
            the video endpoint's field of the same name counts faces.
      required:
        - utterances
        - measurements
      description: What the server produced during the session.
      title: AudioProduced
    audio_sessionClosed:
      type: object
      properties:
        type:
          type: string
          enum:
            - session.closed
        session_id:
          $ref: '#/components/schemas/SessionId'
        reason:
          $ref: '#/components/schemas/CloseReason'
        received:
          $ref: '#/components/schemas/AudioReceived'
        produced:
          $ref: '#/components/schemas/AudioProduced'
      required:
        - type
        - session_id
        - reason
        - received
        - produced
      description: Why the session ended, and totals of what was received and produced.
      title: audio_sessionClosed
    AudioConfigUpdate:
      type: object
      properties:
        type:
          type: string
          enum:
            - audio/pcm
          default: audio/pcm
        encoding:
          type: string
          enum:
            - s16le
          default: s16le
          description: The sample encoding. `s16le` is signed 16-bit little-endian PCM.
        sample_rate:
          type: integer
          default: 16000
          description: The sample rate in Hz.
        channels:
          type: integer
          default: 1
      description: >-
        The format of the audio you send. Only one format is supported; any
        other value is rejected with `config_invalid`.
      title: AudioConfigUpdate
    audio_sessionUpdate:
      type: object
      properties:
        type:
          type: string
          enum:
            - session.update
        audio:
          $ref: '#/components/schemas/AudioConfigUpdate'
        measurement_timer_ms:
          type: integer
          minimum: 3000
          maximum: 10000
          default: 3000
          description: >-
            The interval between measurements while speech is in progress, in
            milliseconds of speech. Lower values produce measurements more
            often; at the maximum, interval measurements are back to back rather
            than overlapping.
      required:
        - type
      description: >-
        The configuration to apply to the session. Omitted fields are reset to
        their defaults.
      title: audio_sessionUpdate
    audio_sessionClose:
      type: object
      properties:
        type:
          type: string
          enum:
            - session.close
      required:
        - type
      description: A request to end the session.
      title: audio_sessionClose
    audio_audioFrame:
      type: string
      format: binary
      description: >-
        Raw audio: signed 16-bit little-endian PCM, mono, 16 kHz, with no
        header. A frame must be non-empty, contain whole samples, and stay
        within the frame limit given in the channel description. Frame
        boundaries do not need to align with anything.
      title: audio_audioFrame

```