Class DashScopeAudioSpeechApi
java.lang.Object
com.alibaba.cloud.ai.dashscope.api.DashScopeAudioSpeechApi
Facade for DashScope TTS APIs. Delegates to Qwen-TTS, WebSocket (Sambert/CosyVoice), and Qwen TTS
Realtime based on model name.
- Author:
- xuguan
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionDashScopeAudioSpeechApi(String baseUrl, String websocketUrl, org.springframework.ai.model.ApiKey apiKey, String workSpaceId, org.springframework.util.MultiValueMap<String, String> headers, org.springframework.web.client.RestClient.Builder restClientBuilder, org.springframework.web.reactive.function.client.WebClient.Builder webClientBuilder, org.springframework.web.client.ResponseErrorHandler responseErrorHandler) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()callQwenTTS(String text, DashScopeAudioSpeechOptions options) reactor.core.publisher.Flux<ByteBuffer>createWebSocketStreamingTask(reactor.core.publisher.Flux<String> textStream, DashScopeAudioSpeechOptions options) Create a WebSocket TTS task with streaming text input (CosyVoice only).reactor.core.publisher.Flux<ByteBuffer>createWebSocketTask(String text, DashScopeAudioSpeechOptions options) org.springframework.ai.model.ApiKeymutate()reactor.core.publisher.Flux<DashScopeTTSApiSpec.DashScopeAudioTTSResponse>streamQwenTTS(String text, DashScopeAudioSpeechOptions options)
-
Constructor Details
-
DashScopeAudioSpeechApi
public DashScopeAudioSpeechApi(String baseUrl, String websocketUrl, org.springframework.ai.model.ApiKey apiKey, String workSpaceId, org.springframework.util.MultiValueMap<String, String> headers, org.springframework.web.client.RestClient.Builder restClientBuilder, org.springframework.web.reactive.function.client.WebClient.Builder webClientBuilder, org.springframework.web.client.ResponseErrorHandler responseErrorHandler)
-
-
Method Details
-
getStrategyRegistry
-
getQwenTTSRealtimeApi
-
callQwenTTS
public DashScopeTTSApiSpec.DashScopeAudioTTSResponse callQwenTTS(String text, DashScopeAudioSpeechOptions options) -
streamQwenTTS
public reactor.core.publisher.Flux<DashScopeTTSApiSpec.DashScopeAudioTTSResponse> streamQwenTTS(String text, DashScopeAudioSpeechOptions options) -
createWebSocketTask
public reactor.core.publisher.Flux<ByteBuffer> createWebSocketTask(String text, DashScopeAudioSpeechOptions options) -
createWebSocketStreamingTask
public reactor.core.publisher.Flux<ByteBuffer> createWebSocketStreamingTask(reactor.core.publisher.Flux<String> textStream, DashScopeAudioSpeechOptions options) Create a WebSocket TTS task with streaming text input (CosyVoice only). Each element in textStream is sent as a separate continue-task message, enabling true streaming text-to-speech synthesis. -
getWebSocketTTSApi
-
mutate
-
getBaseUrl
-
getWebsocketUrl
-
getApiKey
public org.springframework.ai.model.ApiKey getApiKey() -
getWorkSpaceId
-
getHeaders
-
builder
-