音乐
音乐生成
使用 Suno 创作包含风格、歌词、结构和迭代的音乐。
阅读约 1 分钟2 个章节
将风格、氛围、乐器、速度和结构分开描述,音乐就更容易控制。请把歌词和音乐指令放入对应字段。
实操要点
按优先目标选择模型——速度、还原度、分辨率或控制能力——并保存每次结果的参数和版本。 suno — Music generation.
每次尝试只改一件事。好的输出应保留为参考图,它是下一轮迭代最可靠的起点。
将 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 Stock 目录——一个 API 密钥、一个预付余额,无需在各家供应商分别注册。