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

# Generate Text-to-Speech

> Convert text to speech using various AI voices. The generated audio is returned as a publicly accessible URL.

**Usage Limits:**
- Free plan: Limited words per billing period
- Paid plans: Higher limits based on subscription tier



## OpenAPI

````yaml POST /api/generate-text-to-speech
openapi: 3.0.1
info:
  title: Easy-Peasy.AI API
  description: >-
    OpenAPI Specifications for the Easy-Peasy.AI API.


    All API requests must be authenticated with an API key. Include the
    `x-api-key` API key in the request header with all requests. You can get the
    API key [here](https://easy-peasy.ai/settings/api).
  version: 1.0.4
servers:
  - url: https://easy-peasy.ai
security:
  - apiKeyAuth: []
paths:
  /api/generate-text-to-speech:
    post:
      summary: Generate Text-to-Speech
      description: >-
        Convert text to speech using various AI voices. The generated audio is
        returned as a publicly accessible URL.


        **Usage Limits:**

        - Free plan: Limited words per billing period

        - Paid plans: Higher limits based on subscription tier
      operationId: generateTTS
      parameters:
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
          description: Your API key
          example: 27feb2bb-aeb4-4a83-9fb6-8f3f2a15885e
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TextToSpeechRequest'
            examples:
              basic-example:
                summary: Generate speech with AI voice
                value:
                  voiceID: 21m00Tcm4TlvDq8ikWAM
                  text: >-
                    Hello! This is a test of the text-to-speech API. It supports
                    multiple languages and custom voice settings.
      responses:
        '200':
          description: Successfully generated audio
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TextToSpeechResponse'
              example:
                uuid: 550e8400-e29b-41d4-a716-446655440000
                url: >-
                  https://media.easy-peasy.ai/tts/27feb2bb-aeb4-4a83-9fb6-8f3f2a15885e/6848fb55-48e7-455d-bd56-3cb5ce2cd81e.mp3
                used_characters: 10
                status: completed
        '400':
          description: Bad request - Missing parameters or usage limit reached
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                missing-parameter:
                  value:
                    error: Missing parameter
                limit-reached:
                  value:
                    error: >-
                      You have reached the limit of 10000 characters for your
                      plan. Please upgrade your plan to continue using the
                      service.
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                invalid-api-key:
                  value:
                    error: Invalid API key
                blocked-account:
                  value:
                    error: Your account is blocked. Please contact support.
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Server error. Please try again.
components:
  schemas:
    TextToSpeechRequest:
      type: object
      required:
        - voiceID
        - text
      properties:
        voiceID:
          type: string
          description: >-
            Voice ID to use for generation (get IDs from the Get TTS Voices
            endpoint)
          example: 21m00Tcm4TlvDq8ikWAM
        text:
          type: string
          description: The text to convert to speech
          example: Hello! This is a test of the text-to-speech API.
    TextToSpeechResponse:
      type: object
      properties:
        url:
          type: string
          format: uri
          description: Publicly accessible URL of the generated audio file (MP3)
          example: >-
            https://media.easy-peasy.ai/tts/27feb2bb-aeb4-4a83-9fb6-8f3f2a15885e/6848fb55-48e7-455d-bd56-3cb5ce2cd81e.mp3
        uuid:
          type: string
          format: uuid
          description: ID of the audio
          example: 550e8400-e29b-41d4-a716-446655440000
        used_characters:
          type: integer
          description: Word count of the text (used for billing)
          example: 10
        status:
          type: string
          enum:
            - completed
          description: Status of the speech generation
          example: completed
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message
          example: Invalid API key
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key for authentication. Get yours at
        https://easy-peasy.ai/settings/api

````