Chuyển đến nội dung chính
POST
/
v1
/
audio
/
transcriptions
curl -X POST "https://api.lemondata.cc/v1/audio/transcriptions" \
  -H "Authorization: Bearer sk-your-api-key" \
  -F file="@audio.mp3" \
  -F model="whisper-1" \
  -F language="en"
{
  "text": "Hello, this is a test of the transcription API."
}

Request Body

file
file
bắt buộc
Tệp âm thanh cần phiên âm. Các định dạng được hỗ trợ: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm.
model
string
mặc định:"whisper-1"
Mô hình sử dụng. Hiện tại chỉ hỗ trợ whisper-1.
language
string
Ngôn ngữ của âm thanh ở định dạng ISO-639-1 (ví dụ: en, zh, ja).
prompt
string
Văn bản tùy chọn để hướng dẫn phong cách của mô hình hoặc tiếp tục một phân đoạn trước đó.
response_format
string
mặc định:"json"
Định dạng đầu ra: json, text, srt, verbose_json, vtt.
temperature
number
mặc định:"0"
Nhiệt độ lấy mẫu (0 đến 1).
timestamp_granularities
array
Độ chi tiết của dấu thời gian: word và/hoặc segment. Yêu cầu verbose_json.

Phản hồi

text
string
Văn bản đã được phiên âm.
Đối với verbose_json:
task
string
Luôn là transcribe.
language
string
Ngôn ngữ được phát hiện.
duration
number
Thời lượng âm thanh tính bằng giây.
segments
array
Các phân đoạn phiên âm kèm theo dấu thời gian.
words
array
Dấu thời gian cấp độ từ (nếu được yêu cầu).
curl -X POST "https://api.lemondata.cc/v1/audio/transcriptions" \
  -H "Authorization: Bearer sk-your-api-key" \
  -F file="@audio.mp3" \
  -F model="whisper-1" \
  -F language="en"
{
  "text": "Hello, this is a test of the transcription API."
}

Dịch thuật

Để dịch âm thanh sang tiếng Anh, hãy sử dụng endpoint translations:
response = client.audio.translations.create(
    model="whisper-1",
    file=audio_file
)