类 DashScopeTTSModel

java.lang.Object
io.agentscope.core.model.tts.DashScopeTTSModel
所有已实现的接口:
TTSModel

public class DashScopeTTSModel extends Object implements TTSModel
DashScope TTS Model implementation.

This implementation uses direct HTTP calls to DashScope's TTS API, supporting multiple TTS models including:

  • qwen3-tts-flash - Qwen3 TTS fast model
  • qwen-tts - Qwen TTS model
  • sambert-* - Sambert series (e.g., sambert-zhimao-v1)
  • cosyvoice-* - CosyVoice series

Example usage:


 DashScopeTTSModel tts = DashScopeTTSModel.builder()
     .apiKey(System.getenv("DASHSCOPE_API_KEY"))
     .modelName("qwen3-tts-flash")
     .voice("Cherry")
     .build();

 TTSResponse response = tts.synthesize("你好,世界!", null).block();
 byte[] audioData = response.getAudioData();
 
另请参阅:
  • 字段详细资料

    • DEFAULT_BASE_URL

      public static final String DEFAULT_BASE_URL
      Default base URL for DashScope API.
      另请参阅:
    • TTS_ENDPOINT

      public static final String TTS_ENDPOINT
      TTS API endpoint (uses multimodal-generation for qwen-tts models).
      另请参阅:
  • 方法详细资料

    • synthesize

      public reactor.core.publisher.Mono<TTSResponse> synthesize(String text, TTSOptions options)
      Synthesizes speech from text using DashScope TTS API.
      指定者:
      synthesize 在接口中 TTSModel
      参数:
      text - the text to convert to speech
      options - optional TTS configuration, uses defaults if null
      返回:
      a Mono containing the TTS response with audio data
    • getModelName

      public String getModelName()
      Returns the name of the TTS model being used.
      指定者:
      getModelName 在接口中 TTSModel
      返回:
      the model name (e.g., "qwen3-tts-flash", "qwen-tts")
    • builder

      public static DashScopeTTSModel.Builder builder()
      Creates a new builder for DashScopeTTSModel.
      返回:
      a new Builder instance