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

# 音声をテキストに変換

> **対象アプリ**：Chatflow、Workflow、チャットボット、Agent、テキストジェネレーター。

アプリに設定された音声認識モデルを使用して、アップロードされた音声ファイルをテキストに文字起こしします。



## OpenAPI

````yaml /ja/3.11.x/develop/api/openapi_service.json post /audio-to-text
openapi: 3.0.1
info:
  title: Dify サービス API
  description: >-
    Dify アプリケーションとナレッジベースのための REST API です。アプリケーション系エンドポイントはアプリの API
    キーで、ナレッジ系エンドポイントはナレッジベースの API キーで認証します。
  version: 1.0.0
servers:
  - url: https://{api_base_url}
    description: Dify サービス API のベース URL です。ご利用のデプロイ環境の API ベース URL に置き換えてください。
    variables:
      api_base_url:
        default: api.example.com/v1
        description: API ベース URL のホストとパス（`https://` を除く）。
security:
  - ApiKeyAuth: []
tags:
  - name: チャットメッセージ
    description: チャットメッセージとインタラクションに関連する操作です。
  - name: ファイル操作
    description: ファイルのアップロードとプレビューの操作です。
  - name: エンドユーザー
    description: エンドユーザー情報に関連する操作です。
  - name: メッセージフィードバック
    description: ユーザーフィードバックの操作です。
  - name: 会話管理
    description: 会話管理に関連する操作です。
  - name: 音声・テキスト変換
    description: テキスト読み上げと音声認識の操作です。
  - name: アプリケーション設定
    description: アプリケーション設定と情報を取得する操作です。
  - name: アノテーション管理
    description: ダイレクト返信用のアノテーション管理に関連する操作です。
  - name: 人間の入力
    description: 人間の入力を要する一時停止中のワークフローの再開操作です。
  - name: ワークフロー実行
    description: ワークフローの実行と管理のための操作です。
  - name: 完了メッセージ
    description: テキスト生成に関連する操作です。
  - name: ナレッジベース
    description: ナレッジベースの作成、設定、取得を含むナレッジベース管理の操作です。
  - name: ドキュメント
    description: ナレッジベース内のドキュメントの作成、更新、管理のための操作です。
  - name: チャンク
    description: ドキュメントチャンクと子チャンクの管理のための操作です。
  - name: メタデータ
    description: ナレッジベースのメタデータフィールドとドキュメントメタデータ値の管理のための操作です。
  - name: タグ管理
    description: ナレッジベースタグとタグバインディングの管理のための操作です。
  - name: モデル
    description: 利用可能なモデルを取得するための操作です。
  - name: ナレッジパイプライン
    description: データソースプラグインとパイプライン実行を含むナレッジパイプラインの管理と実行のための操作です。
paths:
  /audio-to-text:
    post:
      tags:
        - 音声・テキスト変換
      summary: 音声をテキストに変換
      description: |-
        **対象アプリ**：Chatflow、Workflow、チャットボット、Agent、テキストジェネレーター。

        アプリに設定された音声認識モデルを使用して、アップロードされた音声ファイルをテキストに文字起こしします。
      operationId: basicChatAudioToTextJa
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/AudioToTextRequest'
      responses:
        '200':
          description: 音声からテキストへの変換に成功しました。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AudioToTextResponse'
              examples:
                audioToTextSuccess:
                  summary: レスポンス例
                  value:
                    text: >-
                      Hello, I would like to know more about the iPhone 13 Pro
                      Max.
        '400':
          description: |-
            - `app_unavailable` : アプリケーションが利用できないか、設定が正しくありません。
            - `invalid_param` : このアプリで音声認識が有効になっていません。
            - `provider_not_support_speech_to_text` : モデルプロバイダーが音声認識をサポートしていません。
            - `provider_not_initialize` : 有効なモデルプロバイダーの認証情報が見つかりません。
            - `completion_request_error` : 音声認識リクエストに失敗しました。
          content:
            application/json:
              examples:
                app_unavailable:
                  summary: app_unavailable
                  value:
                    status: 400
                    code: app_unavailable
                    message: App unavailable, please check your app configurations.
                invalid_param:
                  summary: invalid_param
                  value:
                    status: 400
                    code: invalid_param
                    message: Speech to text is not enabled
                provider_not_support_speech_to_text:
                  summary: provider_not_support_speech_to_text
                  value:
                    status: 400
                    code: provider_not_support_speech_to_text
                    message: Provider not support speech to text.
                provider_not_initialize:
                  summary: provider_not_initialize
                  value:
                    status: 400
                    code: provider_not_initialize
                    message: >-
                      No valid model provider credentials found. Please go to
                      Settings -> Model Provider to complete your provider
                      credentials.
                completion_request_error:
                  summary: completion_request_error
                  value:
                    status: 400
                    code: completion_request_error
                    message: Completion request failed.
        '413':
          description: '`audio_too_large` : 音声ファイルが `30 MB` のサイズ上限を超えています。'
          content:
            application/json:
              examples:
                audio_too_large:
                  summary: audio_too_large
                  value:
                    status: 413
                    code: audio_too_large
                    message: Audio size larger than 30 mb
        '415':
          description: >-
            `unsupported_audio_type` : ファイルの MIME
            タイプが、受け付ける音声タイプのいずれでもありません（`file` フィールドを参照）。
          content:
            application/json:
              examples:
                unsupported_audio_type:
                  summary: unsupported_audio_type
                  value:
                    status: 415
                    code: unsupported_audio_type
                    message: Audio type not allowed.
        '500':
          description: '`internal_server_error` : 内部サーバーエラー。'
          content:
            application/json:
              examples:
                internal_server_error:
                  summary: internal_server_error
                  value:
                    status: 500
                    code: internal_server_error
                    message: >-
                      The server encountered an internal error and was unable to
                      complete your request. Either the server is overloaded or
                      there is an error in the application.
      x-codeSamples:
        - lang: bash
          label: cURL
          source: |-
            curl --request POST \
              --url 'https://{api_base_url}/audio-to-text' \
              --header 'Authorization: Bearer {api_key}' \
              --form 'file=@meeting-question.mp3' \
              --form 'user={user}'
components:
  schemas:
    AudioToTextRequest:
      type: object
      description: 音声からテキストへの変換のリクエストボディ。
      required:
        - file
      properties:
        file:
          type: string
          format: binary
          description: >-
            文字起こしする音声ファイルです。受け付ける MIME タイプは
            `audio/mp3`、`audio/m4a`、`audio/wav`、`audio/amr`、`audio/mpga`
            です。それ以外のタイプ（一般的な `audio/mpeg` を含む）は `unsupported_audio_type`
            で拒否されます。最大サイズは `30 MB` です。
        user:
          type: string
          description: >-
            エンドユーザーの識別子。アプリ側で定義し、アプリ内で一意にします。[エンドユーザーの識別](/ja/3.11.x/develop/api/guides/end-user-identity)
            を参照してください。
    AudioToTextResponse:
      type: object
      properties:
        text:
          type: string
          description: 音声認識からの出力テキスト。
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API_KEY
      description: >-
        すべてのリクエストは API キーで認証します：`Authorization: Bearer
        {API_KEY}`。アプリのエンドポイントにはアプリの API キーを、ナレッジのエンドポイントにはナレッジベースの API
        キーを使用します（[Dify API
        クイックスタート](/ja/3.11.x/develop/api/guides/get-started)）。


        キーはサーバーサイドで保管し、クライアントコードには決して埋め込まないでください。キーが欠落または無効なリクエストは HTTP
        `401`（`unauthorized`）で失敗します。

````