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 语音
Spring AI 集成了 OpenAI 的文本转语音 (TTS) 模型,以实现语音合成功能。
将以下依赖项添加到您的项目中:
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-openai-spring-boot-starter</artifactId>
</dependency>
spring.ai.openai.api-key=YOUR_API_KEY
spring.ai.openai.speech.model=tts-1
@Autowired
private SpeechClient speechClient;
// 生成语音
SpeechResponse response = speechClient.call(
new SpeechPrompt("你好,这是一个文本转语音系统的测试。")
);
文档有误?请协助编辑
发现文档问题?点击此处直接在 GitHub 上编辑并提交 PR,帮助我们改进文档!