메인 콘텐츠로 건너뛰기
ARouter는 세 가지 모드에서 포괄적인 오디오 지원을 제공합니다: 음성 텍스트 변환(전사 및 번역), 텍스트 음성 변환(TTS), 오디오 채팅(오디오 입력을 받아 음성 출력을 생성하는 멀티모달 모델).

오디오 전사

OpenAI 호환 /v1/audio/transcriptions 엔드포인트를 사용하여 오디오 파일을 텍스트로 전사합니다.
curl https://api.arouter.ai/v1/audio/transcriptions \
  -H "Authorization: Bearer lr_live_xxxx" \
  -F file="@audio.mp3" \
  -F model="openai/whisper-large-v3"
from openai import OpenAI
client = OpenAI(base_url="https://api.arouter.ai/v1", api_key="lr_live_xxxx")
with open("audio.mp3", "rb") as audio_file:
    transcription = client.audio.transcriptions.create(
        model="openai/whisper-large-v3", file=audio_file, response_format="text"
    )
print(transcription.text)

전사 파라미터

파라미터타입설명
filefile전사할 오디오 파일. 지원 형식: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm
modelstring모델 ID(예: openai/whisper-large-v3
languagestringBCP-47 언어 코드(예: "en", "ko"). 지정하면 정확도가 향상됩니다.
promptstring전사 스타일을 안내하거나 어휘 힌트를 제공하는 선택적 텍스트
response_formatstring출력 형식: json(기본값), text, srt, verbose_json, vtt
temperaturenumber샘플링 온도 0–1. 값이 높을수록 무작위성이 증가합니다.
timestamp_granularitiesstring[]타임스탬프 출력 세분화: ["word"] 또는 ["segment"]verbose_json 필요)

단어 수준 타임스탬프

transcription = client.audio.transcriptions.create(
    model="openai/whisper-large-v3", file=audio_file,
    response_format="verbose_json", timestamp_granularities=["word"]
)
for word in transcription.words:
    print(f"{word.start:.2f}s - {word.end:.2f}s: {word.word}")

오디오 번역

모든 언어의 오디오를 영어 텍스트로 번역합니다:
with open("foreign_audio.mp3", "rb") as audio_file:
    translation = client.audio.translations.create(
        model="openai/whisper-large-v3", file=audio_file, response_format="text"
    )
print(translation.text)

텍스트 음성 변환

텍스트를 자연스러운 음성으로 변환합니다:
response = client.audio.speech.create(
    model="openai/tts-1-hd", voice="nova",
    input="Hello! Welcome to ARouter, the universal AI gateway."
)
response.stream_to_file("output.mp3")

TTS 파라미터

파라미터타입설명
modelstringTTS 모델(예: openai/tts-1 또는 openai/tts-1-hd
inputstring합성할 텍스트. 최대 4,096자.
voicestring사용할 음성: alloy, echo, fable, onyx, nova, shimmer
response_formatstring오디오 형식: mp3(기본값), opus, aac, flac, wav, pcm
speednumber재생 속도 0.25에서 4.0(기본값 1.0

사용 가능한 음성

음성특성
alloy중립적, 균형 잡힌
echo부드럽고 사려 깊은
fable표현력 있는, 스토리텔링
onyx깊고 권위 있는
nova친근하고 활기찬
shimmer따뜻하고 부드러운

오디오 채팅(멀티모달 모델)

일부 모델은 채팅 메시지 입력으로 오디오를 직접 받아 음성 오디오로 응답할 수 있습니다.

오디오 입력

{
  "model": "openai/gpt-5.4-audio-preview",
  "messages": [{
    "role": "user",
    "content": [{"type": "input_audio", "input_audio": {"data": "<base64-encoded-audio>", "format": "wav"}}]
  }]
}

지원되는 입력 오디오 형식

형식MIME 타입
wavaudio/wav
mp3audio/mpeg
oggaudio/ogg
flacaudio/flac
m4aaudio/m4a
webmaudio/webm

오디오 출력

모델 응답의 일부로 음성 오디오를 요청합니다:
{
  "model": "openai/gpt-5.4-audio-preview",
  "modalities": ["text", "audio"],
  "audio": {"voice": "nova", "format": "mp3"},
  "messages": [{"role": "user", "content": "Tell me a short joke."}]
}

지원 모델

음성 텍스트 변환

모델언어비고
openai/whisper-large-v399개 이상최고 정확도
openai/whisper-large-v3-turbo99개 이상더 빠르고 저렴

텍스트 음성 변환

모델품질지연 시간
openai/tts-1표준낮음
openai/tts-1-hd높음보통

Token 가격

오디오 Token은 usage.prompt_tokens_details에서 별도로 추적됩니다:
{
  "usage": {
    "prompt_tokens": 150,
    "prompt_tokens_details": {"audio_tokens": 100, "cached_tokens": 0},
    "completion_tokens": 50,
    "completion_tokens_details": {"audio_tokens": 30}
  }
}
오디오 Token은 텍스트 Token과 다른 요금이 적용됩니다. 각 요청의 실제 비용은 응답의 usage.cost를 확인하세요.