Skip to content

音声文字起こし API (POST /v1/audio/transcriptions) ​

音声ファイルを指定したフォーマットのテキストに文字起こしします。OpenAI API プロトコル仕様に完全準拠しています。


HTTP リクエスト ​

http
POST /v1/audio/transcriptions
Authorization: Bearer sk-oneasr-...
Content-Type: multipart/form-data

リクエストボディのフィールド仕様 (Multipart Form) ​

フィールド名型必須パラメータ説明
filebinary必須音声ファイルのバイナリデータ (mp3, mp4, wav, m4a, ogg, webm, flac など)。
modelstring必須呼び出すエンジン / モデル名(例: faster-whisper, qwen, whisper-1)。
languagestring任意ISO-639-1 言語コード(例: zh, en, ja, de, ko)。
promptstring任意文字起こしのスタイルや専門用語を誘導するコンテキストプロンプト。
response_formatstring任意レスポンスデータ形式:json (デフォルト), text, srt, verbose_json, vtt。
temperaturenumber任意サンプリング温度パラメータ (0.0 〜 1.0、デフォルト: 0.0)。
timestamp_granularitiesarray任意タイムスタンプ粒度:["word"] (単語単位), ["segment"] (文単位)。

呼び出しサンプルコード ​

cURL ​

bash
curl -X POST http://localhost:8000/v1/audio/transcriptions   -H "Authorization: Bearer sk-oneasr-v1-xxx"   -F file="@meeting.mp3"   -F model="faster-whisper"   -F language="ja"   -F response_format="verbose_json"

Python (公式 OpenAI SDK) ​

python
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8000/v1",
    api_key="sk-oneasr-v1-xxx"
)

with open("speech.mp3", "rb") as f:
    result = client.audio.transcriptions.create(
        model="faster-whisper",
        file=f,
        response_format="verbose_json"
    )

print(result.text)

レスポンス例 (verbose_json) ​

json
{
  "task": "transcribe",
  "language": "japanese",
  "duration": 5.24,
  "text": "OneASR 高性能プライベート音声認識ゲートウェイへようこそ。",
  "segments": [
    {
      "id": 0,
      "seek": 0,
      "start": 0.0,
      "end": 5.2,
      "text": "OneASR 高性能プライベート音声認識ゲートウェイへようこそ。",
      "tokens": [50364, 4843, 284, 1530, 50589],
      "temperature": 0.0,
      "avg_logprob": -0.12,
      "compression_ratio": 1.1,
      "no_speech_prob": 0.001
    }
  ]
}