asyncapi: 3.0.0
info:
  title: SLNG Gateway API - KugelAudio 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/kugelaudio/kugel:1-turbo:
    address: /v1/tts/kugelaudio/kugel:1-turbo
    title: Kugel 1 Turbo
    summary: Kugel 1 Turbo
    description: Stream low-latency high-quality speech from KugelAudio Kugel 1 Turbo over WebSocket with expressiveness controls and SLNG's unified TTS protocol.
    tags:
      - name: Kugel 1 Turbo
    servers:
      - $ref: "#/servers/production"
      - $ref: "#/servers/staging"
    messages:
      KugelTtsRequest:
        $ref: "#/components/messages/KugelTtsRequest"
      KugelTtsConfigMessage:
        $ref: "#/components/messages/KugelTtsConfigMessage"
      KugelTtsTextMessage:
        $ref: "#/components/messages/KugelTtsTextMessage"
      KugelTtsFlushMessage:
        $ref: "#/components/messages/KugelTtsFlushMessage"
      KugelTtsCloseMessage:
        $ref: "#/components/messages/KugelTtsCloseMessage"
      KugelTtsAudioChunk:
        $ref: "#/components/messages/KugelTtsAudioChunk"
      KugelTtsWordTimestamps:
        $ref: "#/components/messages/KugelTtsWordTimestamps"
      KugelTtsFinalResponse:
        $ref: "#/components/messages/KugelTtsFinalResponse"
      KugelTtsGenerationStarted:
        $ref: "#/components/messages/KugelTtsGenerationStarted"
      KugelTtsChunkComplete:
        $ref: "#/components/messages/KugelTtsChunkComplete"
      KugelTtsSessionClosed:
        $ref: "#/components/messages/KugelTtsSessionClosed"
      TtsErrorResponse:
        $ref: "#/components/messages/TtsErrorResponse"
    bindings:
      ws:
        method: GET
        headers:
          $ref: "#/components/schemas/WebsocketHeadersKugelAudio"
  /v1/tts/kugelaudio/kugel:1:
    address: /v1/tts/kugelaudio/kugel:1
    title: Kugel 1
    summary: Kugel 1
    description: Stream high-quality speech synthesis from KugelAudio Kugel 1 over WebSocket with expressiveness controls and SLNG's unified TTS protocol.
    tags:
      - name: Kugel 1
    servers:
      - $ref: "#/servers/production"
      - $ref: "#/servers/staging"
    messages:
      KugelTtsRequest:
        $ref: "#/components/messages/KugelTtsRequest"
      KugelTtsConfigMessage:
        $ref: "#/components/messages/KugelTtsConfigMessage"
      KugelTtsTextMessage:
        $ref: "#/components/messages/KugelTtsTextMessage"
      KugelTtsFlushMessage:
        $ref: "#/components/messages/KugelTtsFlushMessage"
      KugelTtsCloseMessage:
        $ref: "#/components/messages/KugelTtsCloseMessage"
      KugelTtsAudioChunk:
        $ref: "#/components/messages/KugelTtsAudioChunk"
      KugelTtsWordTimestamps:
        $ref: "#/components/messages/KugelTtsWordTimestamps"
      KugelTtsFinalResponse:
        $ref: "#/components/messages/KugelTtsFinalResponse"
      KugelTtsGenerationStarted:
        $ref: "#/components/messages/KugelTtsGenerationStarted"
      KugelTtsChunkComplete:
        $ref: "#/components/messages/KugelTtsChunkComplete"
      KugelTtsSessionClosed:
        $ref: "#/components/messages/KugelTtsSessionClosed"
      TtsErrorResponse:
        $ref: "#/components/messages/TtsErrorResponse"
    bindings:
      ws:
        method: GET
        headers:
          $ref: "#/components/schemas/WebsocketHeadersKugelAudio"
  /v1/tts/kugelaudio/kugel:2:
    address: /v1/tts/kugelaudio/kugel:2
    title: Kugel 2
    summary: Kugel 2
    description: Stream high-quality speech synthesis from KugelAudio Kugel 2 over WebSocket with expressiveness controls and SLNG's unified TTS protocol.
    tags:
      - name: Kugel 2
    servers:
      - $ref: "#/servers/production"
      - $ref: "#/servers/staging"
    messages:
      KugelTtsRequest:
        $ref: "#/components/messages/KugelTtsRequest"
      KugelTtsConfigMessage:
        $ref: "#/components/messages/KugelTtsConfigMessage"
      KugelTtsTextMessage:
        $ref: "#/components/messages/KugelTtsTextMessage"
      KugelTtsFlushMessage:
        $ref: "#/components/messages/KugelTtsFlushMessage"
      KugelTtsCloseMessage:
        $ref: "#/components/messages/KugelTtsCloseMessage"
      KugelTtsAudioChunk:
        $ref: "#/components/messages/KugelTtsAudioChunk"
      KugelTtsWordTimestamps:
        $ref: "#/components/messages/KugelTtsWordTimestamps"
      KugelTtsFinalResponse:
        $ref: "#/components/messages/KugelTtsFinalResponse"
      KugelTtsGenerationStarted:
        $ref: "#/components/messages/KugelTtsGenerationStarted"
      KugelTtsChunkComplete:
        $ref: "#/components/messages/KugelTtsChunkComplete"
      KugelTtsSessionClosed:
        $ref: "#/components/messages/KugelTtsSessionClosed"
      TtsErrorResponse:
        $ref: "#/components/messages/TtsErrorResponse"
    bindings:
      ws:
        method: GET
        headers:
          $ref: "#/components/schemas/WebsocketHeadersKugelAudio"
  /v1/tts/kugelaudio/kugel:2-turbo:
    address: /v1/tts/kugelaudio/kugel:2-turbo
    title: Kugel 2 Turbo
    summary: Kugel 2 Turbo
    description: Stream low-latency high-quality speech synthesis from KugelAudio Kugel 2 Turbo over WebSocket with expressiveness controls and SLNG's unified TTS protocol.
    tags:
      - name: Kugel 2 Turbo
    servers:
      - $ref: "#/servers/production"
      - $ref: "#/servers/staging"
    messages:
      KugelTtsRequest:
        $ref: "#/components/messages/KugelTtsRequest"
      KugelTtsConfigMessage:
        $ref: "#/components/messages/KugelTtsConfigMessage"
      KugelTtsTextMessage:
        $ref: "#/components/messages/KugelTtsTextMessage"
      KugelTtsFlushMessage:
        $ref: "#/components/messages/KugelTtsFlushMessage"
      KugelTtsCloseMessage:
        $ref: "#/components/messages/KugelTtsCloseMessage"
      KugelTtsAudioChunk:
        $ref: "#/components/messages/KugelTtsAudioChunk"
      KugelTtsWordTimestamps:
        $ref: "#/components/messages/KugelTtsWordTimestamps"
      KugelTtsFinalResponse:
        $ref: "#/components/messages/KugelTtsFinalResponse"
      KugelTtsGenerationStarted:
        $ref: "#/components/messages/KugelTtsGenerationStarted"
      KugelTtsChunkComplete:
        $ref: "#/components/messages/KugelTtsChunkComplete"
      KugelTtsSessionClosed:
        $ref: "#/components/messages/KugelTtsSessionClosed"
      TtsErrorResponse:
        $ref: "#/components/messages/TtsErrorResponse"
    bindings:
      ws:
        method: GET
        headers:
          $ref: "#/components/schemas/WebsocketHeadersKugelAudio"
operations:
  ttsKugelAudioKugel1TurboReceiveRequest:
    action: receive
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo"
    summary: Send TTS request to Kugel 1 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo/messages/KugelTtsRequest"
    description: Send text with synthesis parameters to Kugel 1 Turbo
    tags: []
  ttsKugelAudioKugel1TurboReceiveConfig:
    action: receive
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo"
    summary: Configure streaming session on Kugel 1 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo/messages/KugelTtsConfigMessage"
    description: Send initial configuration for a stream input session on Kugel 1 Turbo
    tags: []
  ttsKugelAudioKugel1TurboReceiveText:
    action: receive
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo"
    summary: Send text chunk to Kugel 1 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo/messages/KugelTtsTextMessage"
    description: Send incremental text chunk for streaming synthesis on Kugel 1 Turbo
    tags: []
  ttsKugelAudioKugel1TurboReceiveFlush:
    action: receive
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo"
    summary: Flush buffered text on Kugel 1 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo/messages/KugelTtsFlushMessage"
    description: Force immediate generation of buffered text on Kugel 1 Turbo
    tags: []
  ttsKugelAudioKugel1TurboReceiveClose:
    action: receive
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo"
    summary: Close streaming session on Kugel 1 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo/messages/KugelTtsCloseMessage"
    description: End the streaming session and flush remaining text on Kugel 1 Turbo
    tags: []
  ttsKugelAudioKugel1TurboSendAudioChunk:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo"
    summary: Receive audio chunk from Kugel 1 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo/messages/KugelTtsAudioChunk"
    description: Receive audio chunk from Kugel 1 Turbo
    tags: []
  ttsKugelAudioKugel1TurboSendWordTimestamps:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo"
    summary: Receive word timestamps from Kugel 1 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo/messages/KugelTtsWordTimestamps"
    description: Receive word timestamps from Kugel 1 Turbo
    tags: []
  ttsKugelAudioKugel1TurboSendFinal:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo"
    summary: Receive final response from Kugel 1 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo/messages/KugelTtsFinalResponse"
    description: Receive final response with generation statistics from Kugel 1 Turbo
    tags: []
  ttsKugelAudioKugel1TurboSendGenerationStarted:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo"
    summary: Receive generation started from Kugel 1 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo/messages/KugelTtsGenerationStarted"
    description: Receive generation started signal when buffered text begins synthesis on Kugel 1 Turbo
    tags: []
  ttsKugelAudioKugel1TurboSendChunkComplete:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo"
    summary: Receive chunk complete from Kugel 1 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo/messages/KugelTtsChunkComplete"
    description: Receive chunk complete signal with metrics from Kugel 1 Turbo
    tags: []
  ttsKugelAudioKugel1TurboSendSessionClosed:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo"
    summary: Receive session closed from Kugel 1 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo/messages/KugelTtsSessionClosed"
    description: Receive session closed signal with aggregate statistics from Kugel 1 Turbo
    tags: []
  ttsKugelAudioKugel1TurboSendError:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo"
    summary: Receive error from Kugel 1 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1-turbo/messages/TtsErrorResponse"
    description: Receive error from Kugel 1 Turbo
    tags: []
  ttsKugelAudioKugel1ReceiveRequest:
    action: receive
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1"
    summary: Send TTS request to Kugel 1
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1/messages/KugelTtsRequest"
    description: Send text with synthesis parameters to Kugel 1
    tags: []
  ttsKugelAudioKugel1ReceiveConfig:
    action: receive
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1"
    summary: Configure streaming session on Kugel 1
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1/messages/KugelTtsConfigMessage"
    description: Send initial configuration for a stream input session on Kugel 1
    tags: []
  ttsKugelAudioKugel1ReceiveText:
    action: receive
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1"
    summary: Send text chunk to Kugel 1
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1/messages/KugelTtsTextMessage"
    description: Send incremental text chunk for streaming synthesis on Kugel 1
    tags: []
  ttsKugelAudioKugel1ReceiveFlush:
    action: receive
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1"
    summary: Flush buffered text on Kugel 1
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1/messages/KugelTtsFlushMessage"
    description: Force immediate generation of buffered text on Kugel 1
    tags: []
  ttsKugelAudioKugel1ReceiveClose:
    action: receive
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1"
    summary: Close streaming session on Kugel 1
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1/messages/KugelTtsCloseMessage"
    description: End the streaming session and flush remaining text on Kugel 1
    tags: []
  ttsKugelAudioKugel1SendAudioChunk:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1"
    summary: Receive audio chunk from Kugel 1
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1/messages/KugelTtsAudioChunk"
    description: Receive audio chunk from Kugel 1
    tags: []
  ttsKugelAudioKugel1SendWordTimestamps:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1"
    summary: Receive word timestamps from Kugel 1
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1/messages/KugelTtsWordTimestamps"
    description: Receive word timestamps from Kugel 1
    tags: []
  ttsKugelAudioKugel1SendFinal:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1"
    summary: Receive final response from Kugel 1
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1/messages/KugelTtsFinalResponse"
    description: Receive final response with generation statistics from Kugel 1
    tags: []
  ttsKugelAudioKugel1SendGenerationStarted:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1"
    summary: Receive generation started from Kugel 1
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1/messages/KugelTtsGenerationStarted"
    description: Receive generation started signal when buffered text begins synthesis on Kugel 1
    tags: []
  ttsKugelAudioKugel1SendChunkComplete:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1"
    summary: Receive chunk complete from Kugel 1
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1/messages/KugelTtsChunkComplete"
    description: Receive chunk complete signal with metrics from Kugel 1
    tags: []
  ttsKugelAudioKugel1SendSessionClosed:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1"
    summary: Receive session closed from Kugel 1
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1/messages/KugelTtsSessionClosed"
    description: Receive session closed signal with aggregate statistics from Kugel 1
    tags: []
  ttsKugelAudioKugel1SendError:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1"
    summary: Receive error from Kugel 1
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:1/messages/TtsErrorResponse"
    description: Receive error from Kugel 1
    tags: []
  ttsKugelAudioKugel2ReceiveRequest:
    action: receive
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2"
    summary: Send TTS request to Kugel 2
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2/messages/KugelTtsRequest"
    description: Send text with synthesis parameters to Kugel 2
    tags: []
  ttsKugelAudioKugel2ReceiveConfig:
    action: receive
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2"
    summary: Configure streaming session on Kugel 2
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2/messages/KugelTtsConfigMessage"
    description: Send initial configuration for a stream input session on Kugel 2
    tags: []
  ttsKugelAudioKugel2ReceiveText:
    action: receive
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2"
    summary: Send text chunk to Kugel 2
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2/messages/KugelTtsTextMessage"
    description: Send incremental text chunk for streaming synthesis on Kugel 2
    tags: []
  ttsKugelAudioKugel2ReceiveFlush:
    action: receive
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2"
    summary: Flush buffered text on Kugel 2
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2/messages/KugelTtsFlushMessage"
    description: Force immediate generation of buffered text on Kugel 2
    tags: []
  ttsKugelAudioKugel2ReceiveClose:
    action: receive
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2"
    summary: Close streaming session on Kugel 2
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2/messages/KugelTtsCloseMessage"
    description: End the streaming session and flush remaining text on Kugel 2
    tags: []
  ttsKugelAudioKugel2SendAudioChunk:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2"
    summary: Receive audio chunk from Kugel 2
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2/messages/KugelTtsAudioChunk"
    description: Receive audio chunk from Kugel 2
    tags: []
  ttsKugelAudioKugel2SendWordTimestamps:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2"
    summary: Receive word timestamps from Kugel 2
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2/messages/KugelTtsWordTimestamps"
    description: Receive word timestamps from Kugel 2
    tags: []
  ttsKugelAudioKugel2SendFinal:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2"
    summary: Receive final response from Kugel 2
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2/messages/KugelTtsFinalResponse"
    description: Receive final response with generation statistics from Kugel 2
    tags: []
  ttsKugelAudioKugel2SendGenerationStarted:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2"
    summary: Receive generation started from Kugel 2
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2/messages/KugelTtsGenerationStarted"
    description: Receive generation started signal when buffered text begins synthesis on Kugel 2
    tags: []
  ttsKugelAudioKugel2SendChunkComplete:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2"
    summary: Receive chunk complete from Kugel 2
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2/messages/KugelTtsChunkComplete"
    description: Receive chunk complete signal with metrics from Kugel 2
    tags: []
  ttsKugelAudioKugel2SendSessionClosed:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2"
    summary: Receive session closed from Kugel 2
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2/messages/KugelTtsSessionClosed"
    description: Receive session closed signal with aggregate statistics from Kugel 2
    tags: []
  ttsKugelAudioKugel2SendError:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2"
    summary: Receive error from Kugel 2
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2/messages/TtsErrorResponse"
    description: Receive error from Kugel 2
    tags: []
  ttsKugelAudioKugel2TurboReceiveRequest:
    action: receive
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo"
    summary: Send TTS request to Kugel 2 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo/messages/KugelTtsRequest"
    description: Send text with synthesis parameters to Kugel 2 Turbo
    tags: []
  ttsKugelAudioKugel2TurboReceiveConfig:
    action: receive
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo"
    summary: Configure streaming session on Kugel 2 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo/messages/KugelTtsConfigMessage"
    description: Send initial configuration for a stream input session on Kugel 2 Turbo
    tags: []
  ttsKugelAudioKugel2TurboReceiveText:
    action: receive
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo"
    summary: Send text chunk to Kugel 2 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo/messages/KugelTtsTextMessage"
    description: Send incremental text chunk for streaming synthesis on Kugel 2 Turbo
    tags: []
  ttsKugelAudioKugel2TurboReceiveFlush:
    action: receive
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo"
    summary: Flush buffered text on Kugel 2 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo/messages/KugelTtsFlushMessage"
    description: Force immediate generation of buffered text on Kugel 2 Turbo
    tags: []
  ttsKugelAudioKugel2TurboReceiveClose:
    action: receive
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo"
    summary: Close streaming session on Kugel 2 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo/messages/KugelTtsCloseMessage"
    description: End the streaming session and flush remaining text on Kugel 2 Turbo
    tags: []
  ttsKugelAudioKugel2TurboSendAudioChunk:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo"
    summary: Receive audio chunk from Kugel 2 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo/messages/KugelTtsAudioChunk"
    description: Receive audio chunk from Kugel 2 Turbo
    tags: []
  ttsKugelAudioKugel2TurboSendWordTimestamps:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo"
    summary: Receive word timestamps from Kugel 2 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo/messages/KugelTtsWordTimestamps"
    description: Receive word timestamps from Kugel 2 Turbo
    tags: []
  ttsKugelAudioKugel2TurboSendFinal:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo"
    summary: Receive final response from Kugel 2 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo/messages/KugelTtsFinalResponse"
    description: Receive final response with generation statistics from Kugel 2 Turbo
    tags: []
  ttsKugelAudioKugel2TurboSendGenerationStarted:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo"
    summary: Receive generation started from Kugel 2 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo/messages/KugelTtsGenerationStarted"
    description: Receive generation started signal when buffered text begins synthesis on Kugel 2 Turbo
    tags: []
  ttsKugelAudioKugel2TurboSendChunkComplete:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo"
    summary: Receive chunk complete from Kugel 2 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo/messages/KugelTtsChunkComplete"
    description: Receive chunk complete signal with metrics from Kugel 2 Turbo
    tags: []
  ttsKugelAudioKugel2TurboSendSessionClosed:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo"
    summary: Receive session closed from Kugel 2 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo/messages/KugelTtsSessionClosed"
    description: Receive session closed signal with aggregate statistics from Kugel 2 Turbo
    tags: []
  ttsKugelAudioKugel2TurboSendError:
    action: send
    channel:
      $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo"
    summary: Receive error from Kugel 2 Turbo
    messages:
      - $ref: "#/channels/~1v1~1tts~1kugelaudio~1kugel:2-turbo/messages/TtsErrorResponse"
    description: Receive error from Kugel 2 Turbo
    tags: []
components:
  schemas:
    WebsocketHeadersKugelAudio:
      type: object
      properties:
        X-World-Part-Override:
          type: string
          description: "Target world part override. Auto-selected if not provided. Available world parts: `eu`."
          enum:
            - eu
  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
    KugelTtsSessionClosed:
      name: KugelTtsSessionClosed
      title: Session Closed
      summary: Signals the streaming session has ended with aggregate statistics.
      contentType: application/json
      payload:
        type: object
        description: Sent after all text chunks have been processed and the session is terminated. Contains aggregate performance statistics.
        required:
          - type
          - session_closed
        properties:
          type:
            type: string
            const: session_closed
            default: session_closed
          session_closed:
            type: boolean
            const: true
            description: Session closed signal
          total_audio_seconds:
            type: number
            description: Cumulative audio duration across all chunks
          total_text_chunks:
            type: integer
            description: Total number of text chunks processed
          total_audio_chunks:
            type: integer
            description: Total number of audio chunks generated
      examples:
        - name: kugelSessionClosed
          summary: Streaming session ended
          payload:
            type: session_closed
            session_closed: true
            total_audio_seconds: 5.4
            total_text_chunks: 3
            total_audio_chunks: 15
    KugelTtsChunkComplete:
      name: KugelTtsChunkComplete
      title: Chunk Complete
      summary: Signals that audio generation for a text chunk is complete.
      contentType: application/json
      payload:
        type: object
        description: Sent when audio generation for an individual text chunk finishes. Includes performance metrics for the chunk.
        required:
          - type
          - chunk_complete
          - chunk_id
        properties:
          type:
            type: string
            const: chunk_complete
            default: chunk_complete
          chunk_complete:
            type: boolean
            const: true
            description: Chunk complete signal
          chunk_id:
            type: integer
            description: Text chunk identifier
          audio_seconds:
            type: number
            description: Duration of audio generated for this chunk
          gen_ms:
            type: number
            description: Generation time in milliseconds for this chunk
          is_final:
            type: boolean
            description: Whether this is the last chunk in the session
      examples:
        - name: kugelChunkComplete
          summary: Text chunk generation complete
          payload:
            type: chunk_complete
            chunk_complete: true
            chunk_id: 0
            audio_seconds: 1.2
            gen_ms: 150
            is_final: false
    KugelTtsGenerationStarted:
      name: KugelTtsGenerationStarted
      title: Generation Started
      summary: Indicates buffered text has reached the generation threshold.
      contentType: application/json
      payload:
        type: object
        description: Sent when buffered text reaches the generation threshold and audio synthesis begins for a text chunk.
        required:
          - type
          - generation_started
          - chunk_id
          - text
        properties:
          type:
            type: string
            const: generation_started
            default: generation_started
          generation_started:
            type: boolean
            const: true
            description: Generation started signal
          chunk_id:
            type: integer
            description: Text chunk identifier (0-based)
          text:
            type: string
            description: The text being generated
      examples:
        - name: kugelGenerationStarted
          summary: Generation started for text chunk
          payload:
            type: generation_started
            generation_started: true
            chunk_id: 0
            text: Hello from sunny Barcelona
    KugelTtsFinalResponse:
      name: KugelTtsFinalResponse
      title: Final Response
      summary: Signals generation is complete with KugelAudio performance statistics.
      contentType: application/json
      payload:
        type: object
        description: Signals generation is complete with performance statistics from KugelAudio.
        required:
          - type
          - final
        properties:
          type:
            type: string
            const: final
            default: final
          final:
            type: boolean
            const: true
            description: Indicates generation is complete
          chunks:
            type: integer
            description: Number of audio chunks generated
          total_samples:
            type: integer
            description: Total audio samples generated
          dur_ms:
            type: number
            description: Total audio duration in milliseconds
          gen_ms:
            type: number
            description: Total generation time in milliseconds
          rtf:
            type: number
            description: Real-time factor (gen_ms / dur_ms)
      examples:
        - name: kugelFinal
          summary: Generation complete with stats
          payload:
            type: final
            final: true
            chunks: 10
            total_samples: 48000
            dur_ms: 2000
            gen_ms: 150
            rtf: 0.075
    KugelTtsWordTimestamps:
      name: KugelTtsWordTimestamps
      title: Word Timestamps
      summary: Word-level timestamp alignment data from KugelAudio.
      contentType: application/json
      payload:
        type: object
        description: Word-level timestamp alignment data sent when word_timestamps is enabled.
        required:
          - type
          - word_timestamps
        properties:
          type:
            type: string
            const: word_timestamps
            default: word_timestamps
          word_timestamps:
            type: array
            description: Array of word-level alignment entries
            items:
              type: object
              required:
                - word
                - start_ms
                - end_ms
                - char_start
                - char_end
                - score
              properties:
                word:
                  type: string
                  description: The spoken word
                start_ms:
                  type: number
                  description: Word start time in milliseconds
                end_ms:
                  type: number
                  description: Word end time in milliseconds
                char_start:
                  type: integer
                  description: Start character position in input text
                char_end:
                  type: integer
                  description: End character position in input text
                score:
                  type: number
                  description: Alignment confidence score
          chunk_id:
            type: integer
            description: Text chunk identifier (stream input mode). Links timestamps to the text chunk that generated them.
      examples:
        - name: kugelWordTimestamps
          summary: Receive word timestamps from KugelAudio
          payload:
            type: word_timestamps
            word_timestamps:
              - word: Hello
                start_ms: 0
                end_ms: 320
                char_start: 0
                char_end: 5
                score: 0.98
              - word: world
                start_ms: 340
                end_ms: 620
                char_start: 6
                char_end: 11
                score: 0.95
            chunk_id: 0
    KugelTtsAudioChunk:
      name: KugelTtsAudioChunk
      title: Audio Chunk
      summary: Chunk of base64-encoded PCM audio from KugelAudio with encoding metadata.
      contentType: application/json
      payload:
        type: object
        description: Chunk of base64-encoded PCM audio from KugelAudio with encoding metadata.
        required:
          - type
          - audio
          - enc
          - idx
          - sr
          - samples
        properties:
          type:
            type: string
            const: audio_chunk
            default: audio_chunk
          audio:
            type: string
            format: byte
            description: Base64-encoded PCM16 audio data
          enc:
            type: string
            const: pcm_s16le
            description: Audio encoding format
          idx:
            type: integer
            description: Chunk index (0-based)
          sr:
            type: integer
            description: Sample rate in Hz
          samples:
            type: integer
            description: Number of samples in this chunk
          chunk_id:
            type: integer
            description: Text chunk identifier (stream input mode). Links audio to the text chunk that generated it.
      examples:
        - name: kugelAudioChunk
          summary: Receive audio chunk from KugelAudio
          payload:
            type: audio_chunk
            audio: UklGRiQAAABXQVZFZm10IBAAAAABAAEA...
            enc: pcm_s16le
            idx: 0
            sr: 24000
            samples: 4800
            chunk_id: 0
    KugelTtsCloseMessage:
      name: KugelTtsCloseMessage
      title: Close
      summary: End the streaming session and flush remaining buffered text.
      contentType: application/json
      payload:
        type: object
        description: Terminates the streaming session after flushing any remaining buffered content.
        required:
          - type
          - close
        properties:
          type:
            type: string
            const: close
            default: close
          close:
            type: boolean
            const: true
            description: Close signal
      examples:
        - name: kugelStreamClose
          summary: Close streaming session
          payload:
            type: close
            close: true
    KugelTtsFlushMessage:
      name: KugelTtsFlushMessage
      title: Flush
      summary: Force immediate generation of all buffered text.
      contentType: application/json
      payload:
        type: object
        description: Forces immediate generation of all buffered text without waiting for flush_timeout_ms.
        required:
          - type
          - flush
        properties:
          type:
            type: string
            const: flush
            default: flush
          flush:
            type: boolean
            const: true
            description: Flush signal
      examples:
        - name: kugelStreamFlush
          summary: Flush buffered text
          payload:
            type: flush
            flush: true
    KugelTtsTextMessage:
      name: KugelTtsTextMessage
      title: Text Chunk
      summary: Send an incremental text chunk for streaming TTS generation.
      contentType: application/json
      payload:
        type: object
        description: Incremental text chunk for stream input mode. Send as tokens arrive from an LLM or other source. Text is buffered until flushed or flush_timeout_ms expires.
        required:
          - type
          - text
        properties:
          type:
            type: string
            const: text
            default: text
          text:
            type: string
            description: Text chunk to buffer for synthesis
      examples:
        - name: kugelStreamText
          summary: Send text chunk
          payload:
            type: text
            text: "Hello from sunny "
    KugelTtsConfigMessage:
      name: KugelTtsConfigMessage
      title: Config
      summary: Configure a KugelAudio streaming TTS session before sending text chunks.
      contentType: application/json
      payload:
        type: object
        description: Initial configuration message for stream input mode. Sent once at the start of a session to set voice, model, and synthesis parameters before streaming text.
        required:
          - type
        properties:
          type:
            type: string
            const: config
            default: config
          voice_id:
            type: integer
            description: Voice identifier
          model_id:
            type: string
            description: Model selection
            enum:
              - kugel-2-turbo
              - kugel-1-turbo
              - kugel-1
              - kugel-2
            default: kugel-1-turbo
          cfg_scale:
            type: number
            minimum: 0
            maximum: 10
            default: 2
            description: Classifier-free guidance scale. Higher values = more expressive
          sample_rate:
            type: integer
            description: Output sample rate in Hz
            enum:
              - 8000
              - 16000
              - 22050
              - 24000
            default: 24000
          normalize:
            type: boolean
            default: true
            description: Enable text normalization
          language:
            type: string
            description: ISO 639-1 language code for text normalization
            enum:
              - de
              - en
              - fr
              - es
              - it
              - pt
              - nl
              - pl
              - sv
              - da
              - no
              - fi
              - cs
              - hu
              - ro
              - el
              - uk
              - bg
              - tr
              - vi
              - ar
              - hi
              - zh
              - ja
              - ko
          word_timestamps:
            type: boolean
            default: false
            description: Enable word-level timestamp alignment
          flush_timeout_ms:
            type: integer
            default: 500
            description: Milliseconds before auto-flushing buffered text
          speed:
            type: number
            minimum: 0.8
            maximum: 1.2
            default: 1
            description: Playback speed multiplier (pitch-preserving WSOLA)
      examples:
        - name: kugelStreamConfig
          summary: Configure KugelAudio streaming session
          payload:
            type: config
            voice_id: 268
            model_id: kugel-1-turbo
            cfg_scale: 2
            sample_rate: 24000
            flush_timeout_ms: 500
    KugelTtsRequest:
      name: KugelTtsRequest
      title: Request
      summary: Send text with synthesis parameters to KugelAudio TTS.
      contentType: application/json
      payload:
        type: object
        description: Send text to convert to speech with all synthesis parameters in a single request message. Matches KugelAudio's native WebSocket API.
        required:
          - type
          - text
        properties:
          type:
            type: string
            const: request
            default: request
          text:
            type: string
            maxLength: 10000
            description: Text to convert to speech
          model_id:
            type: string
            description: Model selection
            enum:
              - kugel-2-turbo
              - kugel-1-turbo
              - kugel-1
              - kugel-2
            default: kugel-1-turbo
          voice_id:
            type: integer
            description: Voice identifier
          cfg_scale:
            type: number
            minimum: 0
            maximum: 10
            default: 2
            description: Classifier-free guidance scale. Higher values = more expressive
          normalize:
            type: boolean
            default: true
            description: Enable text normalization
          language:
            type: string
            description: ISO 639-1 language code for text normalization
            enum:
              - de
              - en
              - fr
              - es
              - it
              - pt
              - nl
              - pl
              - sv
              - da
              - no
              - fi
              - cs
              - hu
              - ro
              - el
              - uk
              - bg
              - tr
              - vi
              - ar
              - hi
              - zh
              - ja
              - ko
          speed:
            type: number
            minimum: 0.8
            maximum: 1.2
            default: 1
            description: Playback speed multiplier (pitch-preserving WSOLA)
          word_timestamps:
            type: boolean
            default: false
            description: Enable word-level timestamp alignment
          speaker_prefix:
            type: boolean
            default: true
            description: Prepend internal speaker prefix for better voice consistency
          max_new_tokens:
            type: integer
            default: 2048
            minimum: 1
            maximum: 8192
            description: Maximum tokens to generate
          sample_rate:
            type: integer
            description: Output sample rate in Hz
            enum:
              - 8000
              - 16000
              - 22050
              - 24000
            default: 24000
      examples:
        - name: kugelRequest
          summary: KugelAudio TTS request
          payload:
            type: request
            text: Hello from sunny Barcelona
            model_id: kugel-1-turbo
            voice_id: 268
            cfg_scale: 2
            sample_rate: 24000
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: |
        API key issued by SLNG. Pass as `Authorization: Bearer <token>` in the WebSocket upgrade request headers.
