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

# Convert Text to speech

> This endpoint converts text into streaming audio. It does streaming automatically so consider sending request as events streams, Server-Sent Events (SSE) or any other streaming method.



## OpenAPI

````yaml POST /voice/text-to-speech
openapi: 3.1.0
info:
  title: Pawa AI APIs
  description: >-
    API endpoints in Pawa Platform to perform CRUD operations on different
    features using Pawa AI, a digital assistant built for Africa for various
    tasks.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.pawa-ai.com/v1
    description: Production Server
security:
  - bearerAuth: []
paths:
  /voice/text-to-speech:
    post:
      tags:
        - Text to Speech
      summary: Text to Speech
      description: >-
        This endpoint converts text into streaming audio. It does streaming
        automatically so consider sending request as events streams, Server-Sent
        Events (SSE) or any other streaming method.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TextToSpeechRequestDto'
      responses:
        '200':
          description: Audio streamed successfully
          content:
            audio/mpeg:
              schema:
                type: string
                format: binary
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                badRequest:
                  value:
                    success: false
                    message: Invalid input provided
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  value:
                    success: false
                    message: Unauthorized access
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                forbidden:
                  value:
                    success: false
                    message: You do not have permission to access this resource
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                notFound:
                  value:
                    success: false
                    message: Resource does not exist
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                tooManyRequests:
                  value:
                    success: false
                    message: Rate limit exceeded. Please try again later.
        '500':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                serverError:
                  value:
                    success: false
                    message: Internal server error
components:
  schemas:
    TextToSpeechRequestDto:
      type: object
      properties:
        text:
          type: string
          description: The text to be converted to speech
          example: Hello, how are you?
        voice:
          type: string
          description: The voice to use for text-to-speech
          default: ame
          enum:
            - ame
            - liora
            - ayana
        model:
          type: string
          description: The model to use for TTS
          example: pawa-tts-v1-20250704
          default: pawa-tts-v1-20250704
          enum:
            - pawa-tts-v1-20250704
        max_tokens:
          type: number
          description: Maximum number of tokens to generate
          default: 65536
        temperature:
          type: number
          description: Sampling temperature
          default: 0.5
          minimum: -2
          maximum: 2
        top_p:
          type: number
          description: Top-p nucleus sampling
          default: 0.95
          minimum: 0
          maximum: 1
        repetition_penalty:
          type: number
          description: Repetition penalty
          default: 1.1
      required:
        - text
        - model
    ErrorResponse:
      required:
        - success
        - message
      type: object
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
          example: An error occurred
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````