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

# 创建语音转文本请求

> Creates an audio transcription.



## OpenAPI

````yaml post /audio/transcriptions
openapi: 3.0.0
info:
  title: SiliconFlow API
  description: The SiliconFlow REST API
  version: 1.0.0
  contact:
    name: SiliconFlow Support
    url: https://www.siliconflow.cn/
  license:
    name: MIT
    url: https://github.com/siliconflow/siliconcloud/blob/main/LICENSE
servers:
  - url: https://api.siliconflow.cn/v1
security:
  - bearerAuth: []
paths:
  /audio/transcriptions:
    post:
      tags:
        - Audio
      summary: Create Audio Transcriptions
      description: Creates an audio transcription.
      operationId: createAudioTranscriptions
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/AudioRequest'
      responses:
        '200':
          description: >-
            The response from the model. The response header contains the
            x-siliconcloud-trace-id field, which serves as a unique identifier
            for tracing requests, facilitating log queries and issue
            troubleshooting.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AudioResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimit'
        '503':
          $ref: '#/components/responses/Overloaded'
        '504':
          $ref: '#/components/responses/Timeout'
      deprecated: false
      x-codeSamples:
        - lang: python
          label: Python
          source: |
            import requests
            url = "https://api.siliconflow.cn/v1/audio/transcriptions"
            file_path = "path/to/your/audio.mp3"
            headers = {
                "Authorization": "Bearer <YOUR_API_KEY>"
            }
            with open(file_path, "rb") as audio_file:
                files = {
                    "file": ("audio.mp3", audio_file),  # 根据文件类型调整 MIME 类型
                    "model": (None, "FunAudioLLM/SenseVoiceSmall")
                }
                response = requests.post(url, headers=headers, files=files)
        - lang: curl
          label: cURL
          source: |
            curl --request POST \
              --url https://api.siliconflow.cn/v1/audio/transcriptions \
              -H "Authorization: Bearer <YOUR_API_KEY>" \
              -F "file=@path/to/your/audio.mp3" \
              -F "model=FunAudioLLM/SenseVoiceSmall"
        - lang: javaScript
          label: javaScript
          source: |
            fetch('https://api.siliconflow.cn/v1/audio/transcriptions', {
              method: 'POST',
              headers: {
                'Authorization': 'Bearer <YOUR_API_KEY>'
              },
              body: JSON.stringify({
                model: 'FunAudioLLM/SenseVoiceSmall',
                file: 'path/to/your/audio.mp3'
              })
            })
            .then(response => response.json())
            .then(data => console.log(data))
            .catch(error => console.error('Error:', error));
components:
  schemas:
    AudioRequest:
      type: object
      required:
        - model
        - file
      properties:
        file:
          type: string
          description: >-
            The audio file object (not file name) to transcribe.

            File upload specifications are limited to:**duration not exceeding 1
            hour, and file size not exceeding 50MB**.
          example: /path/to/file/audio.mp3
          format: binary
        model:
          type: string
          description: >-
            Corresponding Model Name. To better enhance service quality, we will
            make periodic changes to the models provided by this service,
            including but not limited to model on/offlining and adjustments to
            model service capabilities. We will notify you of such changes
            through appropriate means such as announcements or message pushes
            where feasible.
          example: FunAudioLLM/SenseVoiceSmall
          enum:
            - FunAudioLLM/SenseVoiceSmall
            - TeleAI/TeleSpeechASR
    AudioResponse:
      type: object
      description: >-
        Represents a transcription response returned by model, based on the
        provided input.
      required:
        - text
      properties:
        text:
          description: The transcribed text.
          type: string
    BadRquestData:
      type: object
      required:
        - message
        - data
        - code
      properties:
        code:
          type: integer
          nullable: true
          default: false
          example: 20012
        message:
          type: string
          nullable: false
        data:
          type: string
          nullable: false
    UnauthorizedData:
      type: string
      default: false
      example: Invalid token
    ForbiddenData:
      type: string
      default: false
      example: Forbidden
    NotFoundData:
      type: string
      default: false
      example: 404 page not found
    RateLimitData:
      type: object
      required:
        - message
        - data
      properties:
        message:
          type: string
          example: >-
            Request was rejected due to rate limiting. If you want more, please
            contact contact@siliconflow.cn. Details:TPM limit reached.
        data:
          type: string
    OverloadedtData:
      type: object
      required:
        - code
        - message
        - data
      properties:
        code:
          type: integer
          example: 50505
        message:
          type: string
          example: Model service overloaded. Please try again later.
        data:
          type: string
          nullable: false
    TimeoutData:
      type: string
  responses:
    BadRequest:
      description: BadRequest
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BadRquestData'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UnauthorizedData'
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ForbiddenData'
    NotFound:
      description: NotFound
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NotFoundData'
    RateLimit:
      description: RateLimit
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitData'
    Overloaded:
      description: Overloaded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OverloadedtData'
    Timeout:
      description: Timeout
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/TimeoutData'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: your api key
      description: >-
        Use the following format for authentication: Bearer [<your api
        key>](https://cloud.siliconflow.cn/account/ak)

````