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

# 创建语音

> Creates speech audio from text. Use the specialized endpoint when required by the control panel.

将文本转换为语音。部分语音能力可能需要使用 `api-s1` 系列端点。


## OpenAPI

````yaml api-reference/openapi.json POST /audio/speech
openapi: 3.1.0
info:
  title: AIOAGI OpenAI-compatible API
  description: >-
    OpenAI-compatible API surface for AIOAGI model access. Endpoint
    availability, model names, and billing rules depend on your account and the
    current control panel configuration.
  version: 1.0.0
servers:
  - url: https://api.aiearth.dev/v1
    description: General API endpoint
  - url: https://api.aiearth.vip/v1
    description: CDN accelerated API endpoint
  - url: https://api-s1.aiearth.dev/v1
    description: Specialized endpoint for account and realtime capabilities
  - url: https://api-s1.aiearth.vip/v1
    description: CDN accelerated specialized endpoint
security:
  - bearerAuth: []
paths:
  /audio/speech:
    post:
      summary: Create speech
      description: >-
        Creates speech audio from text. Use the specialized endpoint when
        required by the control panel.
      operationId: createSpeech
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SpeechRequest'
      responses:
        '200':
          description: Audio response
          content:
            audio/mpeg:
              schema:
                type: string
                format: binary
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    SpeechRequest:
      type: object
      properties:
        model:
          type: string
        input:
          type: string
        voice:
          type: string
        format:
          type: string
          enum:
            - mp3
            - wav
            - opus
            - flac
          default: mp3
      required:
        - model
        - input
        - voice
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type: string
  responses:
    BadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key

````