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

# Text to speech

> Converts text into an audio file. Requires an AI key with the voice scope.



## OpenAPI

````yaml en/openapi/en-openai-api-openapi.yaml POST /v1/audio/speech
openapi: 3.1.0
info:
  title: ER:LC Russia - OpenAI-Compatible API
  version: 1.0.0
  description: >-
    OpenAI-compatible Chat Completions, model listing and retrieval, and speech
    methods for ER:LC Russia. See each method for its supported parameters.
servers:
  - url: https://api.erlcrussia.com
    description: Main server
  - url: https://api.erlcrussia.xyz
    description: Backup server
security: []
tags:
  - name: Audio
  - name: Chat Completions
  - name: Models
paths:
  /v1/audio/speech:
    post:
      tags:
        - Audio
      summary: Text to speech
      description: >-
        Converts text into an audio file. Requires an AI key with the voice
        scope.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - input
              properties:
                model:
                  type: string
                  enum:
                    - emmy-voice-1
                    - supertonic
                    - tts-1
                    - tts-1-hd
                  default: emmy-voice-1
                input:
                  type: string
                  minLength: 1
                  maxLength: 6000
                  description: Текст для озвучивания.
                language:
                  type: string
                  enum:
                    - ru
                    - uk
                    - be
                    - en
                    - es
                    - it
                    - fr
                    - zh
                    - ja
                    - ko
                  default: ru
                voice:
                  type: string
                  enum:
                    - default
                    - F1
                    - F2
                    - emmy
                    - emmy-v2
                    - alloy
                    - nova
                  default: default
                response_format:
                  type: string
                  enum:
                    - mp3
                    - wav
                    - pcm
                    - aac
                    - flac
                    - opus
                  default: mp3
                speed:
                  type: number
                  minimum: 0.25
                  maximum: 4
                  default: 1
                stream:
                  type: boolean
                  default: false
                  description: >-
                    ER:LC Russia extension: an NDJSON stream with one line per
                    sentence. Use `stream_format: sse` for the OpenAI format.
                stream_format:
                  type: string
                  enum:
                    - audio
                    - sse
                  default: audio
                  description: >-
                    `audio` returns the whole file (default), `sse` streams
                    `speech.audio.delta` and `speech.audio.done` events.
            example:
              model: emmy-voice-1
              input: Привет! Чем я могу помочь?
              language: ru
              voice: F1
              response_format: mp3
              speed: 1
      responses:
        '200':
          description: Successful response.
          content:
            audio/mpeg:
              schema:
                type: string
                format: binary
            application/octet-stream:
              schema:
                type: string
                format: binary
            application/x-ndjson:
              schema:
                type: string
            text/event-stream:
              schema:
                type: string
                description: >-
                  Event stream for `stream_format: sse`: `speech.audio.delta`
                  with base64 audio and `speech.audio.done` with `usage`.
              example: >+
                data: {"type":"speech.audio.delta","audio":"SUQzBAAAAAAA..."}


                data:
                {"type":"speech.audio.done","usage":{"input_tokens":7,"output_tokens":0,"total_tokens":7}}

          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
            openai-processing-ms:
              $ref: '#/components/headers/ProcessingMs'
            x-ratelimit-limit-requests:
              $ref: '#/components/headers/RateLimitRequests'
            x-ratelimit-remaining-requests:
              $ref: '#/components/headers/RateLimitRemainingRequests'
            x-ratelimit-reset-requests:
              $ref: '#/components/headers/RateLimitResetRequests'
        '400':
          description: Invalid request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  message: >-
                    We could not parse the JSON body of your request. Make sure
                    it is valid JSON.
                  type: invalid_request_error
                  param: null
                  code: null
                  erlc_code: '5034'
        '401':
          description: The key is missing or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  message: >-
                    Incorrect API key provided. Check the key or create a new
                    one in the dashboard.
                  type: invalid_request_error
                  param: null
                  code: invalid_api_key
                  erlc_code: '5008'
        '429':
          description: >-
            Rate limit exceeded (`type: requests`) or AI credits ran out (`type:
            insufficient_quota`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                rate_limit:
                  value:
                    error:
                      message: Rate limit reached. Please slow down and retry later.
                      type: requests
                      param: null
                      code: rate_limit_exceeded
                      erlc_code: '5016'
                insufficient_quota:
                  value:
                    error:
                      message: >-
                        You exceeded your current quota, please check your plan
                        and billing details.
                      type: insufficient_quota
                      param: null
                      code: insufficient_quota
                      erlc_code: '5038'
        '503':
          description: The service is temporarily unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  message: Speech synthesis unavailable
                  type: server_error
                  param: null
                  code: null
      security:
        - BearerAuth: []
        - ApiKeyAuth: []
components:
  headers:
    RequestId:
      description: Request ID for support.
      schema:
        type: string
        example: req_8f2c1e9b4a7d4c0e9f1a2b3c4d5e6f70
    ProcessingMs:
      description: Request processing time in milliseconds.
      schema:
        type: integer
        example: 412
    RateLimitRequests:
      description: Request limit in the current window.
      schema:
        type: integer
        example: 120
    RateLimitRemainingRequests:
      description: Requests left in the current window.
      schema:
        type: integer
        example: 119
    RateLimitResetRequests:
      description: Time until the limit resets, for example `1s` or `6m0s`.
      schema:
        type: string
        example: 1s
  schemas:
    ErrorResponse:
      type: object
      description: >-
        An OpenAI-format error. `code` is an OpenAI string code
        (`invalid_api_key`, `model_not_found`, `insufficient_quota`,
        `rate_limit_exceeded`) or `null`. The numeric ER:LC Russia code is in
        `erlc_code`, see [error codes](/en/documentation/error-codes).
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Insufficient AI Credits
            type:
              type: string
              enum:
                - invalid_request_error
                - insufficient_quota
                - requests
                - server_error
              example: insufficient_quota
            param:
              type:
                - string
                - 'null'
              example: null
            code:
              type:
                - string
                - 'null'
              example: insufficient_quota
            erlc_code:
              type: string
              description: ER:LC Russia numeric error code.
              example: '5038'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Passing the authorization token in the Authorization header: Bearer
        <token>.
    ApiKeyAuth:
      type: apiKey
      in: header
      name: erlcrussia-api-ai-key
      description: The key in the erlcrussia-api-ai-key header.

````

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