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

# Generate speech

> Convert text to speech using ElevenLabs voices. Returns a job that you poll or stream for completion.

Use `GET /voices` to browse all available voices with previews.




## OpenAPI

````yaml /openapi.yaml post /speech
openapi: 3.1.0
info:
  title: Varg Gateway API
  version: 0.1.0
  description: >-
    Unified REST API for AI generation (video, image, speech, music) at
    api.varg.ai
servers:
  - url: https://api.varg.ai/v1
security:
  - bearerAuth: []
tags:
  - name: Generation
    description: Create AI-generated content
  - name: Jobs
    description: Manage and monitor generation jobs
  - name: Files
    description: Upload files for use in generation
  - name: Reference
    description: Available models and voices
  - name: Media Processing
    description: FFmpeg-powered video utilities (trim, resize, probe, custom commands)
  - name: Account
    description: Account info, balance, and usage
paths:
  /speech:
    post:
      tags:
        - Generation
      summary: Generate speech
      description: >
        Convert text to speech using ElevenLabs voices. Returns a job that you
        poll or stream for completion.


        Use `GET /voices` to browse all available voices with previews.
      operationId: createSpeech
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - text
              properties:
                model:
                  type: string
                  description: >
                    Speech model to use.


                    **Latest:** `eleven_v3` (best quality, multilingual)


                    **Fast:** `eleven_flash_v2_5`, `eleven_flash_v2` (lowest
                    latency)


                    **Turbo:** `eleven_turbo_v2_5`, `eleven_turbo_v2`, `turbo`
                    (balanced)


                    **Multilingual:** `eleven_multilingual_v2` (29 languages)
                  examples:
                    - eleven_v3
                    - eleven_flash_v2_5
                    - eleven_multilingual_v2
                    - eleven_turbo_v2_5
                    - turbo
                text:
                  type: string
                  description: Text to convert to speech
                  example: Hello everyone! Welcome to my channel.
                voice:
                  type: string
                  description: >-
                    Voice name or ElevenLabs voice_id. Use `GET /voices` to
                    browse available voices.
                  default: rachel
                  enum:
                    - rachel
                    - domi
                    - sarah
                    - antoni
                    - elli
                    - josh
                    - arnold
                    - adam
                    - sam
                provider_options:
                  type: object
                  description: >-
                    Additional options passed directly to the provider (e.g.
                    stability, similarity_boost, style)
                  additionalProperties: true
            examples:
              eleven-v3:
                summary: ElevenLabs V3 — best quality
                value:
                  model: eleven_v3
                  text: >-
                    Welcome to today's episode. We'll be exploring the
                    fascinating world of deep sea creatures.
                  voice: rachel
              eleven-multilingual:
                summary: ElevenLabs Multilingual — 29 languages
                value:
                  model: eleven_multilingual_v2
                  text: Bonjour tout le monde! Bienvenue sur ma chaîne.
                  voice: sarah
              eleven-flash:
                summary: ElevenLabs Flash — low latency
                value:
                  model: eleven_flash_v2_5
                  text: >-
                    Breaking news: scientists have discovered a new species of
                    deep-sea fish.
                  voice: josh
              turbo:
                summary: Turbo — balanced speed and quality
                value:
                  model: turbo
                  text: >-
                    Hey there! Just wanted to share a quick update on the
                    project.
                  voice: adam
      responses:
        '202':
          description: Job created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobResponse'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/AuthError'
        '402':
          $ref: '#/components/responses/InsufficientBalanceError'
        '429':
          $ref: '#/components/responses/RateLimitError'
        '500':
          $ref: '#/components/responses/InternalError'
        '502':
          $ref: '#/components/responses/ProviderError'
components:
  schemas:
    JobResponse:
      type: object
      required:
        - job_id
        - status
        - model
        - created_at
      properties:
        job_id:
          type: string
          description: Unique job identifier
          example: job_a1b2c3d4
        status:
          type: string
          enum:
            - queued
            - processing
            - completed
            - failed
            - cancelled
          description: Current job status
          example: completed
        model:
          type: string
          description: Resolved model identifier (provider:model format)
          example: fal:kling-v2.5
        created_at:
          type: string
          format: date-time
          description: When the job was created
          example: '2026-02-13T10:00:00Z'
        completed_at:
          type: string
          format: date-time
          description: When the job finished (completed, failed, or cancelled)
          example: '2026-02-13T10:02:30Z'
        output:
          type: object
          description: Job output, present when status is completed
          properties:
            url:
              type: string
              format: uri
              description: URL of the generated file on s3.varg.ai
              example: https://s3.varg.ai/o/job_a1b2c3d4.mp4
            media_type:
              type: string
              description: MIME type of the output
              example: video/mp4
        cache:
          type: object
          description: Cache metadata
          properties:
            hit:
              type: boolean
              description: Whether this result was served from cache
              example: false
            key:
              type: string
              description: Cache key for this request
              example: sha256:abc123...
        error:
          type: string
          description: Error message, present when status is failed
          example: Provider returned an error
    ErrorResponse:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: string
          description: Error code
          example: ValidationError
        message:
          type: string
          description: Human-readable error description
          example: prompt is required
        field:
          type: string
          description: The field that caused the error, if applicable
          example: prompt
        provider:
          type: string
          description: The upstream provider that returned the error, if applicable
          example: fal
        statusCode:
          type: number
          description: HTTP status code
          example: 400
  responses:
    ValidationError:
      description: Invalid request body
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: ValidationError
            message: prompt is required
            field: prompt
            statusCode: 400
    AuthError:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: AuthError
            message: Invalid API key
            statusCode: 401
    InsufficientBalanceError:
      description: Account balance too low
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: InsufficientBalanceError
            message: Insufficient balance. Add credits at varg.ai/dashboard.
            statusCode: 402
    RateLimitError:
      description: Too many requests
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: RateLimitError
            message: Rate limit exceeded. Retry after 60 seconds.
            statusCode: 429
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: InternalError
            message: An unexpected error occurred
            statusCode: 500
    ProviderError:
      description: Upstream provider returned an error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: ProviderError
            message: Provider returned an error
            provider: fal
            statusCode: 502
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: varg_xxx
      description: |
        API key from [varg.ai/dashboard](https://varg.ai/dashboard).

        Pass as `Authorization: Bearer varg_xxx`.

````