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

# OpenAI 转录

> 使用 OpenAI 的 Whisper 模型进行语音转文本

# OpenAI 转录

Spring AI 集成了 OpenAI 的 Whisper 模型，以实现语音转文本功能。

## 配置

将以下依赖项添加到您的项目中：

```xml theme={"system"}
<dependency>
    <groupId>org.springframework.ai</groupId>
    <artifactId>spring-ai-openai-spring-boot-starter</artifactId>
</dependency>
```

## 属性

```properties theme={"system"}
spring.ai.openai.api-key=YOUR_API_KEY
spring.ai.openai.audio.model=whisper-1
```

## 用法

```java theme={"system"}
@Autowired
private TranscriptionClient transcriptionClient;

// 转录音频
TranscriptionResponse response = transcriptionClient.call(
    new TranscriptionPrompt(audioFile)
);
```

<Card title="文档有误？请协助编辑" icon="pencil" href="https://github.com/javaai-pig4cloud-com/javaai-docs/edit/main/spring-ai/api/audio/transcriptions/openai-transcriptions.mdx">
  发现文档问题？点击此处直接在 GitHub 上编辑并提交 PR，帮助我们改进文档！
</Card>
