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

# create a streaming session

> mint a one-shot WebSocket session for real-time streaming synthesis. returns a `ws_url` and a `token`. connect to `ws_url?token=<token>`, send a JSON synthesis frame, then receive raw PCM int16 little-endian @ 24 kHz mono binary frames followed by a terminal `{"type":"done"}` JSON frame.



## OpenAPI

````yaml /openapi.json post /v1/tts/ws-connect
openapi: 3.1.0
info:
  title: silk TTS API
  version: 1.0.0
  description: >-
    rumik AI's text-to-speech API. synthesize speech with the expressive `muga`
    model or the faster `mulberry` model, over HTTP or a streaming WebSocket
    session.
  contact:
    name: rumik AI
    url: https://rumik.ai
servers:
  - url: https://silk-api.rumik.ai
    description: production
security:
  - bearerAuth: []
paths:
  /v1/tts/ws-connect:
    post:
      tags:
        - speech
      summary: create a streaming session
      description: >-
        mint a one-shot WebSocket session for real-time streaming synthesis.
        returns a `ws_url` and a `token`. connect to `ws_url?token=<token>`,
        send a JSON synthesis frame, then receive raw PCM int16 little-endian @
        24 kHz mono binary frames followed by a terminal `{"type":"done"}` JSON
        frame.
      operationId: createStreamingSession
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WsConnectRequest'
            examples:
              default:
                value:
                  model: mulberry
                  text: Streaming in real time.
      responses:
        '200':
          description: a one-shot WebSocket session.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WsConnectResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/Unavailable'
components:
  schemas:
    WsConnectRequest:
      type: object
      required:
        - text
      properties:
        model:
          type: string
          enum:
            - muga
            - mulberry
          default: muga
          description: which model to use.
        text:
          type: string
          maxLength: 2000
          description: text to synthesize. sent again in the WebSocket synthesis frame.
    WsConnectResponse:
      type: object
      properties:
        ws_url:
          type: string
          format: uri
          description: WebSocket URL to connect to.
          example: wss://silk-api.rumik.ai/v1/tts/ws/abc123
        token:
          type: string
          description: one-shot token. pass as `?token=<token>` when connecting.
    Error:
      type: object
      properties:
        error:
          type: string
          description: human-readable error message.
        code:
          type: string
          description: machine-readable error code.
  responses:
    Unauthorized:
      description: bearer token missing, invalid, or expired.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: key revoked or account disabled.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ValidationError:
      description: validation failed. check the error field.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: rate limit hit. see the `Retry-After` header.
      headers:
        Retry-After:
          description: seconds to wait before retrying.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unavailable:
      description: upstream temporarily unavailable. retry shortly.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        your rumik API key, e.g. `rk_live_...`. create one in the rumik
        dashboard.

````