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

# Turn text into speech

> Returns an MP3 audioUrl, an r2Key and word timings. voiceId must be one of your voices or a premade preset. Inline audio tags like [laughs] work on eleven_v4 and are skipped in the word timings.



## OpenAPI

````yaml /openapi.json post /api/v1/speech
openapi: 3.1.0
info:
  title: VidGuy API
  version: 1.0.0
  description: >-
    Make videos, snacks, carousels, images and audio with VidGuy, and post them
    to your connected accounts. Authenticate with a `vf_live_` key as a Bearer
    token.
servers:
  - url: https://www.vidguy.ai
security:
  - ApiKeyAuth: []
tags:
  - name: Jobs
  - name: Credits
  - name: Brands
  - name: Snacks and memes
  - name: Videos
  - name: Carousels and slides
  - name: Images and video models
  - name: Characters
  - name: Editing
  - name: Assets
  - name: Audio
  - name: Social posting
paths:
  /api/v1/speech:
    post:
      tags:
        - Audio
      summary: Turn text into speech
      description: >-
        Returns an MP3 audioUrl, an r2Key and word timings. voiceId must be one
        of your voices or a premade preset. Inline audio tags like [laughs] work
        on eleven_v4 and are skipped in the word timings.
      operationId: generateSpeech
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateSpeechRequest'
      responses:
        '200':
          description: Audio URL + word timings.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
        '400':
          description: Invalid request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '402':
          description: Insufficient credits.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Voice not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: Voice service failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    GenerateSpeechRequest:
      type: object
      properties:
        text:
          type: string
          minLength: 1
          maxLength: 5000
        voiceId:
          type: string
          minLength: 1
        modelId:
          type: string
          enum:
            - eleven_v4
            - eleven_v4_turbo
            - eleven_multilingual_v2
        languageCode:
          type: string
        stability:
          type: number
          minimum: 0
          maximum: 1
        similarityBoost:
          type: number
          minimum: 0
          maximum: 1
        style:
          type: number
          minimum: 0
          maximum: 1
        seed:
          type: integer
      required:
        - text
        - voiceId
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          example: Invalid request
        message:
          type: string
        details:
          type: object
          additionalProperties: {}
      required:
        - error
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: 'Send your API key in the Authorization header: `Bearer vf_live_...`'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.