diff --git a/samples/HttpSpeechSynthesizerUsage.java b/samples/HttpSpeechSynthesizerUsage.java
new file mode 100644
index 0000000..4586a0e
--- /dev/null
+++ b/samples/HttpSpeechSynthesizerUsage.java
@@ -0,0 +1,234 @@
+// Copyright (c) Alibaba, Inc. and its affiliates.
+
+import com.alibaba.dashscope.audio.http_tts.AudioInfo;
+import com.alibaba.dashscope.audio.http_tts.HttpSpeechSynthesisParam;
+import com.alibaba.dashscope.audio.http_tts.HttpSpeechSynthesisResult;
+import com.alibaba.dashscope.audio.http_tts.HttpSpeechSynthesizer;
+import com.alibaba.dashscope.common.ResultCallback;
+import com.alibaba.dashscope.exception.ApiException;
+import com.alibaba.dashscope.exception.InputRequiredException;
+import com.alibaba.dashscope.exception.NoApiKeyException;
+import com.alibaba.dashscope.utils.Constants;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * Example usage of HttpSpeechSynthesizer for HTTP SSE-based text-to-speech synthesis.
+ *
+ *
Make sure to set the DASHSCOPE_API_KEY environment variable before running this example.
+ *
+ * @author DashScope SDK Team
+ */
+public class HttpSpeechSynthesizerUsage {
+
+ /**
+ * Demonstrates synchronous call with SSE - blocks until synthesis is complete and returns audio
+ * data.
+ */
+ public static void syncCall() {
+ System.out.println("=== Synchronous Call with SSE Example ===");
+
+ // Create synthesizer
+ HttpSpeechSynthesizer synthesizer = new HttpSpeechSynthesizer();
+
+ // Build parameters
+ HttpSpeechSynthesisParam param =
+ HttpSpeechSynthesisParam.builder()
+ .model("cosyvoice-v3-flash")
+ .text("我家的后面有一个很大的园。")
+ .voice("longanyang")
+ .format("wav")
+ .sampleRate(24000)
+ .build();
+
+ try {
+ // Call and get complete audio data
+ ByteBuffer audioData = synthesizer.callAndReturnAudio(param);
+
+ // Save to file
+ if (audioData != null && audioData.hasRemaining()) {
+ byte[] bytes = new byte[audioData.remaining()];
+ audioData.get(bytes);
+
+ try (FileOutputStream fos = new FileOutputStream("sync_output.wav")) {
+ fos.write(bytes);
+ System.out.println("Audio saved to sync_output.wav, size: " + bytes.length + " bytes");
+ } catch (IOException e) {
+ System.err.println("Failed to save audio: " + e.getMessage());
+ }
+ }
+
+ } catch (ApiException | NoApiKeyException | InputRequiredException e) {
+ System.err.println("Synthesis failed: " + e.getMessage());
+ }
+ }
+
+ /**
+ * Demonstrates synchronous call without SSE - returns audio URL instead of audio data. This is a
+ * simpler and faster way to get the synthesized audio.
+ */
+ public static void syncCallWithUrl() {
+ System.out.println("\n=== Synchronous Call without SSE (returns Audio URL) ===");
+
+ HttpSpeechSynthesizer synthesizer = new HttpSpeechSynthesizer();
+
+ HttpSpeechSynthesisParam param =
+ HttpSpeechSynthesisParam.builder()
+ .model("cosyvoice-v3-flash")
+ .text("我家的后面有一个很大的园。")
+ .voice("longanyang")
+ .format("wav")
+ .sampleRate(24000)
+ .build();
+
+ try {
+ // Non-SSE call - returns result with audio URL
+ HttpSpeechSynthesisResult result = synthesizer.call(param);
+
+ System.out.println("Request ID: " + result.getRequestId());
+ System.out.println("Finish Reason: " + result.getFinishReason());
+
+ if (result.hasAudioUrl()) {
+ AudioInfo audioInfo = result.getAudioInfo();
+ System.out.println("\nAudio URL: " + audioInfo.getUrl());
+ System.out.println("Audio ID: " + audioInfo.getId());
+ System.out.println("Expires At: " + audioInfo.getExpiresAt());
+ System.out.println("Remaining Time: " + audioInfo.getRemainingSeconds() + " seconds");
+ System.out.println("URL Expired: " + audioInfo.isExpired());
+
+ // You can download the audio from the URL
+ // Example: use HttpURLConnection or any HTTP client to download
+ System.out.println("\nTip: You can download the audio file from the URL above.");
+ }
+
+ } catch (ApiException | NoApiKeyException | InputRequiredException e) {
+ System.err.println("Synthesis failed: " + e.getMessage());
+ }
+ }
+
+ /** Demonstrates streaming call with callback - receives audio chunks as they arrive. */
+ public static void streamCallWithCallback() {
+ System.out.println("\n=== Streaming Call with Callback Example ===");
+
+ HttpSpeechSynthesizer synthesizer = new HttpSpeechSynthesizer();
+
+ HttpSpeechSynthesisParam param =
+ HttpSpeechSynthesisParam.builder()
+ .model("cosyvoice-v3-flash")
+ .text("今天天气真好,适合出去玩。")
+ .voice("longanyang")
+ .format("wav")
+ .sampleRate(24000)
+ .build();
+
+ // Use CountDownLatch to wait for completion
+ CountDownLatch latch = new CountDownLatch(1);
+
+ try {
+ synthesizer.streamCall(
+ param,
+ new ResultCallback() {
+ private int chunkCount = 0;
+
+ @Override
+ public void onEvent(HttpSpeechSynthesisResult result) {
+ chunkCount++;
+ if (result.hasAudioData()) {
+ System.out.println(
+ "Received chunk #"
+ + chunkCount
+ + ", size: "
+ + result.getAudioDataSize()
+ + " bytes");
+ }
+ if (result.getRequestId() != null) {
+ System.out.println("Request ID: " + result.getRequestId());
+ }
+ }
+
+ @Override
+ public void onComplete() {
+ System.out.println("✓ Synthesis completed! Total chunks received: " + chunkCount);
+
+ // Get accumulated audio data
+ ByteBuffer audioData = synthesizer.getAccumulatedAudioData();
+ if (audioData != null) {
+ System.out.println("Total audio size: " + audioData.remaining() + " bytes");
+ }
+ latch.countDown();
+ }
+
+ @Override
+ public void onError(Exception e) {
+ System.err.println("✗ Error during synthesis: " + e.getMessage());
+ latch.countDown();
+ }
+ });
+
+ // Wait for completion
+ latch.await();
+ System.out.println("Done!");
+
+ } catch (ApiException | NoApiKeyException | InputRequiredException | InterruptedException e) {
+ System.err.println("Failed: " + e.getMessage());
+ }
+ }
+
+ /** Demonstrates custom parameter settings. */
+ public static void customParameters() {
+ System.out.println("\n=== Custom Parameters Example ===");
+
+ HttpSpeechSynthesizer synthesizer = new HttpSpeechSynthesizer();
+
+ // Build parameters with custom voice settings
+ HttpSpeechSynthesisParam param =
+ HttpSpeechSynthesisParam.builder()
+ .model("cosyvoice-v3-flash")
+ .text("这是一段测试语音合成参数的文本。")
+ .voice("longanyang")
+ .format("wav")
+ .sampleRate(24000)
+ .volume(80) // Volume: 0-100
+ .rate(1.2f) // Speech rate: 0.5-2.0
+ .pitch(1.1f) // Pitch: 0.5-2.0
+ .build();
+
+ System.out.println("Parameters:");
+ System.out.println(" Model: " + param.getModel());
+ System.out.println(" Text: " + param.getText());
+ System.out.println(" Voice: " + param.getVoice());
+ System.out.println(" Format: " + param.getFormat());
+ System.out.println(" Sample Rate: " + param.getSampleRate());
+ System.out.println(" Volume: " + param.getVolume());
+ System.out.println(" Rate: " + param.getRate());
+ System.out.println(" Pitch: " + param.getPitch());
+
+ try {
+ ByteBuffer audioData = synthesizer.callAndReturnAudio(param);
+ if (audioData != null) {
+ System.out.println(
+ "✓ Synthesis completed, audio size: " + audioData.remaining() + " bytes");
+ }
+ } catch (ApiException | NoApiKeyException | InputRequiredException e) {
+ System.err.println("Failed: " + e.getMessage());
+ }
+ }
+
+ public static void main(String[] args) {
+ Constants.apiKey = "YOUR_API_KEY";
+ System.out.println("HttpSpeechSynthesizer Usage Examples\n");
+ System.out.println("====================================\n");
+
+ // Run examples
+ syncCall(); // SSE streaming - returns audio data
+ syncCallWithUrl(); // Non-SSE - returns audio URL
+ streamCallWithCallback();
+ customParameters();
+
+ System.out.println("\n====================================");
+ System.out.println("All examples completed!");
+ }
+}
diff --git a/samples/Qwen3OmniToolCallUsage.java b/samples/Qwen3OmniToolCallUsage.java
new file mode 100644
index 0000000..634eaec
--- /dev/null
+++ b/samples/Qwen3OmniToolCallUsage.java
@@ -0,0 +1,365 @@
+import com.alibaba.dashscope.audio.omni.*;
+import com.alibaba.dashscope.exception.NoApiKeyException;
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * Qwen3 Omni Tool Calling Support
+ *
+ * This example demonstrates:
+ * 1. Function calling (tool) support with weather and flight price queries
+ * 2. Using createItem to send tool call results back to the server
+ */
+public class Qwen3OmniToolCallUsage {
+ private static final Logger log = LoggerFactory.getLogger(Qwen3OmniToolCallUsage.class);
+ private static final int AUDIO_CHUNK_SIZE = 3200; // Audio chunk size in bytes (200ms at 16kHz)
+ private static final int SLEEP_INTERVAL_MS = 200; // Sleep interval to simulate real-time streaming
+
+ // Store pending tool calls that need response
+ private static final Map pendingToolCalls = new ConcurrentHashMap<>();
+
+ public static void main(String[] args) throws InterruptedException {
+ // Build connection parameters
+ OmniRealtimeParam param = OmniRealtimeParam.builder()
+ .model("model-name") // Replace with your model
+ .apikey("your-api-key")
+ .url("wss://dashscope.aliyuncs.com/api-ws/v1/realtime") // Custom URL if needed
+ .build();
+
+ final AtomicReference responseTextRef = new AtomicReference<>(new StringBuilder());
+ final CountDownLatch finishLatch = new CountDownLatch(1);
+
+ // Create conversation with callback
+ OmniRealtimeConversation conversation = new OmniRealtimeConversation(param, new OmniRealtimeCallback() {
+ private long lastPackageTime = 0;
+ private boolean isFirstText = true;
+ private boolean isFirstAudio = true;
+
+ @Override
+ public void onOpen() {
+ System.out.println("connection opened, ready to send audio");
+ lastPackageTime = System.currentTimeMillis();
+ }
+
+ @Override
+ public void onEvent(JsonObject message) {
+ String type = message.get("type").getAsString();
+
+ switch (type) {
+ case "session.created":
+ System.out.println("start session: " + message.get("session").getAsJsonObject().get("id").getAsString());
+ break;
+
+ case "conversation.item.input_audio_transcription.completed":
+ System.out.println("question: " + message.get("transcript").getAsString());
+ break;
+
+ case "response.audio_transcript.delta":
+ case "response.text.delta":
+ if (isFirstText) {
+ isFirstText = false;
+ System.out.println("first text latency from vad end: " + (System.currentTimeMillis() - lastPackageTime) + " ms");
+ }
+ String text = message.get("delta").getAsString();
+ responseTextRef.get().append(text);
+ break;
+
+ case "response.audio.delta":
+ if (isFirstAudio) {
+ isFirstAudio = false;
+ System.out.println("first audio latency from vad end: " + (System.currentTimeMillis() - lastPackageTime) + " ms");
+ }
+ System.out.println("audio interval: " + (System.currentTimeMillis() - lastPackageTime) + " ms");
+ lastPackageTime = System.currentTimeMillis();
+ String recvAudioB64 = message.get("delta").getAsString();
+ // Handle received audio - implement your own audio player here
+ // audioPlayer.write(recvAudioB64);
+ break;
+
+ case "input_audio_buffer.speech_started":
+ System.out.println("======VAD Speech Start======");
+ // Cancel audio playback when user starts speaking
+ // audioPlayer.cancelPlaying();
+ break;
+
+ case "input_audio_buffer.speech_stopped":
+ System.out.println("======VAD Speech End======");
+ lastPackageTime = System.currentTimeMillis();
+ isFirstText = true;
+ isFirstAudio = true;
+ pendingToolCalls.clear();
+ break;
+
+ case "response.function_call_arguments.done":
+ System.out.println("======TOOL CALL======");
+ String toolCallId = message.get("call_id").getAsString();
+ pendingToolCalls.put(toolCallId, message);
+ break;
+
+ case "response.done":
+ System.out.println("======RESPONSE DONE======");
+ System.out.println("all response text: " + responseTextRef.get());
+ responseTextRef.set(new StringBuilder()); // Clear for next response
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ @Override
+ public void onClose(int code, String reason) {
+ System.out.println("connection closed with code: " + code + ", reason: " + reason);
+ finishLatch.countDown();
+ }
+ });
+
+ try {
+ conversation.connect();
+ } catch (NoApiKeyException e) {
+ throw new RuntimeException(e);
+ }
+
+ // Build tools definition
+ List