API 문서
RESTful API로 AudioToTextAI 전사 기능을 애플리케이션에 통합하세요.
인증
모든 API 요청은 API 키를 사용하여 인증해야 합니다. API 키를 메시지에 포함하십시오. Authorization 헤더:
Authorization: Bearer YOUR_API_KEY
API 키를 찾을 수 있습니다. 계정 설정.
API 키를 비밀로 유지하세요! 클라이언트 코드나 공개 저장소에 절대 노출하지 마십시오.
오디오 전사하기
POST
/api/v1/transcribe/
녹음을 위해 오디오 파일을 업로드합니다. API는 결과를 폴링하는 데 사용할 수 있는 작업 ID를 반환합니다.
요청 본문 (다중 부분/양식 데이터)
| 파라미터 | 종류 | 설명 |
|---|---|---|
file * |
파일 | 오디오 파일(MP3, WAV, M4A, FLAC, OGG 또는 비디오 파일) |
model |
문자열 | 사용할 모델: whisper-large-v3 (기본값) 또는 whisper-turbo |
language |
문자열 | ISO 639- 1 언어 코드 (예: "en", "es"). 자동 검색을 위해 비워두십시오. |
timestamps |
불리언 | 세그먼트 시간 스탬프 포함 (기본값: true) |
word_timestamps |
불리언 | 단어 단위 시간 스탬프 포함 (기본값: false) |
summary |
불리언 | AI 요약 생성 (기본값: false) |
vocabulary |
배열 | 정확도 향상을 위한 사용자 지정 어휘(JSON 배열 또는 쉼표로 구분) |
예제 요청
curl -X POST https://audiototextai.com/api/v1/transcribe/ \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@audio.mp3" \
-F "summary=true" \
-F "language=en"
응답
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"status": "processing",
"estimated_credits": 5.5
}
URL에서 번역하기
POST
/api/v1/transcribe/url/
URL에서 오디오를 녹음합니다. 직접 오디오/비디오 URL과 YouTube 링크를 지원합니다.
요청 본문(JSON)
{
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"summary": true
}
예제 요청
curl -X POST https://audiototextai.com/api/v1/transcribe/url/ \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/podcast.mp3", "summary": true}'
전사 결과 가져오기
GET
/api/v1/transcribe/{id}/
번역 작업의 상태 및 결과를 검색합니다.
쿼리 매개 변수
| 파라미터 | 종류 | 설명 |
|---|---|---|
segments |
불리언 | 시간표시가 있는 상세한 세그먼트 포함 (기본값: false) |
응답 (처리 중)
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"status": "processing",
"progress": 45
}
응답 (완료됨)
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"status": "completed",
"transcript": "Hello and welcome to today's podcast...",
"duration_seconds": 1847.5,
"language": "en",
"credits_used": 31.2,
"summary": "This podcast discusses the future of AI...",
"topics": ["artificial intelligence", "technology", "future"],
"segments": [
{
"start": 0.0,
"end": 5.2,
"text": "Hello and welcome to today's podcast.",
"confidence": 0.98
}
]
}
지원되는 언어 목록
GET
/api/v1/languages/
번역을 위해 지원되는 모든 언어 목록을 얻으십시오.
응답
{
"languages": [
{"code": "", "name": "Auto-detect"},
{"code": "en", "name": "English"},
{"code": "es", "name": "Spanish"},
{"code": "fr", "name": "French"},
...
]
}
웹 후크
오랜 기간 동안 실행되는 번역의 경우 처리가 완료될 때 결과를 받을 수 있는 웹훅 URL을 제공할 수 있습니다.
목록 추가 webhook_url 변환 요청에 매개변수:
curl -X POST https://audiototextai.com/api/v1/transcribe/ \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@audio.mp3" \
-F "webhook_url=https://yourapp.com/transcription-complete"
번역이 완료되면 결과를 웹훅 URL에 POST합니다.
POST https://yourapp.com/transcription-complete
Content-Type: application/json
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"status": "completed",
"transcript": "...",
...
}
오류 처리
API는 표준 HTTP 상태 코드를 사용하고 JSON 형식으로 오류 세부 정보를 반환합니다.
| 상태 | 설명 |
|---|---|
400 |
잘못된 요청: 잘못된 매개변수 또는 필수 필드가 누락되었습니다. |
401 |
무단: API 키가 잘못되었거나 누락되었습니다. |
402 |
지불 필요: 불충분한 크레딧 |
404 |
페이지를 찾을 수 없습니다. |
500 |
서버 오류: 뭔가 잘못되었습니다. |
오류 응답 형식
{
"error": "insufficient_credits",
"message": "You have 10 credits remaining but this transcription requires 30 credits."
}
코드 예제
Python
import requests
API_KEY = "your-api-key"
BASE_URL = "https://audiototextai.com/api/v1"
# Upload and transcribe
with open("audio.mp3", "rb") as f:
response = requests.post(
f"{BASE_URL}/transcribe/",
headers={"Authorization": f"Bearer {API_KEY}"},
files={"file": f},
data={"summary": "true"}
)
job = response.json()
print(f"Job ID: {job['id']}")
# Poll for results
import time
while True:
result = requests.get(
f"{BASE_URL}/transcribe/{job['id']}/",
headers={"Authorization": f"Bearer {API_KEY}"},
params={"segments": "true"}
).json()
if result["status"] == "completed":
print(result["transcript"])
break
elif result["status"] == "failed":
print(f"Error: {result['error_message']}")
break
time.sleep(5)
JavaScript (Node.js)
const fs = require('fs');
const axios = require('axios');
const FormData = require('form-data');
const API_KEY = 'your-api-key';
const BASE_URL = 'https://audiototextai.com/api/v1';
async function transcribe(filePath) {
const form = new FormData();
form.append('file', fs.createReadStream(filePath));
form.append('summary', 'true');
const { data: job } = await axios.post(
`${BASE_URL}/transcribe/`,
form,
{
headers: {
'Authorization': `Bearer ${API_KEY}`,
...form.getHeaders()
}
}
);
console.log(`Job ID: ${job.id}`);
// Poll for results
while (true) {
const { data: result } = await axios.get(
`${BASE_URL}/transcribe/${job.id}/`,
{ headers: { 'Authorization': `Bearer ${API_KEY}` } }
);
if (result.status === 'completed') {
return result;
} else if (result.status === 'failed') {
throw new Error(result.error_message);
}
await new Promise(r => setTimeout(r, 5000));
}
}
transcribe('./audio.mp3').then(console.log);