> ## Documentation Index
> Fetch the complete documentation index at: https://docs.voxnexus.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# STT Realtime

> WebSocket Real-time Speech-to-Text Channel

Through this channel, clients can:
1. Send initialization messages to configure recognition parameters
2. Send audio data streams for real-time speech recognition
3. Send command messages to control recognition flow
4. Receive recognition results (partial and final results)

**Connection**:
- Authentication via header: `X-Api-Key: YOUR_API_KEY`
- Authentication via query: `?token=YOUR_API_KEY`

**Message Format**:
All messages are in JSON format, containing a `type` field to identify the message type




## AsyncAPI

````yaml api-reference/asyncapi.yaml sttRealtime
id: sttRealtime
title: STT Realtime
description: >
  WebSocket Real-time Speech-to-Text Channel


  Through this channel, clients can:

  1. Send initialization messages to configure recognition parameters

  2. Send audio data streams for real-time speech recognition

  3. Send command messages to control recognition flow

  4. Receive recognition results (partial and final results)


  **Connection**:

  - Authentication via header: `X-Api-Key: YOUR_API_KEY`

  - Authentication via query: `?token=YOUR_API_KEY`


  **Message Format**:

  All messages are in JSON format, containing a `type` field to identify the
  message type
servers:
  - id: production
    protocol: wss
    host: api.voxnexus.ai
    bindings: []
    variables: []
address: /v1/stt/realtime
parameters: []
bindings: []
operations:
  - &ref_1
    id: receiveSTTClientMessages
    title: Receive s t t client messages
    type: receive
    messages:
      - &ref_3
        id: STTInitMessage
        payload:
          - name: STT Initialization Message
            type: object
            properties:
              - name: type
                type: string
                description: Message type
                enumValues:
                  - init
                required: true
              - name: model_id
                type: string
                description: Model ID (required)
                required: true
              - name: language
                type: string
                description: Language code (optional)
                required: false
              - name: format
                type: string
                description: Audio format (required)
                enumValues:
                  - pcm
                required: true
              - name: sample_rate
                type: integer
                description: Sample rate (required)
                enumValues:
                  - 16000
                required: true
              - name: enable_timestamps
                type: boolean
                description: Whether to return timestamps (optional)
                required: false
              - name: enable_llm_transform
                type: boolean
                description: >
                  Whether to enable LLM post-processing on each final transcript
                  (optional, default false).

                  When enabled, the server sends `llm` messages alongside
                  `transcript` messages.

                  **This feature requires whitelist access. Contact
                  support@voxnexus.ai to request access.**
                required: false
              - name: llm_prompt
                type: string
                description: >
                  LLM transform instruction (required when
                  enable_llm_transform=true).

                  E.g. "correct punctuation", "translate to English", "rewrite
                  humorously".
                required: false
              - name: llm_model_id
                type: string
                description: >
                  LLM model ID (optional, falls back to server default).

                  Routing is prefix-based: `claude-*` models route to Anthropic;
                  all other model IDs route to OpenAI.

                  Examples: `claude-haiku-4-5-20251001` (Anthropic), `gpt-4.1`
                  (OpenAI).
                required: false
              - name: llm_max_tokens
                type: integer
                description: >-
                  Maximum output tokens for LLM transform (optional, falls back
                  to server default)
                required: false
              - name: llm_mode
                type: string
                description: >
                  LLM processing mode (optional, default: per_segment).

                  - `per_segment`: LLM runs on each final sentence as it arrives
                  (low latency, real-time).

                  - `post_flush`: LLM runs once on the full accumulated text
                  after flush (full context).
                enumValues:
                  - per_segment
                  - post_flush
                required: false
              - name: llm_post_flush
                type: boolean
                description: >
                  When llm_mode=per_segment, also run a full-text LLM pass after
                  flush (optional, default false).

                  Produces both per-sentence `llm` messages (with segment_id)
                  and a final full-text

                  `llm` message (without segment_id) after flush completes.
                required: false
              - name: llm_post_flush_prompt
                type: string
                description: |
                  Separate prompt for the post-flush full-text pass (optional).
                  Falls back to llm_prompt when not specified.
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          description: STT WebSocket initialization message (sent by client)
          properties:
            type:
              type: string
              enum:
                - init
              description: Message type
              x-parser-schema-id: <anonymous-schema-44>
            model_id:
              type: string
              description: Model ID (required)
              example: vn-stt-basic
              x-parser-schema-id: <anonymous-schema-45>
            language:
              type: string
              description: Language code (optional)
              example: en-US
              x-parser-schema-id: <anonymous-schema-46>
            format:
              type: string
              description: Audio format (required)
              enum:
                - pcm
              example: pcm
              x-parser-schema-id: <anonymous-schema-47>
            sample_rate:
              type: integer
              description: Sample rate (required)
              enum:
                - 16000
              default: 16000
              example: 16000
              x-parser-schema-id: <anonymous-schema-48>
            enable_timestamps:
              type: boolean
              description: Whether to return timestamps (optional)
              default: false
              x-parser-schema-id: <anonymous-schema-49>
            enable_llm_transform:
              type: boolean
              description: >
                Whether to enable LLM post-processing on each final transcript
                (optional, default false).

                When enabled, the server sends `llm` messages alongside
                `transcript` messages.

                **This feature requires whitelist access. Contact
                support@voxnexus.ai to request access.**
              default: false
              x-parser-schema-id: <anonymous-schema-50>
            llm_prompt:
              type: string
              description: >
                LLM transform instruction (required when
                enable_llm_transform=true).

                E.g. "correct punctuation", "translate to English", "rewrite
                humorously".
              example: Correct punctuation and remove filler words
              x-parser-schema-id: <anonymous-schema-51>
            llm_model_id:
              type: string
              description: >
                LLM model ID (optional, falls back to server default).

                Routing is prefix-based: `claude-*` models route to Anthropic;
                all other model IDs route to OpenAI.

                Examples: `claude-haiku-4-5-20251001` (Anthropic), `gpt-4.1`
                (OpenAI).
              example: claude-haiku-4-5-20251001
              x-parser-schema-id: <anonymous-schema-52>
            llm_max_tokens:
              type: integer
              description: >-
                Maximum output tokens for LLM transform (optional, falls back to
                server default)
              minimum: 1
              maximum: 4096
              example: 1024
              x-parser-schema-id: <anonymous-schema-53>
            llm_mode:
              type: string
              description: >
                LLM processing mode (optional, default: per_segment).

                - `per_segment`: LLM runs on each final sentence as it arrives
                (low latency, real-time).

                - `post_flush`: LLM runs once on the full accumulated text after
                flush (full context).
              enum:
                - per_segment
                - post_flush
              default: per_segment
              x-parser-schema-id: <anonymous-schema-54>
            llm_post_flush:
              type: boolean
              description: >
                When llm_mode=per_segment, also run a full-text LLM pass after
                flush (optional, default false).

                Produces both per-sentence `llm` messages (with segment_id) and
                a final full-text

                `llm` message (without segment_id) after flush completes.
              default: false
              x-parser-schema-id: <anonymous-schema-55>
            llm_post_flush_prompt:
              type: string
              description: |
                Separate prompt for the post-flush full-text pass (optional).
                Falls back to llm_prompt when not specified.
              example: Summarize the key points in three bullet points
              x-parser-schema-id: <anonymous-schema-56>
          required:
            - type
            - model_id
            - format
            - sample_rate
          x-parser-schema-id: <anonymous-schema-43>
        title: STT Initialization Message
        example: |-
          {
            "type": "<string>",
            "model_id": "<string>",
            "language": "<string>",
            "format": "<string>",
            "sample_rate": 123,
            "enable_timestamps": true,
            "enable_llm_transform": true,
            "llm_prompt": "<string>",
            "llm_model_id": "<string>",
            "llm_max_tokens": 123,
            "llm_mode": "<string>",
            "llm_post_flush": true,
            "llm_post_flush_prompt": "<string>"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: STTInitMessage
          - id: x-parser-message-name
            value: STTInitMessage
      - &ref_4
        id: STTAudioMessage
        payload:
          - name: STT Audio Message
            type: object
            properties:
              - name: type
                type: string
                description: Message type
                enumValues:
                  - audio
                required: true
              - name: data
                type: string
                description: Base64-encoded audio data
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          description: STT WebSocket audio data message (sent by client)
          properties:
            type:
              type: string
              enum:
                - audio
              description: Message type
              x-parser-schema-id: <anonymous-schema-58>
            data:
              type: string
              format: byte
              description: Base64-encoded audio data
              x-parser-schema-id: <anonymous-schema-59>
          required:
            - type
            - data
          x-parser-schema-id: <anonymous-schema-57>
        title: STT Audio Message
        example: |-
          {
            "type": "<string>",
            "data": "<string>"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: STTAudioMessage
          - id: x-parser-message-name
            value: STTAudioMessage
      - &ref_5
        id: STTCommandMessage
        payload:
          - name: STT Command Message
            type: object
            properties:
              - name: type
                type: string
                description: Message type
                enumValues:
                  - command
                required: true
              - name: command
                type: string
                description: >-
                  Command type: 'flush' tells the server that no more audio will
                  be sent. The server will respond with a 'flush_done' message
                  after recognition is complete. Subsequent audio will start a
                  new recognition session.
                enumValues:
                  - flush
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          description: STT WebSocket command message (sent by client)
          properties:
            type:
              type: string
              enum:
                - command
              description: Message type
              x-parser-schema-id: <anonymous-schema-61>
            command:
              type: string
              enum:
                - flush
              description: >-
                Command type: 'flush' tells the server that no more audio will
                be sent. The server will respond with a 'flush_done' message
                after recognition is complete. Subsequent audio will start a new
                recognition session.
              x-parser-schema-id: <anonymous-schema-62>
          required:
            - type
            - command
          x-parser-schema-id: <anonymous-schema-60>
        title: STT Command Message
        example: |-
          {
            "type": "<string>",
            "command": "<string>"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: STTCommandMessage
          - id: x-parser-message-name
            value: STTCommandMessage
    bindings: []
    extensions: &ref_0
      - id: x-parser-unique-object-id
        value: sttRealtime
  - &ref_2
    id: sendSTTServerMessages
    title: Send s t t server messages
    type: send
    messages:
      - &ref_6
        id: STTReadyMessage
        payload:
          - name: STT Ready Message
            type: object
            properties:
              - name: type
                type: string
                description: Message type
                enumValues:
                  - ready
                required: true
              - name: request_id
                type: string
                description: Request ID
                required: true
              - name: language
                type: string
                description: Language code
                required: false
              - name: format
                type: string
                description: Audio format
                required: true
              - name: sample_rate
                type: integer
                description: Sample rate
                required: true
              - name: enable_timestamps
                type: boolean
                description: Whether timestamps are enabled
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          description: STT WebSocket ready message (sent by server)
          properties:
            type:
              type: string
              enum:
                - ready
              description: Message type
              x-parser-schema-id: <anonymous-schema-64>
            request_id:
              type: string
              description: Request ID
              example: req_1234567890
              x-parser-schema-id: <anonymous-schema-65>
            language:
              type: string
              description: Language code
              example: en-US
              x-parser-schema-id: <anonymous-schema-66>
            format:
              type: string
              description: Audio format
              example: pcm
              x-parser-schema-id: <anonymous-schema-67>
            sample_rate:
              type: integer
              description: Sample rate
              example: 16000
              x-parser-schema-id: <anonymous-schema-68>
            enable_timestamps:
              type: boolean
              description: Whether timestamps are enabled
              example: false
              x-parser-schema-id: <anonymous-schema-69>
          required:
            - type
            - request_id
            - format
            - sample_rate
          x-parser-schema-id: <anonymous-schema-63>
        title: STT Ready Message
        example: |-
          {
            "type": "<string>",
            "request_id": "<string>",
            "language": "<string>",
            "format": "<string>",
            "sample_rate": 123,
            "enable_timestamps": true
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: STTReadyMessage
          - id: x-parser-message-name
            value: STTReadyMessage
      - &ref_7
        id: STTTranscriptMessage
        payload:
          - name: STT Transcript Message
            type: object
            properties:
              - name: type
                type: string
                description: Message type
                enumValues:
                  - transcript
                required: true
              - name: request_id
                type: string
                description: Request ID
                required: true
              - name: segment_id
                type: string
                description: >
                  Unique sentence-level ID (only present when is_final=true and
                  LLM transform is enabled).

                  Used to correlate subsequent `llm` messages to this specific
                  final transcript segment.
                required: false
              - name: text
                type: string
                description: Recognized text
                required: true
              - name: is_final
                type: boolean
                description: >-
                  Whether this is a complete sentence (false=partial result,
                  true=sentence complete)
                required: true
              - name: language
                type: string
                description: >-
                  Detected language code (if language detection is enabled),
                  E.g. en, en-US
                required: false
              - name: confidence
                type: number
                description: Confidence score 0.0-1.0 (only valid when is_final=true)
                required: false
              - name: offset
                type: integer
                description: Text offset in audio stream (milliseconds)
                required: false
              - name: duration
                type: integer
                description: >-
                  Duration of corresponding audio (milliseconds, only valid when
                  is_final=true)
                required: false
              - name: words
                type: array
                description: >-
                  Word-level information array (only valid when is_final=true
                  and timestamps are enabled)
                required: false
                properties:
                  - name: word
                    type: string
                    description: Word
                    required: true
                  - name: offset
                    type: integer
                    description: Word offset in audio stream (milliseconds)
                    required: false
                  - name: duration
                    type: integer
                    description: Word duration (milliseconds)
                    required: false
                  - name: confidence
                    type: number
                    description: Confidence score 0.0-1.0
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          description: >-
            STT WebSocket transcript result message (sent by server). The
            is_final field distinguishes between partial results (false) and
            complete sentences (true).
          properties:
            type:
              type: string
              enum:
                - transcript
              description: Message type
              x-parser-schema-id: <anonymous-schema-71>
            request_id:
              type: string
              description: Request ID
              example: req_1234567890
              x-parser-schema-id: <anonymous-schema-72>
            segment_id:
              type: string
              format: uuid
              description: >
                Unique sentence-level ID (only present when is_final=true and
                LLM transform is enabled).

                Used to correlate subsequent `llm` messages to this specific
                final transcript segment.
              example: 550e8400-e29b-41d4-a716-446655440000
              x-parser-schema-id: <anonymous-schema-73>
            text:
              type: string
              description: Recognized text
              example: Hello, this is a test message.
              x-parser-schema-id: <anonymous-schema-74>
            is_final:
              type: boolean
              description: >-
                Whether this is a complete sentence (false=partial result,
                true=sentence complete)
              example: true
              x-parser-schema-id: <anonymous-schema-75>
            language:
              type: string
              description: >-
                Detected language code (if language detection is enabled), E.g.
                en, en-US
              example: en
              x-parser-schema-id: <anonymous-schema-76>
            confidence:
              type: number
              format: float
              description: Confidence score 0.0-1.0 (only valid when is_final=true)
              minimum: 0
              maximum: 1
              example: 0.95
              x-parser-schema-id: <anonymous-schema-77>
            offset:
              type: integer
              description: Text offset in audio stream (milliseconds)
              example: 0
              x-parser-schema-id: <anonymous-schema-78>
            duration:
              type: integer
              description: >-
                Duration of corresponding audio (milliseconds, only valid when
                is_final=true)
              example: 2500
              x-parser-schema-id: <anonymous-schema-79>
            words:
              type: array
              description: >-
                Word-level information array (only valid when is_final=true and
                timestamps are enabled)
              items:
                title: STT Word Information
                type: object
                properties:
                  word:
                    type: string
                    description: Word
                    example: hello
                    x-parser-schema-id: <anonymous-schema-81>
                  offset:
                    type: integer
                    description: Word offset in audio stream (milliseconds)
                    example: 0
                    x-parser-schema-id: <anonymous-schema-82>
                  duration:
                    type: integer
                    description: Word duration (milliseconds)
                    example: 500
                    x-parser-schema-id: <anonymous-schema-83>
                  confidence:
                    type: number
                    format: float
                    description: Confidence score 0.0-1.0
                    minimum: 0
                    maximum: 1
                    example: 0.98
                    x-parser-schema-id: <anonymous-schema-84>
                required:
                  - word
                x-parser-schema-id: STTWordInfo
              x-parser-schema-id: <anonymous-schema-80>
          required:
            - type
            - request_id
            - text
            - is_final
          x-parser-schema-id: <anonymous-schema-70>
        title: STT Transcript Message
        example: |-
          {
            "type": "<string>",
            "request_id": "<string>",
            "segment_id": "<string>",
            "text": "<string>",
            "is_final": true,
            "language": "<string>",
            "confidence": 123,
            "offset": 123,
            "duration": 123,
            "words": {
              "word": "<string>",
              "offset": 123,
              "duration": 123,
              "confidence": 123
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: STTTranscriptMessage
          - id: x-parser-message-name
            value: STTTranscriptMessage
      - &ref_8
        id: STTLLMMessage
        payload:
          - name: STT LLM Transform Message
            type: object
            properties:
              - name: type
                type: string
                description: Message type
                enumValues:
                  - llm
                required: true
              - name: request_id
                type: string
                description: Request ID
                required: true
              - name: segment_id
                type: string
                description: >
                  Links this LLM output to the corresponding `transcript`
                  message (per_segment mode only).

                  Absent for full-text post_flush pass.
                required: false
              - name: delta
                type: string
                description: Incremental LLM output text chunk (streaming token)
                required: true
              - name: is_final
                type: boolean
                description: >
                  Whether this is the last chunk for this segment's LLM output.

                  Clients should concatenate all delta values until
                  is_final=true.
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          description: >
            LLM transform streaming output message (sent by server when
            enable_llm_transform=true).

            Each final transcript segment triggers a sequence of `llm` messages
            streaming the LLM output

            incrementally (delta chunks), terminated by a message with
            is_final=true.


            - With `segment_id`: corresponds to a specific per-segment LLM pass
            (llm_mode=per_segment).

            - Without `segment_id`: corresponds to a full-text LLM pass
            (llm_mode=post_flush, or
              per_segment+llm_post_flush after all segment passes complete).
          properties:
            type:
              type: string
              enum:
                - llm
              description: Message type
              x-parser-schema-id: <anonymous-schema-86>
            request_id:
              type: string
              description: Request ID
              example: req_1234567890
              x-parser-schema-id: <anonymous-schema-87>
            segment_id:
              type: string
              format: uuid
              description: >
                Links this LLM output to the corresponding `transcript` message
                (per_segment mode only).

                Absent for full-text post_flush pass.
              example: 550e8400-e29b-41d4-a716-446655440000
              x-parser-schema-id: <anonymous-schema-88>
            delta:
              type: string
              description: Incremental LLM output text chunk (streaming token)
              example: Hello,
              x-parser-schema-id: <anonymous-schema-89>
            is_final:
              type: boolean
              description: |
                Whether this is the last chunk for this segment's LLM output.
                Clients should concatenate all delta values until is_final=true.
              example: false
              x-parser-schema-id: <anonymous-schema-90>
          required:
            - type
            - request_id
            - delta
            - is_final
          x-parser-schema-id: <anonymous-schema-85>
        title: STT LLM Transform Message
        example: |-
          {
            "type": "<string>",
            "request_id": "<string>",
            "segment_id": "<string>",
            "delta": "<string>",
            "is_final": true
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: STTLLMMessage
          - id: x-parser-message-name
            value: STTLLMMessage
      - &ref_9
        id: STTFlushDoneMessage
        payload:
          - name: STT Flush Done Message
            type: object
            properties:
              - name: type
                type: string
                description: Message type
                enumValues:
                  - flush_done
                required: true
              - name: request_id
                type: string
                description: Request ID
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          description: >-
            STT WebSocket flush completion message (sent by server after
            receiving 'flush' command and completing recognition)
          properties:
            type:
              type: string
              enum:
                - flush_done
              description: Message type
              x-parser-schema-id: <anonymous-schema-92>
            request_id:
              type: string
              description: Request ID
              example: req_1234567890
              x-parser-schema-id: <anonymous-schema-93>
          required:
            - type
            - request_id
          x-parser-schema-id: <anonymous-schema-91>
        title: STT Flush Done Message
        example: |-
          {
            "type": "<string>",
            "request_id": "<string>"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: STTFlushDoneMessage
          - id: x-parser-message-name
            value: STTFlushDoneMessage
      - &ref_10
        id: STTErrorMessage
        payload:
          - name: STT Error Message
            type: object
            properties:
              - name: type
                type: string
                description: Message type
                enumValues:
                  - error
                required: true
              - name: error
                type: string
                description: Error description
                required: true
              - name: code
                type: string
                description: Error code
                required: true
              - name: request_id
                type: string
                description: Request ID
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          description: STT WebSocket error message (sent by server)
          properties:
            type:
              type: string
              enum:
                - error
              description: Message type
              x-parser-schema-id: <anonymous-schema-95>
            error:
              type: string
              description: Error description
              example: Invalid audio format
              x-parser-schema-id: <anonymous-schema-96>
            code:
              type: string
              description: Error code
              example: UNSUPPORTED_FORMAT
              x-parser-schema-id: <anonymous-schema-97>
            request_id:
              type: string
              description: Request ID
              example: req_1234567890
              x-parser-schema-id: <anonymous-schema-98>
          required:
            - type
            - error
            - code
          x-parser-schema-id: <anonymous-schema-94>
        title: STT Error Message
        example: |-
          {
            "type": "<string>",
            "error": "<string>",
            "code": "<string>",
            "request_id": "<string>"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: STTErrorMessage
          - id: x-parser-message-name
            value: STTErrorMessage
    bindings: []
    extensions: *ref_0
sendOperations:
  - *ref_1
receiveOperations:
  - *ref_2
sendMessages:
  - *ref_3
  - *ref_4
  - *ref_5
receiveMessages:
  - *ref_6
  - *ref_7
  - *ref_8
  - *ref_9
  - *ref_10
extensions:
  - id: x-parser-unique-object-id
    value: sttRealtime
securitySchemes:
  - id: apiKeyAuth
    name: token
    type: httpApiKey
    description: API Key passed as query parameter, e.g. ?token=YOUR_API_KEY
    in: query
    extensions: []

````