音楽
音楽生成
Suno によるスタイル、歌詞、構成、反復を備えた音楽制作。
約 1 分2 セクション
スタイル、雰囲気、楽器、テンポ、構成を分けて指定すると、音楽を制御しやすくなります。歌詞と音楽の指示は対応するフィールドに入れます。
実践の要点
速度、忠実度、解像度、制御性のどれを優先するかでモデルを選び、各結果のパラメータとバージョンを保存します。 suno — Music generation.
1 回の試行で変えるのは 1 点だけにします。良い出力を参照として残すと、次の反復で最も確実な出発点になります。
finished と failed は終端状態として扱います。polling または webhook を使い、生のエラーはサーバー側に保持し、利用者には安全なメッセージを表示してください。
プロンプトと API の例
text
indie folk, fingerpicked acoustic guitar, brushed drums, warm upright bass,soft female vocal, 90 bpm, nostalgic and unhurried
text
Organic downtempo psybient, 95 BPM, didgeridoo and tabla loops, soft analogpads, forest field recordings, fretless bass, kalimba textures, meditativedorian A minor, 8 minute slow development, warm earthy production, no vocalsinstrumental
json
{"custom": true,"tags": "upbeat indie pop, jangly electric guitar, handclaps, group vocals, 128 bpm, bright and cheerful","title": "Ship It Friday","prompt": "[Verse]\nWe wrote it down on Monday morning\nHalf a plan and too much coffee\n\n[Chorus]\nShip it Friday, ship it Friday\nNothing's perfect anyway"}
text
Three-second audio logo: a single bright marimba motif of four notes rising,one soft synth swell underneath, clean modern, no vocals, ends cleanly
text
A heavy wooden door closing in a stone corridor, with a short natural reverbtail
json
{"action": "cover","sourceTaskId": "019ca881-9503-7270-a560-f00fc2b15785","tags": "slow piano ballad, string section, intimate male vocal, 70 bpm","title": "Ship It Friday (Ballad)"}
About these samples. Ready-made examples are copied to our own storage only when their source permits reuse. The exact prompt appears above each result, and the original source and license are linked below the media.
sh
curl -X POST https://api.api-stock.com/api/v1/generation/create \-H "Authorization: Bearer sk-your-key" \-H "Content-Type: application/json" \-d '{"model": "suno","input": {"action": "music","gptDescriptionPrompt": "A slow indie folk song about leaving a harbour town at dawn, brushed drums, female vocal"}}'
json
{"model": "suno","input": {"action": "music","custom": true,"mv": "v5.0","title": "Harbour Lights","tags": "indie folk, brushed drums, warm analog","prompt": "[Verse]\nThe gulls come down before the sun does\n[Chorus]\nAnd the harbour lights go out one by one","makeInstrumental": false}}
json
{"code": 200,"data": {"taskId": "019ca8d7-6b02-7f31-a1c4-8e5d90b7f2aa","status": "finished","files": [{"fileUrl": "https://storage.api-stock.com/generated/suno-4c81-a.mp3","fileType": "music"},{"fileUrl": "https://storage.api-stock.com/generated/suno-4c81-b.mp3","fileType": "music"}],"output": {"tracks": [{"audioId": "b3d1f0a2-77ac-4e19-9c0e-1d2b3f4a5c6d","title": "Harbour Lights","duration": 184.6,"tags": "indie folk, brushed drums","imageUrl": "https://cdn.example.com/cover-a.jpeg"},{"audioId": "c7e2a941-08bd-4f52-b3aa-9e01c2d3e4f5","title": "Harbour Lights","duration": 191.2,"tags": "indie folk, brushed drums","imageUrl": "https://cdn.example.com/cover-b.jpeg"}]},"createdTime": "2026-02-28T13:52:19.000Z"}}
json
{"model": "suno","input": {"action": "extend","sourceTaskId": "019ca8d7-6b02-7f31-a1c4-8e5d90b7f2aa","audioId": "b3d1f0a2-77ac-4e19-9c0e-1d2b3f4a5c6d","continueAt": 120,"custom": true,"prompt": "[Bridge]\nThe tide turns over in the dark","tags": "indie folk, brushed drums"}}
json
{"model": "suno","input": {"action": "cover","sourceTaskId": "019ca8d7-6b02-7f31-a1c4-8e5d90b7f2aa","audioId": "b3d1f0a2-77ac-4e19-9c0e-1d2b3f4a5c6d","tags": "synthwave, gated reverb, 1984","title": "Harbour Lights (Synth)"}}
json
{"model": "suno","input": {"action": "stems","sourceTaskId": "019ca8d7-6b02-7f31-a1c4-8e5d90b7f2aa","audioId": "b3d1f0a2-77ac-4e19-9c0e-1d2b3f4a5c6d","stemType": "drum_kit"}}
json
{"model": "suno","input": {"action": "lyrics","prompt": "A song about leaving a harbour town at dawn","mv": "remi-v1"}}
json
{"code": 200,"data": {"taskId": "019ca8e0-91c3-7d48-b6f0-2a7c4e19d503","status": "finished","output": {"a": {"title": "Harbour Lights","text": "[Verse]\nThe gulls come down before the sun does","tags": ["indie folk", "folk"]},"b": {"title": "Leaving Line","text": "[Verse]\nSalt on the rope and the morning still cold","tags": ["indie folk", "acoustic"]}},"createdTime": "2026-02-28T14:02:07.000Z"}}
json
{"model": "suno","input": {"action": "voice","sourceTaskId": "019ca8d7-6b02-7f31-a1c4-8e5d90b7f2aa","name": "Harbour Alto"}}
ts
const BASE = "https://api.api-stock.com/api/v1";const KEY = process.env.API_STOCK_KEY!;async function submit(input: Record<string, unknown>): Promise<string> {const res = await fetch(`${BASE}/generation/create`, {method: "POST",headers: {Authorization: `Bearer ${KEY}`,"Content-Type": "application/json",},body: JSON.stringify({ model: "suno", input }),});const body = await res.json();if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`);return body.data.taskId;}async function wait(taskId: string) {const deadline = Date.now() + 15 * 60_000;while (Date.now() < deadline) {await new Promise((r) => setTimeout(r, 8_000));const res = await fetch(`${BASE}/task/status/${taskId}`, {headers: { Authorization: `Bearer ${KEY}` },});const body = await res.json().catch(() => null);if (!res.ok) {if (res.status === 429) {const retryAfter = Number(res.headers.get("Retry-After") ?? 8);await new Promise((r) => setTimeout(r, retryAfter * 1000));continue;}const message = body?.error?.message ?? `${res.status} ${res.statusText}`;throw new Error(message);}const { data } = body;if (data.status === "finished") return data;if (data.status === "failed") throw new Error(data.errorMessage);}throw new Error(`timed out waiting for ${taskId}`);}const songId = await submit({action: "music",custom: true,mv: "v5.0",title: "Harbour Lights",tags: "indie folk, brushed drums, warm analog",prompt: "[Verse]\nThe gulls come down before the sun does",});const song = await wait(songId);console.log(song.files.length); // → 2const tracks = (song.output?.tracks ?? []) as { audioId: string }[];const extendedId = await submit({action: "extend",sourceTaskId: songId,audioId: tracks[0]?.audioId,continueAt: 120,custom: true,prompt: "[Bridge]\nThe tide turns over in the dark",tags: "indie folk, brushed drums",});const extended = await wait(extendedId);console.log(extended.files[0].fileUrl); // → https://storage.api-stock.com/...
json
{"code": 400,"error": {"message": "action \"extend\" requires continueAt","type": "BadRequest","code": "invalid_input"}}
自分の API キーで試す
このガイドで扱うモデルはすべて API Stock のカタログで利用できます。API キーは 1 つ、プリペイド残高も 1 つで、プロバイダーごとの登録は不要です。