接口 TTSModel

所有已知子接口:
RealtimeTTSModel
所有已知实现类:
DashScopeRealtimeTTSModel, DashScopeTTSModel

public interface TTSModel
Text-to-Speech model interface.

This interface defines the contract for TTS models that convert text to audio. Implementations may support various TTS providers such as DashScope, OpenAI, etc.

Example usage:


 TTSModel tts = DashScopeTTSModel.builder()
     .apiKey("your-api-key")
     .modelName("qwen3-tts-flash")
     .voice("Cherry")
     .build();

 TTSResponse response = tts.synthesize("Hello, world!", null).block();
 byte[] audioData = response.getAudioData();
 
  • 方法详细资料

    • synthesize

      reactor.core.publisher.Mono<TTSResponse> synthesize(String text, TTSOptions options)
      Synthesize text to audio.
      参数:
      text - the text to synthesize
      options - optional TTS options (null to use defaults)
      返回:
      Mono of TTSResponse containing audio data
    • getModelName

      String getModelName()
      Get model name for logging and identification.
      返回:
      the model name