> ## 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.

# synthesize speech as json

> synthesize an utterance and return a json object whose `audio_base64` field contains the requested audio bytes as base64. omit `audio_format` for wav, or request `opus`, `pcm`, `mulaw`, `alaw`, or `mp3`. the remaining response fields keep their existing behavior.



## OpenAPI

````yaml /openapi.json post /v1/tts/json
openapi: 3.1.0
info:
  title: silk api
  version: 1.0.0
  description: >-
    rumik ai's speech api. synthesize speech with the expressive `muga` model,
    the faster `mulberry` model or the multilingual `mulberry-1.6` model over
    http or a streaming websocket session, run conversational voice agents over
    webrtc, a realtime pcm socket or the phone, and manage everything the agents
    playground does — agents, voices, variables, tools, phone numbers, sip
    trunks and outbound calls — with the same api key.
  contact:
    name: rumik ai
    url: https://rumik.ai
servers:
  - url: https://silk-api.rumik.ai
    description: production
security:
  - bearerAuth: []
tags:
  - name: speech
    description: text-to-speech over HTTP and WebSocket.
  - name: voice agents
    description: start calls with a deployed agent from your own app.
  - name: agents
    description: build, configure, deploy and inspect your agents.
  - name: calls
    description: place outbound phone calls and read call history.
  - name: voices
    description: the voices, languages and styles an agent may use.
  - name: variables
    description: account-wide `{name}` prompt variables and their defaults.
  - name: tools
    description: HTTP tools agents call before or during a call.
  - name: phone numbers
    description: 'numbers rented through rumik: search, rent, connect, release.'
  - name: sip trunks
    description: bring your own numbers over SIP.
paths:
  /v1/tts/json:
    post:
      tags:
        - speech
      summary: synthesize speech as json
      description: >-
        synthesize an utterance and return a json object whose `audio_base64`
        field contains the requested audio bytes as base64. omit `audio_format`
        for wav, or request `opus`, `pcm`, `mulaw`, `alaw`, or `mp3`. the
        remaining response fields keep their existing behavior.
      operationId: synthesizeSpeechJson
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TTSRequest'
            examples:
              mp3:
                summary: mulberry as mp3
                value:
                  model: mulberry
                  text: hello from silk.
                  description: a warm conversational voice
                  audio_format: mp3
      responses:
        '200':
          description: >-
            json response containing base64-encoded audio in the requested
            format.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TtsJsonResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
        '429':
          $ref: '#/components/responses/CapacityOrRateLimited'
        '502':
          $ref: '#/components/responses/GenerationFailed'
        '503':
          $ref: '#/components/responses/Unavailable'
components:
  schemas:
    TTSRequest:
      type: object
      required:
        - text
      properties:
        text:
          type: string
          maxLength: 2000
          description: >-
            text to synthesize. up to 2000 characters. for `muga`, prefix with a
            tone tag, e.g. `[happy]`. for `mulberry-1.6`, write each language in
            its own script, with no tags or markers.
          example: '[happy] namaste! kaise hain aap?'
        model:
          type: string
          enum:
            - muga
            - mulberry
            - mulberry-1.6
          default: muga
          description: >-
            which model to use. `muga` is steered by a tone tag in the text;
            `mulberry` is steered by a natural-language description;
            `mulberry-1.6` speaks 22 indian languages and is steered by an
            optional `style, accent, pace` description.
        audio_format:
          type: string
          enum:
            - opus
            - pcm
            - mulaw
            - alaw
            - mp3
          description: >-
            optional output format. omit the field for the original wav
            response. explicit `null`, `wav`, `ogg`, and unsupported values
            return `400 unsupported_audio_format`.
        description:
          type: string
          description: >-
            **required for `mulberry`.** natural-language voice/style
            description. the voice is built from this. send it on every
            `mulberry` request, including when `speaker` is set. **optional for
            `mulberry-1.6`:** a style, an accent and a pace, e.g. `happy, Tamil
            accent, steady pace`. a part you leave out defaults to
            `professional`, the accent of the text's script, and `fast pace`.
            not used by `muga`.
          example: >-
            a female 30s hindi voice, smooth timbre, conversational pacing, like
            a podcast host
        speaker:
          type: string
          enum:
            - emma
            - mia
            - sophia
            - ava
            - ira
            - siya
            - aisha
            - zoya
            - lucas
            - noah
            - theo
            - adam
          example: siya
          description: >-
            `mulberry` and `mulberry-1.6` only. optional named voice,
            case-insensitive. `mulberry`: `emma`, `mia`, `sophia`, `ava`, `ira`,
            `siya`, `aisha` and `zoya` are female; `lucas`, `noah`, `theo` and
            `adam` are male. omit and a voice is generated from `description`.
            `description` is required either way. `mulberry-1.6`: `ira`,
            `aisha`, `siya` or `zoya`, all female. omit it, or send a name it
            doesn't know, and you get `ira`.
        temperature:
          type: number
          default: 0.6
          description: sampling temperature. `mulberry-1.6` defaults to 0.8.
        top_p:
          type: number
          default: 0.95
          description: nucleus sampling. `mulberry-1.6` defaults to 1.0.
        top_k:
          type: integer
          default: 50
          description: top-k sampling. `mulberry-1.6` defaults to 30.
        repetition_penalty:
          type: number
          default: 1.2
          description: penalize repeated tokens. ignored by `mulberry-1.6`.
        max_new_tokens:
          type: integer
          default: 2048
          maximum: 8192
          description: >-
            output length cap. for `mulberry`, if long text comes back
            truncated, raise this above the default 2048 (up to 8192). for
            `mulberry-1.6`, it is sized from the text (at least 2048, up to
            8192), and a larger value you send is kept.
    TtsJsonResponse:
      type: object
      required:
        - audio_base64
        - audio_duration_ms
        - request_id
        - credits_used
        - usage_cost_nanos
      properties:
        audio_base64:
          type: string
          format: byte
          description: >-
            base64-encoded audio bytes in the requested format; wav when
            `audio_format` was omitted.
        audio_duration_ms:
          type: integer
          minimum: 0
          description: server-derived source audio duration in integer milliseconds.
        request_id:
          type: string
          format: uuid
          description: identifier for this synthesis request.
        credits_used:
          type: integer
          minimum: 0
          description: legacy credit usage. payg and unlimited requests return zero.
        usage_cost_nanos:
          type: integer
          minimum: 0
          description: >-
            payg charge in integer nanounits of the account's billing currency.
            unlimited and legacy-credit requests return zero.
        speaker:
          type: string
          description: >-
            the named voice, present when the request set `speaker` on
            `mulberry` or `mulberry-1.6`. `mulberry-1.6` returns the voice it
            resolved to, e.g. `Ira`.
          example: Ira
      additionalProperties: true
    Error:
      type: object
      properties:
        error:
          type: string
          description: human-readable error message.
        code:
          type: string
          description: machine-readable error code.
    ConcurrencyLimitExceeded:
      type: object
      required:
        - error
        - code
        - active_requests
        - limit
      properties:
        error:
          type: string
          example: >-
            silk is already processing 2 requests for this account. try again
            when one finishes, or increase your plan capacity.
        code:
          type: string
          const: concurrency_limit_exceeded
        active_requests:
          type: integer
          minimum: 0
          example: 2
        limit:
          type: integer
          minimum: 1
          example: 2
  responses:
    BadRequest:
      description: malformed request body or unknown model.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    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'
    CapacityOrRateLimited:
      description: >-
        either a per-key rate limit or account-wide concurrent-request capacity
        was reached.
      headers:
        Retry-After:
          description: >-
            present for a rate-limit response; capacity failures do not include
            it.
          schema:
            type: integer
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/Error'
              - $ref: '#/components/schemas/ConcurrencyLimitExceeded'
    GenerationFailed:
      description: >-
        the model could not finish the generation; nothing is charged.
        `GENERATION_ERROR`: the engine was unreachable or returned invalid
        audio, safe to retry once. `GENERATION_TOO_LONG` (`mulberry-1.6`): the
        text was too long for one request (about 80 seconds of audio), returned
        instead of cut-off audio; split the text into sentences.
      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.

````