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

Alibaba Cloud Model Studio:音楽生成 API リファレンス (Fun-music)

最終更新日:May 09, 2026

Fun-music 音楽生成モデルの API パラメーターです。

ユーザーガイド:モデルの概要と選定ガイドについては、「音楽生成」をご参照ください。

重要

このモデルは現在、招待プレビューの段階です。使用する前に、Models ページからアクセス権を申請してください。この機能は中国本土デプロイメント範囲(中国 (北京) リージョン)でのみご利用いただけます。

前提条件

API キーが必要です。取得方法については、「API キーの取得」をご参照ください。

エンドポイント

POST https://dashscope.aliyuncs.com/api/v1/services/audio/music/generation

プロトコル:HTTPS。ストリーミング出力を有効にするには、リクエストヘッダーに X-DashScope-SSE を設定し、SSE(Server-Sent Events)を有効にしてください。

リクエストヘッダー

パラメーター

タイプ

必須

説明

Authorization

string

はい

Bearer {api-key}{api-key} をご利用の API キーに置き換えてください。

Content-Type

string

はい

application/json

X-DashScope-SSE

string

いいえ

enable に設定すると、SSE ストリーミング出力が有効になります。

リクエスト本文

非ストリーミング

curl -X POST 'https://dashscope.aliyuncs.com/api/v1/services/audio/music/generation' \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "fun-music-v1",
    "input": {
        "prompt": "Fresh summer folk song, acoustic guitar and harmonica accompaniment, upbeat tempo, suitable as background music for travel vlogs",
        "gender": "female"
    }
}'

ストリーミング

curl -X POST 'https://dashscope.aliyuncs.com/api/v1/services/audio/music/generation' \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-H "X-DashScope-SSE: enable" \
-d '{
    "model": "fun-music-v1",
    "input": {
        "prompt": "High-energy electronic dance music, synthesizer effects, full of energy, suitable for fitness and workout scenarios",
        "gender": "male"
    }
}'

model string (必須)

モデル名。必ず fun-music-v1 を指定してください。

input object (必須)

入力パラメーターです。

プロパティ

lyrics string (条件付き必須)

生成される楽曲の歌詞です。prompt を指定しない場合は必須です。

文字数制限:

  • 非ストリーミング:5~350 文字(中国語)、5~2,000 文字(英語)

  • ストリーミング:300~350 文字(中国語)、200~250 語(英語)

説明

lyricsprompt の両方が指定された場合、lyrics が優先され、prompt は無視されます。

prompt string (条件付き必須)

テキストプロンプトです。モデルはこのプロンプトに基づいて歌詞と楽曲を生成します。lyrics を指定しない場合は必須です。

文字数制限:

  • 非ストリーミング:1~2,000 文字

  • ストリーミング:5~1,000 文字(中国語)または語(英語)

gender string (任意) デフォルト:female

ボーカルの性別です。有効な値:

  • male:男性ボーカル

  • female:女性ボーカル

format string (任意) デフォルト:mp3

オーディオのエンコード形式です。有効な値:

  • mp3:ネットワーク転送およびストレージに適しています

  • wav:後処理および高品質再生に適しています

応答オブジェクト

非ストリーミング

{
    "output": {
        "audio": {
            "data": "",
            "expires_at": 1774936147,
            "id": "audio_46c51288-7ed6-95cc-a119-xxxxxxxxxxxx",
            "url": "http://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/pre/fun-music/20260330/xxxxxxxx/a8db24cc-d35f-961b-af81-a9e8d8b01f67.mp3?xxx"
        },
        "extra_info": {
            "channels": 2,
            "lyrics": "[verse]\nMorning sunlight slips through the curtain,\nCoffee aroma fills up the room.\nOpen the book left unfinished yesterday,\nTime quietly drifts by this way.\n\n[chorus]\nTake it slow, there's no hurry,\nLife should be this carefree.\nToss your worries into the wind,\nEmbrace every sunny day and rainy season.",
            "sample_rate": 48000
        },
        "finish_reason": "stop"
    },
    "usage": {
        "duration": 200
    },
    "request_id": "46c51288-7ed6-95cc-a119-xxxxxxxxxxxx"
}

ストリーミング(中間メッセージ)

{
    "output": {
        "audio": {
            "data": "Base64-encoded audio data",
            "expires_at": 1774937185,
            "id": "audio_a8db24cc-d35f-961b-af81-xxxxxxxxxxxx"
        },
        "finish_reason": "null"
    },
    "request_id": "a8db24cc-d35f-961b-af81-xxxxxxxxxxxx"
}

ストリーミング(最終メッセージ)

{
    "output": {
        "audio": {
            "expires_at": 1774937185,
            "id": "audio_a8db24cc-d35f-961b-af81-xxxxxxxxxxxx",
            "data": "",
            "url": "http://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/pre/fun-music/20260330/xxxxxxxx/a8db24cc-d35f-961b-af81-a9e8d8b01f67.mp3?xxx"
        },
        "extra_info": {
            "channels": 2,
            "sample_rate": "48000",
            "lyrics": "[verse]\nMorning sunlight slips through the curtain,\nCoffee aroma fills up the room.\nOpen the book left unfinished yesterday,\nTime quietly drifts by this way.\n\n[chorus]\nTake it slow, there's no hurry,\nLife should be this carefree.\nToss your worries into the wind,\nEmbrace every sunny day and rainy season."
        },
        "finish_reason": "stop"
    },
    "usage": {
        "duration": 200
    },
    "request_id": "a8db24cc-d35f-961b-af81-xxxxxxxxxxxx"
}

request_id string

トラブルシューティングおよびログトレースに使用するリクエスト ID です。

output object

モデルの出力です。

プロパティ

audio object

モデルから出力されるオーディオデータです。

プロパティ

data string

ストリーミングモードでは Base64 エンコードされたオーディオチャンクが含まれます。非ストリーミングモードでは空文字列となります。

url string

完成したオーディオファイルの OSS URL です。有効期限は 24 時間です。非ストリーミングのすべての応答およびストリーミングの最終メッセージにのみ含まれます。

id string

オーディオファイル ID です。

expires_at integer

オーディオ URL の有効期限を示す UNIX タイムスタンプです。

extra_info object

生成されたオーディオに関する追加メタデータです。

プロパティ

channels integer

オーディオチャンネル数です。たとえば、2 はステレオを示します。

sample_rate string

オーディオのサンプルレートです。たとえば、「48000」などです。

lyrics string

生成された楽曲の歌詞です。

finish_reason string

生成ステータス:

  • null:生成中

  • stop:生成完了

usage object

このリクエストの課金情報です。

プロパティ

duration integer

課金対象となる楽曲の持続時間(秒単位)です。