음성-텍스트 변환은 음성 오디오를 문자로 전사합니다. 오디오 파일을 /audio/transcriptions로 전송하고 전사 모델을 선택한 뒤 원하는 응답 형식을 지정하세요.
기본 사용법
import os
import requests
with open("meeting.mp3", "rb") as audio:
response = requests.post(
"https://api.venice.ai/api/v1/audio/transcriptions",
headers={"Authorization": f"Bearer {os.environ['VENICE_API_KEY']}"},
files={"file": audio},
data={
"model": "nvidia/parakeet-tdt-0.6b-v3",
"response_format": "json",
},
)
response.raise_for_status()
print(response.json()["text"])
import { createReadStream } from "node:fs";
import FormData from "form-data";
const form = new FormData();
form.append("file", createReadStream("meeting.mp3"));
form.append("model", "nvidia/parakeet-tdt-0.6b-v3");
form.append("response_format", "json");
const response = await fetch("https://api.venice.ai/api/v1/audio/transcriptions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.VENICE_API_KEY}`,
...form.getHeaders(),
},
body: form,
});
if (!response.ok) {
throw new Error(await response.text());
}
const transcript = await response.json();
console.log(transcript.text);
curl https://api.venice.ai/api/v1/audio/transcriptions \
-H "Authorization: Bearer $VENICE_API_KEY" \
--form [email protected] \
--form model=nvidia/parakeet-tdt-0.6b-v3 \
--form response_format=json
지원 입력
일반적인 오디오 형식으로는 mp3, mp4, mpeg, mpga, m4a, wav, webm, flac, ogg가 있습니다. 현재 모델 지원과 가격 정보는 음성-텍스트 모델 페이지를 참조하세요.
응답 형식
| 형식 | 사용 시점 |
|---|
json | 단순한 { "text": "..." } 응답을 원할 때. |
text | JSON 파싱 없이 순수 텍스트를 원할 때. |
srt | SubRip 자막이 필요할 때. |
vtt | WebVTT 자막이 필요할 때. |
verbose_json | 더 풍부한 타임스탬프 및 세그먼트 메타데이터가 필요할 때. |
전사 결과를 미디어 재생과 함께 쓸 경우 자막 형식을 사용하세요. 요약, 검색 또는 후속 채팅 프롬프트로 전사 결과를 넘길 때는 json이나 text를 사용하세요.
프로덕션 팁
- 가능하면 오디오를 선명하게 유지하고 화자가 겹치지 않도록 하세요.
- 워크플로에 낮은 지연 시간이나 손쉬운 재시도가 필요하다면 매우 긴 녹음을 더 작은 청크로 분할하세요.
- 감사 추적을 위해 각 전사 결과와 함께 원본 오디오 경로, 모델 ID, 응답 형식을 저장하세요.
관련 리소스