curl --request POST \
--url https://api.apimart.ai/v1/music/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "flowmusic",
"title": "My Song",
"sound_prompt": "upbeat pop music with piano",
"bpm": "120",
"length": 60
}'
import requests
url = "https://api.apimart.ai/v1/music/generations"
payload = {
"model": "flowmusic",
"title": "My Song",
"sound_prompt": "upbeat pop music with piano",
"bpm": "120",
"length": 60
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/music/generations";
const payload = {
model: "flowmusic",
title: "My Song",
sound_prompt: "upbeat pop music with piano",
bpm: "120",
length: 60
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01K8AYYM6R03TGZ3Q2P0TZVNPX"
}
]
}
{
"error": {
"message": "sound_prompt and lyrics cannot both be empty",
"type": "invalid_request",
"param": "",
"code": "invalid_request"
}
}
{
"error": {
"message": "残高が不足しています",
"type": "invalid_request",
"param": "",
"code": "quota_not_enough"
}
}
{
"error": {
"message": "現在のグループ容量が飽和しています。後でもう一度お試しください",
"type": "rate_limit_error",
"param": "",
"code": "rate_limit_error"
}
}
Flow Music
音楽生成
Flow Music テキストから音楽を生成します。スタイルプロンプト / 歌詞 / BPM / 長さの制御に対応し、1 回のリクエストで 1 曲を生成します
POST
/
v1
/
music
/
generations
curl --request POST \
--url https://api.apimart.ai/v1/music/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "flowmusic",
"title": "My Song",
"sound_prompt": "upbeat pop music with piano",
"bpm": "120",
"length": 60
}'
import requests
url = "https://api.apimart.ai/v1/music/generations"
payload = {
"model": "flowmusic",
"title": "My Song",
"sound_prompt": "upbeat pop music with piano",
"bpm": "120",
"length": 60
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/music/generations";
const payload = {
model: "flowmusic",
title: "My Song",
sound_prompt: "upbeat pop music with piano",
bpm: "120",
length: 60
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01K8AYYM6R03TGZ3Q2P0TZVNPX"
}
]
}
{
"error": {
"message": "sound_prompt and lyrics cannot both be empty",
"type": "invalid_request",
"param": "",
"code": "invalid_request"
}
}
{
"error": {
"message": "残高が不足しています",
"type": "invalid_request",
"param": "",
"code": "quota_not_enough"
}
}
{
"error": {
"message": "現在のグループ容量が飽和しています。後でもう一度お試しください",
"type": "rate_limit_error",
"param": "",
"code": "rate_limit_error"
}
}
curl --request POST \
--url https://api.apimart.ai/v1/music/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "flowmusic",
"title": "My Song",
"sound_prompt": "upbeat pop music with piano",
"bpm": "120",
"length": 60
}'
import requests
url = "https://api.apimart.ai/v1/music/generations"
payload = {
"model": "flowmusic",
"title": "My Song",
"sound_prompt": "upbeat pop music with piano",
"bpm": "120",
"length": 60
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/music/generations";
const payload = {
model: "flowmusic",
title: "My Song",
sound_prompt: "upbeat pop music with piano",
bpm: "120",
length: 60
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01K8AYYM6R03TGZ3Q2P0TZVNPX"
}
]
}
{
"error": {
"message": "sound_prompt and lyrics cannot both be empty",
"type": "invalid_request",
"param": "",
"code": "invalid_request"
}
}
{
"error": {
"message": "残高が不足しています",
"type": "invalid_request",
"param": "",
"code": "quota_not_enough"
}
}
{
"error": {
"message": "現在のグループ容量が飽和しています。後でもう一度お試しください",
"type": "rate_limit_error",
"param": "",
"code": "rate_limit_error"
}
}
認証
すべての API は Bearer Token による認証が必要ですAPI Key の取得:API Key 管理ページ にアクセスして API Key を取得してください使用時はリクエストヘッダーに以下を追加します:
Authorization: Bearer YOUR_API_KEY
リクエストパラメータ
モデル名。必ず
"flowmusic" を指定(大文字小文字は区別されません)音楽のスタイルやサウンドを記述するプロンプト例:
"upbeat pop music with piano"sound_prompt と lyrics は同時に空にできません(少なくとも一方を指定してください)。1 回のリクエストで生成される音楽は 1 曲のみです。生成する音楽のタイトル
BPM(1 分あたりの拍数)。1 以上である必要があります例:
"120"生成する長さ(秒)対応範囲:
1 ~ 240 秒ランダムシード。結果の再現に使用します
同じリクエストで同じ seed 値を指定すると、類似した結果が生成されますが、完全な一致は保証されません。
レスポンス
レスポンスステータスコード。成功時は 200
使用シーン
シーン 1:スタイルプロンプトのみで生成
{
"model": "flowmusic",
"title": "My Song",
"sound_prompt": "upbeat pop music with piano",
"bpm": "120",
"length": 60
}
シーン 2:歌詞 + スタイルで作曲
{
"model": "flowmusic",
"title": "継続",
"lyrics": "[Verse 1]\nどんなに長い夜も必ず明ける\n...",
"sound_prompt": "energetic rock with electric guitar",
"length": 120
}
タスク結果の照会音楽生成は非同期タスクです。送信後に
task_id が返されます。タスクステータスの取得 API を使用して、生成の進捗と結果を照会してください。タスク完了結果の例
照会レスポンス例(GET /v1/music/tasks/{task_id}):
{
"code": 200,
"data": {
"id": "task_01KWXVB61E28THHFBSYXWA4FAJ",
"status": "completed",
"progress": 100,
"created": 1783413184,
"completed": 1783413236,
"actual_time": 52,
"cost": 0.048,
"credits_cost": 0.48,
"result": {
"music": [
{
"clip_id": "a41aade4-993e-4d28-b56f-d97e7ef7167c",
"title": "Regression Song",
"duration_seconds": "181.70666667",
"create_time": "2026-07-07T08:33:32.854073Z",
"lyrics": "[Verse 1]\nWaking up to the morning light,\n...",
"lyrics_id": "c302d603-81b6-552f-8122-e512928d6aa1",
"lyrics_timing_markers": [[10, 12], [212, 36]],
"audio_url": "https://cdn.apimart.ai/audio/flowmusic_a41aade4.m4a",
"wav_url": "https://cdn.apimart.ai/audio/flowmusic_a41aade4.wav",
"image_url": "https://cdn.apimart.ai/image/flowmusic_a41aade4_cover.jpg"
}
]
}
}
}
⌘I