New: Nano Banana 2.1Try the model
API Stock

Música

Generación de música

Crear música con Suno: estilo, letras, estructura e iteraciones.

1 min de lectura2 secciones

La música se vuelve controlable al separar estilo, ambiente, instrumentos, tempo y estructura. Mantenga letras e instrucciones musicales en los campos correspondientes.

Principios prácticos

Elija el modelo según la prioridad — rapidez, fidelidad, resolución o control — y guarde parámetros y versión de cada resultado. suno — Music generation.

Cambie una sola cosa por intento. Las salidas buenas se convierten en referencias y en el punto de partida más fiable para la siguiente iteración.

Trate finished y failed como estados finales. Use polling o webhooks, conserve errores sin procesar en el servidor y muestre mensajes seguros al usuario.

Prompts y ejemplos de 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 analog
pads, forest field recordings, fretless bass, kalimba textures, meditative
dorian A minor, 8 minute slow development, warm earthy production, no vocals
instrumental
A Suno v5.5 instrumental generated from the exact prompt above: organic percussion and field recordings build over a slow 95 BPM pulse.
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 reverb
tail
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": "v6",
"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: "v6",
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); // → 2
const 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"
}
}

Ejecútalo con tu propia clave

Elija un modelo en el catálogo de API Stock, consulte su precio y pruébelo en el navegador o por API.

Seguir leyendo