asyncapi: 3.0.0
info:
  title: SLNG Gateway API - Murf TTS
  version: 0.1.0
  description: SLNG Gateway API
  contact:
    name: SLNG Support
    url: https://slng.ai
    email: support@slng.ai
  license:
    name: Proprietary
  tags:
    - name: STT
      description: Speech-to-Text services
    - name: Unmute STT Bridge
      description: SLNG native WebSocket STT protocol bridge.
    - name: Unmute TTS Bridge
      description: SLNG native WebSocket TTS protocol bridge.
servers:
  production:
    host: api.slng.ai
    protocol: wss
    description: Production
    security:
      - $ref: '#/components/securitySchemes/bearer'
  staging:
    host: stageapi.slng.ai
    protocol: wss
    description: Staging
    security:
      - $ref: '#/components/securitySchemes/bearer'
channels:
  /v1/tts/murf/murftts:falcon:
    address: /v1/tts/murf/murftts:falcon
    title: Murf Falcon
    summary: Murf Falcon
    description: >-
      Stream high-quality multilingual speech synthesis from Murf Falcon over
      WebSocket with selectable encodings, sample rates, and SLNG's unified TTS
      protocol.
    tags:
      - name: Murf Falcon
    servers:
      - $ref: '#/servers/production'
      - $ref: '#/servers/staging'
    messages:
      MurfTtsInitRequest:
        $ref: '#/components/messages/MurfTtsInitRequest'
      TtsTextMessage:
        $ref: '#/components/messages/TtsTextMessage'
      TtsFlushMessage:
        $ref: '#/components/messages/TtsFlushMessage'
      TtsClearMessage:
        $ref: '#/components/messages/TtsClearMessage'
      TtsCloseMessage:
        $ref: '#/components/messages/TtsCloseMessage'
      KeepaliveMessage:
        $ref: '#/components/messages/KeepaliveMessage'
      TtsReadyResponse:
        $ref: '#/components/messages/TtsReadyResponse'
      MurfTtsAudioResponse:
        $ref: '#/components/messages/MurfTtsAudioResponse'
      TtsSegmentStart:
        $ref: '#/components/messages/TtsSegmentStart'
      TtsSegmentEnd:
        $ref: '#/components/messages/TtsSegmentEnd'
      TtsFlushed:
        $ref: '#/components/messages/TtsFlushed'
      TtsCleared:
        $ref: '#/components/messages/TtsCleared'
      TtsAudioEnd:
        $ref: '#/components/messages/TtsAudioEnd'
      TtsErrorResponse:
        $ref: '#/components/messages/TtsErrorResponse'
    bindings:
      ws:
        method: GET
        headers:
          $ref: '#/components/schemas/WebsocketHeadersMurf'
operations:
  ttsMurfFalconReceiveInit:
    action: receive
    channel:
      $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon'
    summary: Initialize session on Murf Falcon
    messages:
      - $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon/messages/MurfTtsInitRequest'
    description: Initialize session on Murf Falcon
    tags: []
  ttsMurfFalconReceiveText:
    action: receive
    channel:
      $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon'
    summary: Send text to Murf Falcon
    messages:
      - $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon/messages/TtsTextMessage'
    description: Send text to Murf Falcon
    tags: []
  ttsMurfFalconReceiveFlush:
    action: receive
    channel:
      $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon'
    summary: Flush buffered output on Murf Falcon
    messages:
      - $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon/messages/TtsFlushMessage'
    description: Flush buffered output on Murf Falcon
    tags: []
  ttsMurfFalconReceiveClear:
    action: receive
    channel:
      $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon'
    summary: Clear queued output on Murf Falcon
    messages:
      - $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon/messages/TtsClearMessage'
    description: Clear queued output on Murf Falcon
    tags: []
  ttsMurfFalconReceiveClose:
    action: receive
    channel:
      $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon'
    summary: Close session on Murf Falcon
    messages:
      - $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon/messages/TtsCloseMessage'
    description: Close session on Murf Falcon
    tags: []
  ttsMurfFalconReceiveKeepalive:
    action: receive
    channel:
      $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon'
    summary: Send keepalive on Murf Falcon
    messages:
      - $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon/messages/KeepaliveMessage'
    description: Send keepalive on Murf Falcon
    tags: []
  ttsMurfFalconSendReady:
    action: send
    channel:
      $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon'
    summary: Receive ready signal from Murf Falcon
    messages:
      - $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon/messages/TtsReadyResponse'
    description: Receive ready signal from Murf Falcon
    tags: []
  ttsMurfFalconSendAudio:
    action: send
    channel:
      $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon'
    summary: Receive audio response from Murf Falcon
    messages:
      - $ref: >-
          #/channels/~1v1~1tts~1murf~1murftts:falcon/messages/MurfTtsAudioResponse
    description: Receive audio response from Murf Falcon
    tags: []
  ttsMurfFalconSendSegmentStart:
    action: send
    channel:
      $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon'
    summary: Receive segment start from Murf Falcon
    messages:
      - $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon/messages/TtsSegmentStart'
    description: Receive segment start from Murf Falcon
    tags: []
  ttsMurfFalconSendSegmentEnd:
    action: send
    channel:
      $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon'
    summary: Receive segment end from Murf Falcon
    messages:
      - $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon/messages/TtsSegmentEnd'
    description: Receive segment end from Murf Falcon
    tags: []
  ttsMurfFalconSendFlushed:
    action: send
    channel:
      $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon'
    summary: Receive flushed confirmation from Murf Falcon
    messages:
      - $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon/messages/TtsFlushed'
    description: Receive flushed confirmation from Murf Falcon
    tags: []
  ttsMurfFalconSendCleared:
    action: send
    channel:
      $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon'
    summary: Receive cleared confirmation from Murf Falcon
    messages:
      - $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon/messages/TtsCleared'
    description: Receive cleared confirmation from Murf Falcon
    tags: []
  ttsMurfFalconSendAudioEnd:
    action: send
    channel:
      $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon'
    summary: Receive audio end from Murf Falcon
    messages:
      - $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon/messages/TtsAudioEnd'
    description: Receive audio end from Murf Falcon
    tags: []
  ttsMurfFalconSendError:
    action: send
    channel:
      $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon'
    summary: Receive error from Murf Falcon
    messages:
      - $ref: '#/channels/~1v1~1tts~1murf~1murftts:falcon/messages/TtsErrorResponse'
    description: Receive error from Murf Falcon
    tags: []
components:
  schemas:
    WebsocketHeadersMurf:
      type: object
      properties:
        X-World-Part-Override:
          type: string
          description: >-
            Target world part override. Auto-selected if not provided. Available
            world parts: `ap`, `eu`, `eu-non-eu`, `me`, `na`.
          enum:
            - ap
            - eu
            - eu-non-eu
            - me
            - na
  messages:
    TtsErrorResponse:
      name: TtsErrorResponse
      title: Error Response
      summary: Indicates an error occurred during synthesis.
      contentType: application/json
      payload:
        type: object
        description: Indicates an error occurred during synthesis.
        required:
          - type
          - code
          - message
        properties:
          type:
            type: string
            const: error
          code:
            type: string
            description: Error code.
            enum:
              - auth_error
              - config_error
              - rate_limit
              - provider_error
          message:
            type: string
            description: Human-readable error description
      examples:
        - name: ttsError
          summary: TTS error response
          payload:
            type: error
            code: provider_error
            message: Provider returned an unexpected error
    TtsAudioEnd:
      name: TtsAudioEnd
      title: Audio End
      summary: Signals the end of audio generation.
      contentType: application/json
      payload:
        type: object
        description: Signals the end of audio generation.
        required:
          - type
        properties:
          type:
            type: string
            const: audio_end
          duration:
            type: number
            description: Total audio duration
      examples:
        - name: audioEnd
          summary: Audio generation complete
          payload:
            type: audio_end
            duration: 3.5
    TtsCleared:
      name: TtsCleared
      title: Cleared
      summary: Acknowledges that queued output was cleared.
      contentType: application/json
      payload:
        type: object
        description: Acknowledges that queued output was cleared.
        required:
          - type
        properties:
          type:
            type: string
            const: cleared
      examples:
        - name: cleared
          summary: Clear acknowledged
          payload:
            type: cleared
    TtsFlushed:
      name: TtsFlushed
      title: Flushed
      summary: Acknowledges that buffered output was flushed.
      contentType: application/json
      payload:
        type: object
        description: Acknowledges that buffered output was flushed.
        required:
          - type
        properties:
          type:
            type: string
            const: flushed
      examples:
        - name: flushed
          summary: Flush acknowledged
          payload:
            type: flushed
    TtsSegmentEnd:
      name: TtsSegmentEnd
      title: Segment End
      summary: Signals the end of a synthesized segment.
      contentType: application/json
      payload:
        type: object
        description: Signals the end of a synthesized segment.
        required:
          - type
          - segment_id
        properties:
          type:
            type: string
            const: segment_end
          segment_id:
            type: string
            description: Unique segment identifier
      examples:
        - name: segmentEnd
          summary: Segment end signal
          payload:
            type: segment_end
            segment_id: seg_001
    TtsSegmentStart:
      name: TtsSegmentStart
      title: Segment Start
      summary: Signals the start of a synthesized segment.
      contentType: application/json
      payload:
        type: object
        description: Signals the start of a synthesized segment.
        required:
          - type
          - segment_id
        properties:
          type:
            type: string
            const: segment_start
          segment_id:
            type: string
            description: Unique segment identifier
      examples:
        - name: segmentStart
          summary: Segment start signal
          payload:
            type: segment_start
            segment_id: seg_001
    MurfTtsAudioResponse:
      name: MurfTtsAudioResponse
      title: Audio Response (Murf Falcon)
      summary: Audio response from Murf Falcon TTS with metadata.
      contentType: application/json
      payload:
        type: object
        description: >-
          Audio response from Murf Falcon TTS containing base64-encoded audio
          data.
        required:
          - type
          - data
        properties:
          type:
            type: string
            const: audio
          data:
            type: object
            required:
              - audio
            properties:
              audio:
                type: string
                format: byte
                description: Base64-encoded audio data
              content_type:
                type: string
                description: MIME type of the audio data
      examples:
        - name: murfAudio
          summary: Receive audio from Murf Falcon
          payload:
            type: audio
            data:
              audio: UklGRiQAAABXQVZFZm10IBAAAAABAAEA...
              content_type: audio/mp3
    TtsReadyResponse:
      name: TtsReadyResponse
      title: Ready Response
      summary: Indicates the session is ready to receive messages.
      contentType: application/json
      payload:
        type: object
        description: Indicates the session is ready to receive messages.
        required:
          - type
          - session_id
        properties:
          type:
            type: string
            const: ready
          session_id:
            type: string
            description: Unique session identifier
      examples:
        - name: ready
          summary: TTS session ready
          payload:
            type: ready
            session_id: sess_tts_abc123
    KeepaliveMessage:
      name: KeepaliveMessage
      title: Keepalive Message
      summary: Keep the WebSocket connection alive during silence.
      contentType: application/json
      payload:
        type: object
        description: >-
          Prevents the connection from being closed due to inactivity. Send
          periodically during silence to maintain the session.
        required:
          - type
        properties:
          type:
            type: string
            const: keepalive
      examples:
        - name: keepalive
          summary: Send keepalive
          payload:
            type: keepalive
    TtsCloseMessage:
      name: TtsCloseMessage
      title: Close Message
      summary: Close the session and stop any further audio.
      contentType: application/json
      payload:
        type: object
        description: Close the session and stop any further audio.
        required:
          - type
        properties:
          type:
            type: string
            const: close
      examples:
        - name: close
          summary: Close the session
          payload:
            type: close
    TtsClearMessage:
      name: TtsClearMessage
      title: Clear Message
      summary: Clear any queued text/audio from the current session.
      contentType: application/json
      payload:
        type: object
        description: Clear any queued text/audio from the current session.
        required:
          - type
        properties:
          type:
            type: string
            const: clear
      examples:
        - name: clear
          summary: Clear queued text/audio
          payload:
            type: clear
    TtsFlushMessage:
      name: TtsFlushMessage
      title: Flush Message
      summary: Force any buffered text/audio to be finalized and delivered.
      contentType: application/json
      payload:
        type: object
        description: Force any buffered text/audio to be finalized and delivered.
        required:
          - type
        properties:
          type:
            type: string
            const: flush
      examples:
        - name: flush
          summary: Flush buffered audio
          payload:
            type: flush
    TtsTextMessage:
      name: TtsTextMessage
      title: Text Message
      summary: Send text to synthesize into audio output.
      contentType: application/json
      payload:
        type: object
        description: Send text to synthesize into audio output.
        required:
          - type
          - text
        properties:
          type:
            type: string
            const: text
          text:
            type: string
            description: Text to synthesize
          flush:
            type: boolean
            description: Whether to flush remaining audio immediately after this text
      examples:
        - name: textMessage
          summary: Send text to synthesize
          payload:
            type: text
            text: Hello, this is a test of text-to-speech synthesis.
    MurfTtsInitRequest:
      name: MurfTtsInitRequest
      title: Init Request (Murf Falcon)
      summary: >-
        Initialize a Murf Falcon TTS session with provider-specific
        configuration.
      contentType: application/json
      payload:
        type: object
        description: >-
          Initialize a Murf Falcon TTS session with voice, style, and audio
          configuration options specific to Murf.
        required:
          - type
          - model
        properties:
          type:
            type: string
            const: init
            default: init
          model:
            type: string
            description: Murf TTS model identifier.
            enum:
              - murftts:falcon
            default: murftts:falcon
          voice:
            type: string
            description: Voice identifier for Murf synthesis (e.g., en-US-natalie).
          config:
            type: object
            description: Murf Falcon synthesis configuration options.
            properties:
              encoding:
                type: string
                description: Output audio encoding format.
                enum:
                  - pcm
                  - linear16
                  - mp3
                  - flac
                  - ulaw
                  - alaw
                  - ogg
                  - wav
                default: mp3
              sample_rate:
                type: integer
                description: Output audio sample rate in Hz.
                enum:
                  - 8000
                  - 16000
                  - 24000
                  - 44100
                  - 48000
                default: 24000
              channel_type:
                type: string
                description: Audio channel configuration.
                enum:
                  - MONO
                default: MONO
              style:
                type: string
                description: Voice style for expressive synthesis (e.g., Conversation).
              rate:
                type: number
                description: Speech rate adjustment.
              pitch:
                type: number
                description: Pitch adjustment.
              locale:
                type: string
                description: Language locale for synthesis (e.g., en-US, en-UK, es-ES).
              speed:
                type: number
                description: Speech speed multiplier.
      examples:
        - name: murfFalconInit
          summary: Initialize Murf Falcon TTS session
          payload:
            type: init
            model: murftts:falcon
            voice: en-US-natalie
            config:
              sample_rate: 24000
              encoding: mp3
              channel_type: MONO
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: >
        API key issued by SLNG. Pass as `Authorization: Bearer <token>` in the
        WebSocket upgrade request headers.
