🚀 PIG AI 新版来袭: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("你好,这是一个文本转语音系统的测试。") );