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

# 语音转文本

目前支持文本转语音的模型有 `whisper-1`、`gpt-4o-transcribe` 以及 `gpt-4o-mini-transcribe`，你可以通过如下方式调用：

```bash theme={null}
curl --location 'https://geekai.co/api/v1/audio/transcriptions' \
    --header 'Authorization: {YOUR_GEEKAI_API_KEY}' \
    --form 'file=@"/C:/User/GeekAI/test.mp3"' \
    --form 'model="whisper-1"' \
    --form 'response_format="text"'
```

Linux 下文件路径示例：

```bash theme={null}
curl --location 'https://geekai.co/api/v1/audio/transcriptions' \
    --header 'Authorization: {YOUR_GEEKAI_API_KEY}' \
    --form 'file=@/home/geekai/test.mp3' \
    --form 'model=whisper-1' \
    --form 'response_format=text'
```

其中 `gpt-4o-transcribe` 以及 `gpt-4o-mini-transcribe` 仅支持 `json` 响应（`response_format=json`）。

### 音频格式

OpenAI 支持的上传音频格式如下：

* `flac`
* `mp3`
* `mp4`
* `mpeg`
* `mpga`
* `m4a`
* `ogg`
* `wav`
* `webm`

如果客户端通过 curl 上传这些类型音频文件报错：

```bash theme={null}
file type should be mp3, mp4, wav, wave, mpeg, webm or m4a
```

这是因为 curl 自动识别音频文件的媒体类型不正确，可以通过以下方式来强制指定音频文件的媒体类型解决：

```bash theme={null}
curl --location 'https://geekai.co/api/v1/audio/transcriptions' \
    --header 'Authorization: {YOUR_GEEKAI_API_KEY}' \
    --form 'file=@/home/geekai/test.m4a;type=audio/mp4' \
    --form 'model=whisper-1' \
    --form 'response_format=text'
```
