すべてのプロダクト
Search
ドキュメントセンター

Alibaba Cloud Model Studio:音声合成 (Qwen-TTS)

最終更新日:Nov 09, 2025

このトピックでは、Qwen-TTS モデルのリクエストパラメーターとレスポンスパラメーターについて説明します。

Qwen-TTS モデルの使用方法の詳細については、「音声合成 - Qwen」をご参照ください。

リクエスト本文

非ストリーミング出力

Python

DashScope Python SDK の SpeechSynthesizer インターフェイスは、MultiModalConversation インターフェイスに統合されました。そのメソッドとパラメーターは同じままです。
# DashScope SDK の最新バージョンをインストールします。
import os
import dashscope

# 次の URL はシンガポールリージョン用です。北京リージョンのモデルを使用する場合は、URL を https://dashscope.aliyuncs.com/api/v1 に置き換えてください。
dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'

text = "Let me recommend a T-shirt. It is absolutely gorgeous. The color is very flattering, and it is a perfect piece for any outfit. You cannot go wrong with this one. It is really beautiful and flattering for all body types. It looks great on everyone. I highly recommend this T-shirt."
# SpeechSynthesizer インターフェイスの使用法: dashscope.audio.qwen_tts.SpeechSynthesizer.call(...)
response = dashscope.MultiModalConversation.call(
    # Qwen-TTS シリーズのモデルのみがサポートされています。他のモデルは使用しないでください。
    model="qwen3-tts-flash",
    # シンガポールリージョンと北京リージョンの API キーは異なります。API キーを取得するには、https://www.alibabacloud.com/help/en/model-studio/get-api-key にアクセスしてください。
    # 環境変数を設定していない場合は、次の行を Model Studio API キーを使用して api_key="sk-xxx" に置き換えてください。
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    text=text,
    voice="Cherry",
    language_type="Chinese"
)
print(response)

Java

// DashScope SDK の最新バージョンをインストールします。
import com.alibaba.dashscope.aigc.multimodalconversation.AudioParameters;
import com.alibaba.dashscope.aigc.multimodalconversation.MultiModalConversation;
import com.alibaba.dashscope.aigc.multimodalconversation.MultiModalConversationParam;
import com.alibaba.dashscope.aigc.multimodalconversation.MultiModalConversationResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.exception.UploadFileException;
import com.alibaba.dashscope.utils.JsonUtils;
import com.alibaba.dashscope.utils.Constants;

public class Main {

    private static final String MODEL = "qwen3-tts-flash";
    public static void call() throws ApiException, NoApiKeyException, UploadFileException {
        MultiModalConversation conv = new MultiModalConversation();
        MultiModalConversationParam param = MultiModalConversationParam.builder()
                // Qwen-TTS シリーズのモデルのみがサポートされています。他のモデルは使用しないでください。
                .model(MODEL)
                // シンガポールリージョンと北京リージョンの API キーは異なります。API キーを取得するには、https://www.alibabacloud.com/help/en/model-studio/get-api-key にアクセスしてください。
                // 環境変数を設定していない場合は、次の行を Model Studio API キーを使用して apiKey("sk-xxx") に置き換えてください。
                .apiKey(System.getenv("DASHSCOPE_API_KEY"))
                .text("Today is a wonderful day to build something people love!")
                .voice(AudioParameters.Voice.CHERRY)
                .languageType("English")
                .build();
        MultiModalConversationResult result = conv.call(param);
        System.out.println(JsonUtils.toJson(result));
    }
    public static void main(String[] args) {
        // 次の URL はシンガポールリージョン用です。北京リージョンのモデルを使用する場合は、URL を https://dashscope.aliyuncs.com/api/v1 に置き換えてください。
        Constants.baseHttpApiUrl = "https://dashscope-intl.aliyuncs.com/api/v1";
        try {
            call();
        } catch (ApiException | NoApiKeyException | UploadFileException e) {
            System.out.println(e.getMessage());
        }
        System.exit(0);
    }
}

curl

# ======= 重要事項 =======
# 次の URL はシンガポールリージョン用です。北京リージョンのモデルを使用する場合は、URL を https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation に置き換えてください。
# シンガポールリージョンと北京リージョンの API キーは異なります。API キーを取得するには、https://www.alibabacloud.com/help/en/model-studio/get-api-key にアクセスしてください。
# 環境変数を設定していない場合は、$DASHSCOPE_API_KEY を Model Studio API キー (sk-xxx など) に置き換えてください。
# === 実行前にこのコメントを削除してください ===

curl -X POST 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation' \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
    "model": "qwen3-tts-flash",
    "input": {
        "text": "Let me recommend a T-shirt. It is absolutely gorgeous. The color is very flattering, and it is a perfect piece for any outfit. You cannot go wrong with this one. It is really beautiful and flattering for all body types. It looks great on everyone. I highly recommend this T-shirt.",
        "voice": "Cherry",
        "language_type": "Chinese"
    }
}'

ストリーミング出力

Python

DashScope Python SDK の SpeechSynthesizer インターフェイスは、MultiModalConversation インターフェイスに統合されました。新しいインターフェイスを使用するには、名前を置き換えるだけです。他のすべてのパラメーターは完全に互換性があります。
# DashScope SDK のバージョンは 1.24.5 以降である必要があります。
import os
import dashscope

# 次の URL はシンガポールリージョン用です。北京リージョンのモデルを使用する場合は、URL を https://dashscope.aliyuncs.com/api/v1 に置き換えてください。
dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'
text = "Let me recommend a T-shirt. It is absolutely gorgeous. The color is very flattering, and it is a perfect piece for any outfit. You cannot go wrong with this one. It is really beautiful and flattering for all body types. It looks great on everyone. I highly recommend this T-shirt."
# SpeechSynthesizer インターフェイスの使用法: dashscope.audio.qwen_tts.SpeechSynthesizer.call(...)
response = dashscope.MultiModalConversation.call(
    model="qwen3-tts-flash",
    # シンガポールリージョンと北京リージョンの API キーは異なります。API キーを取得するには、https://www.alibabacloud.com/help/en/model-studio/get-api-key にアクセスしてください。
    # 環境変数を設定していない場合は、次の行を Model Studio API キーを使用して api_key="sk-xxx" に置き換えてください。
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    text=text,
    voice="Cherry",
    language_type="Chinese"
    stream=True
)
for chunk in response:
    print(chunk)

Java

// DashScope SDK のバージョンは 2.19.0 以降である必要があります。
import com.alibaba.dashscope.aigc.multimodalconversation.AudioParameters;
import com.alibaba.dashscope.aigc.multimodalconversation.MultiModalConversation;
import com.alibaba.dashscope.aigc.multimodalconversation.MultiModalConversationParam;
import com.alibaba.dashscope.aigc.multimodalconversation.MultiModalConversationResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.exception.UploadFileException;
import com.alibaba.dashscope.utils.JsonUtils;
import io.reactivex.Flowable;
import com.alibaba.dashscope.utils.Constants;

public class Main {
    private static final String MODEL = "qwen3-tts-flash";
    public static void streamCall() throws ApiException, NoApiKeyException, UploadFileException {
        MultiModalConversation conv = new MultiModalConversation();
        MultiModalConversationParam param = MultiModalConversationParam.builder()
                .model(MODEL)
                // シンガポールリージョンと北京リージョンの API キーは異なります。API キーを取得するには、https://www.alibabacloud.com/help/en/model-studio/get-api-key にアクセスしてください。
                // 環境変数を設定していない場合は、次の行を Model Studio API キーを使用して .apiKey("sk-xxx") に置き換えてください。
                .apiKey(System.getenv("DASHSCOPE_API_KEY"))
                .text("Today is a wonderful day to build something people love!")
                .voice(AudioParameters.Voice.CHERRY)
                .languageType("English")
                .build();
        Flowable<MultiModalConversationResult> result = conv.streamCall(param);
        result.blockingForEach(r -> {System.out.println(JsonUtils.toJson(r));
        });
    }
    public static void main(String[] args) {
        // 次の URL はシンガポールリージョン用です。北京リージョンのモデルを使用する場合は、URL を https://dashscope.aliyuncs.com/api/v1 に置き換えてください。
        Constants.baseHttpApiUrl = "https://dashscope-intl.aliyuncs.com/api/v1";
        try {
            streamCall();
        } catch (ApiException | NoApiKeyException | UploadFileException e) {
            System.out.println(e.getMessage());
        }
        System.exit(0);
    }
}

curl

# ======= 重要事項 =======
# 次の URL はシンガポールリージョン用です。北京リージョンのモデルを使用する場合は、URL を https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation に置き換えてください。
# シンガポールリージョンと北京リージョンの API キーは異なります。API キーを取得するには、https://www.alibabacloud.com/help/en/model-studio/get-api-key にアクセスしてください。
# 環境変数を設定していない場合は、$DASHSCOPE_API_KEY を Model Studio API キー (sk-xxx など) に置き換えてください。
# === 実行前にこのコメントを削除してください ===

curl -X POST 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation' \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H 'Content-Type: application/json' \
-H 'X-DashScope-SSE: enable' \
-d '{
    "model": "qwen3-tts-flash",
    "input": {
        "text": "Let me recommend a T-shirt. It is absolutely gorgeous. The color is very flattering, and it is a perfect piece for any outfit. You cannot go wrong with this one. It is really beautiful and flattering for all body types. It looks great on everyone. I highly recommend this T-shirt.",
        "voice": "Cherry",
        "language_type": "Chinese"
    }
}'
Base64 オーディオをリアルタイムで再生する方法の詳細については、「リアルタイム再生」をご参照ください。

model string (必須)

モデル名。サポートされているモデルのリストについては、「Qwen-TTS」をご参照ください。

text string (必須)

合成するテキスト。モデルは、中国語、英語、またはその両方の混合テキストをサポートしています。Qwen-TTS モデルの最大入力は 512 トークンです。Qwen3-TTS モデルの最大入力は 600 文字です。

voice string (必須)

使用する音声。詳細については、「サポートされている音声」をご参照ください。

language_type string (オプション)

合成された音声の言語を指定します。デフォルト値は Auto です。

  • Auto: テキストの言語が不確かな場合や、テキストに複数の言語が含まれているシナリオで使用します。モデルは、各言語セグメントに適切な発音を自動的に適用します。ただし、発音の正確性は保証されません。

  • 特定の言語: テキストが単一言語であるシナリオで使用します。言語を指定すると、合成品質が大幅に向上し、通常は Auto よりも良い結果が得られます。有効な値:

    • Chinese

    • English

    • German

    • Italian

    • Portuguese

    • Spanish

    • Japanese

    • Korean

    • French

    • Russian

stream boolean (オプション) デフォルト値は false です。

ストリームで応答を返すかどうかを指定します。有効な値:

  • false: 生成が完了した後に、生成された音声の URL が返されます。

  • true: 音声データは、生成されると Base64 エンコーディングで返されます。完全な結果をアセンブルするには、これらのフラグメントをリアルタイムで読み取る必要があります。詳細については、「リアルタイム再生」をご参照ください。

このパラメーターは Python SDK でのみサポートされています。Java SDK を使用してストリーミング出力を実装するには、streamCall インターフェイスを呼び出します。HTTP 経由でストリーミング出力を実装するには、ヘッダーで X-DashScope-SSEenable に設定します。

応答オブジェクト (フォーマットはストリーミング出力と非ストリーミング出力で同じです)

{
  "status_code": 200,
  "request_id": "3c88b429-eb67-49de-b708-fe4c994fbfba",
  "code": "",
  "message": "",
  "output": {
    "text": null,
    "finish_reason": "stop",
    "choices": null,
    "audio": {
      "data": "",
      "url": "http://dashscope-result-sh.oss-cn-shanghai.aliyuncs.com/1d/08/20250929/ffcf3aa4/e6cf58c8-33bd-47b9-941b-9a0652868b8c.wav?Expires=1759229218&OSSAccessKeyId=LTAI5xxx&Signature=bSfyEcJ3wjeq15h2ABgSdo1L3Pw%3D",
      "id": "audio_3c88b429-eb67-49de-b708-fe4c994fbfba",
      "expires_at": 1759229218
    }
  },
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0,
    "characters": 195
  }
}

output object

モデルの出力。

プロパティ

finish_reason string

次の 2 つのシナリオを考慮してください。

  • null: 生成が進行中です。

  • stop: モデルが出力を終了したか、停止条件が満たされたため、生成が完了しました。

audio object

モデルによって出力された音声情報。

プロパティ

url string

モデルによって出力された完全な音声ファイルの URL。URL は 24 時間有効です。

data string

ストリーミング出力用の Base64 エンコードされた音声データ。

id string

モデルによって出力された音声情報に対応する ID。

expires_at integer

URL の有効期限が切れる UNIX タイムスタンプ。

usage object

リクエストのトークンまたは文字の使用状況情報。Qwen-TTS モデルはトークンの使用状況を返し、Qwen3-TTS モデルは文字の使用状況を返します。

プロパティ

input_tokens_details object

入力テキストのトークン使用状況情報。このフィールドは Qwen-TTS モデルによってのみ返されます。

プロパティ

text_tokens integer

入力テキストによって消費されたトークンの数。

total_tokens integer

リクエストによって消費されたトークンの総数。このフィールドは Qwen-TTS モデルによってのみ返されます。

output_tokens integer

出力音声によって消費されたトークンの数。Qwen3-TTS モデルの場合、このフィールドは 0 に固定されます。

input_tokens integer

入力テキストによって消費されたトークンの数。Qwen3-TTS モデルの場合、このフィールドは 0 に固定されます。

output_tokens_details object

出力のトークン使用状況情報。このフィールドは Qwen-TTS モデルによってのみ返されます。

プロパティ

audio_tokens integer

出力音声によって消費されたトークンの数。

text_tokens integer

出力テキストによって消費されたトークンの数。値は 0 に固定されます。

characters integer

入力テキストの文字数。このフィールドは Qwen3-TTS モデルによってのみ返されます。

request_id string

リクエストの ID。