> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arouter.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 오디오

> 오디오 파일을 입력으로 전송하고 음성 오디오를 출력으로 받습니다. ARouter는 오디오 전사, 번역, 텍스트 음성 변환 및 멀티모달 오디오 모델을 지원합니다.

ARouter는 세 가지 모드에서 포괄적인 오디오 지원을 제공합니다: **음성 텍스트 변환**（전사 및 번역）, **텍스트 음성 변환**（TTS）, **오디오 채팅**（오디오 입력을 받아 음성 출력을 생성하는 멀티모달 모델）.

## 오디오 전사

OpenAI 호환 `/v1/audio/transcriptions` 엔드포인트를 사용하여 오디오 파일을 텍스트로 전사합니다.

```bash theme={null}
curl https://api.arouter.ai/v1/audio/transcriptions \
  -H "Authorization: Bearer lr_live_xxxx" \
  -F file="@audio.mp3" \
  -F model="openai/whisper-large-v3"
```

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    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)
    ```
  </Tab>

  <Tab title="Node.js">
    ```typescript theme={null}
    import OpenAI from "openai";
    import fs from "fs";
    const client = new OpenAI({ baseURL: "https://api.arouter.ai/v1", apiKey: "lr_live_xxxx" });
    const transcription = await client.audio.transcriptions.create({
      model: "openai/whisper-large-v3", file: fs.createReadStream("audio.mp3"), response_format: "text"
    });
    console.log(transcription.text);
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl https://api.arouter.ai/v1/audio/transcriptions \
      -H "Authorization: Bearer lr_live_xxxx" \
      -F file="@audio.mp3" \
      -F model="openai/whisper-large-v3" \
      -F response_format="text"
    ```
  </Tab>
</Tabs>

### 전사 파라미터

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

### 단어 수준 타임스탬프

```python theme={null}
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}")
```

***

## 오디오 번역

모든 언어의 오디오를 영어 텍스트로 번역합니다:

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    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)
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl https://api.arouter.ai/v1/audio/translations \
      -H "Authorization: Bearer lr_live_xxxx" \
      -F file="@foreign_audio.mp3" \
      -F model="openai/whisper-large-v3"
    ```
  </Tab>
</Tabs>

***

## 텍스트 음성 변환

텍스트를 자연스러운 음성으로 변환합니다:

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    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")
    ```
  </Tab>

  <Tab title="Node.js">
    ```typescript theme={null}
    import fs from "fs";
    const response = await client.audio.speech.create({
      model: "openai/tts-1-hd", voice: "nova",
      input: "Hello! Welcome to ARouter, the universal AI gateway."
    });
    const buffer = Buffer.from(await response.arrayBuffer());
    fs.writeFileSync("output.mp3", buffer);
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl https://api.arouter.ai/v1/audio/speech \
      -H "Authorization: Bearer lr_live_xxxx" \
      -H "Content-Type: application/json" \
      -d '{"model": "openai/tts-1-hd", "input": "Hello! Welcome to ARouter.", "voice": "nova"}' \
      --output output.mp3
    ```
  </Tab>
</Tabs>

### TTS 파라미터

| 파라미터              | 타입       | 설명                                                          |
| ----------------- | -------- | ----------------------------------------------------------- |
| `model`           | `string` | TTS 모델（예: `openai/tts-1` 또는 `openai/tts-1-hd`）              |
| `input`           | `string` | 합성할 텍스트. 최대 4,096자.                                         |
| `voice`           | `string` | 사용할 음성: `alloy`, `echo`, `fable`, `onyx`, `nova`, `shimmer` |
| `response_format` | `string` | 오디오 형식: `mp3`（기본값）, `opus`, `aac`, `flac`, `wav`, `pcm`     |
| `speed`           | `number` | 재생 속도 `0.25`에서 `4.0`（기본값 `1.0`）                             |

### 사용 가능한 음성

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

***

## 오디오 채팅（멀티모달 모델）

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

### 오디오 입력

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

### 지원되는 입력 오디오 형식

| 형식     | MIME 타입      |
| ------ | ------------ |
| `wav`  | `audio/wav`  |
| `mp3`  | `audio/mpeg` |
| `ogg`  | `audio/ogg`  |
| `flac` | `audio/flac` |
| `m4a`  | `audio/m4a`  |
| `webm` | `audio/webm` |

### 오디오 출력

모델 응답의 일부로 음성 오디오를 요청합니다:

```json theme={null}
{
  "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-v3`       | 99개 이상 | 최고 정확도   |
| `openai/whisper-large-v3-turbo` | 99개 이상 | 더 빠르고 저렴 |

### 텍스트 음성 변환

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

***

## Token 가격

오디오 Token은 `usage.prompt_tokens_details`에서 별도로 추적됩니다:

```json theme={null}
{
  "usage": {
    "prompt_tokens": 150,
    "prompt_tokens_details": {"audio_tokens": 100, "cached_tokens": 0},
    "completion_tokens": 50,
    "completion_tokens_details": {"audio_tokens": 30}
  }
}
```

<Note>
  오디오 Token은 텍스트 Token과 다른 요금이 적용됩니다. 각 요청의 실제 비용은 응답의 `usage.cost`를 확인하세요.
</Note>
