Przejdź do treści
Dokumentacja API
Dokumentacja API

Suno Zamiana tekstu na muzykę

Użyj punktu końcowego text to music, aby utworzyć asynchroniczne zadanie.

01

Omówienie

Użyj punktu końcowego text to music z obsługiwanym modelem. Użyj zwróconego identyfikatora zadania, aby pobrać jego stan, lub podaj callback_url dla dostarczeń udokumentowanych poniżej.

Szybki start

  1. Utwórz klucz API i ustaw go jako RUNAPI_API_KEY.
  2. Wybierz obsługiwany model i wyślij żądanie POST, którego treść odpowiada schematowi tego modelu.
  3. Zapisz zwrócony identyfikator zadania, a następnie odpytuj do momentu osiągnięcia stanu końcowego lub obsłuż wywołania zwrotne opisane poniżej.

Punkt końcowy

POST /api/v1/suno/text_to_music
Bazowy URL
https://runapi.ai
Wersja API
v1
Uwierzytelnianie
Authorization: Bearer YOUR_API_TOKEN
02

Obsługiwane modele

Otwórz stronę modelu, aby zapoznać się z aktualnymi cenami, limitami żądań i szczegółami dotyczącymi użytku komercyjnego.

03

Schemat żądania

Treść JSON

Pola i dozwolone wartości zależą od wybranego modelu. Jeśli zostanie podany, callback_url będzie odbierać dostarczenia zadań (Task) opisane poniżej.

suno-v415 pola
audio_weightnumber
Opcjonalne

Waga audio (0–1).

Zakres: 0 - 1
callback_urlstring
Opcjonalne

URL webhooka dla powiadomień asynchronicznych.

continue_atnumber
Opcjonalne

Znacznik czasu w sekundach, od którego należy kontynuować.

lyricsstring
Opcjonalne

Dokładny tekst do zaśpiewania.

Zakres: 5000
modelstring
Wymagane

Identyfikator modelu.

negative_tagsstring
Opcjonalne

Style do unikania.

persona_idstring
Opcjonalne

Identyfikator persony.

persona_typestring
Opcjonalne

Typ persony.

Dozwolone wartości: style, voice
promptstring
Opcjonalne

Opis utworu do automatycznego generowania tekstu.

Zakres: 5000
stylestring
Opcjonalne

Styl muzyczny.

Zakres: 1000
style_weightnumber
Opcjonalne

Waga zgodności ze stylem (0–1).

Zakres: 0 - 1
titlestring
Opcjonalne

Tytuł utworu muzycznego.

Zakres: 80
vocal_genderstring
Opcjonalne

Płeć wokalna.

Dozwolone wartości: male, female
vocal_modestring
Wymagane

Tryb generowania wokalnego.

Dozwolone wartości: auto_lyrics, exact_lyrics, instrumental
weirdness_constraintnumber
Opcjonalne

Ograniczenie dziwności (0–1).

Zakres: 0 - 1
suno-v4.515 pola
audio_weightnumber
Opcjonalne

Waga audio (0–1).

Zakres: 0 - 1
callback_urlstring
Opcjonalne

URL webhooka dla powiadomień asynchronicznych.

continue_atnumber
Opcjonalne

Znacznik czasu w sekundach, od którego należy kontynuować.

lyricsstring
Opcjonalne

Dokładny tekst do zaśpiewania.

Zakres: 5000
modelstring
Wymagane

Identyfikator modelu.

negative_tagsstring
Opcjonalne

Style do unikania.

persona_idstring
Opcjonalne

Identyfikator persony.

persona_typestring
Opcjonalne

Typ persony.

Dozwolone wartości: style, voice
promptstring
Opcjonalne

Opis utworu do automatycznego generowania tekstu.

Zakres: 5000
stylestring
Opcjonalne

Styl muzyczny.

Zakres: 1000
style_weightnumber
Opcjonalne

Waga zgodności ze stylem (0–1).

Zakres: 0 - 1
titlestring
Opcjonalne

Tytuł utworu muzycznego.

Zakres: 80
vocal_genderstring
Opcjonalne

Płeć wokalna.

Dozwolone wartości: male, female
vocal_modestring
Wymagane

Tryb generowania wokalnego.

Dozwolone wartości: auto_lyrics, exact_lyrics, instrumental
weirdness_constraintnumber
Opcjonalne

Ograniczenie dziwności (0–1).

Zakres: 0 - 1
suno-v4.5-all15 pola
audio_weightnumber
Opcjonalne

Waga audio (0–1).

Zakres: 0 - 1
callback_urlstring
Opcjonalne

URL webhooka dla powiadomień asynchronicznych.

continue_atnumber
Opcjonalne

Znacznik czasu w sekundach, od którego należy kontynuować.

lyricsstring
Opcjonalne

Dokładny tekst do zaśpiewania.

Zakres: 5000
modelstring
Wymagane

Identyfikator modelu.

negative_tagsstring
Opcjonalne

Style do unikania.

persona_idstring
Opcjonalne

Identyfikator persony.

persona_typestring
Opcjonalne

Typ persony.

Dozwolone wartości: style, voice
promptstring
Opcjonalne

Opis utworu do automatycznego generowania tekstu.

Zakres: 5000
stylestring
Opcjonalne

Styl muzyczny.

Zakres: 1000
style_weightnumber
Opcjonalne

Waga zgodności ze stylem (0–1).

Zakres: 0 - 1
titlestring
Opcjonalne

Tytuł utworu muzycznego.

Zakres: 80
vocal_genderstring
Opcjonalne

Płeć wokalna.

Dozwolone wartości: male, female
vocal_modestring
Wymagane

Tryb generowania wokalnego.

Dozwolone wartości: auto_lyrics, exact_lyrics, instrumental
weirdness_constraintnumber
Opcjonalne

Ograniczenie dziwności (0–1).

Zakres: 0 - 1
suno-v4.5-plus15 pola
audio_weightnumber
Opcjonalne

Waga audio (0–1).

Zakres: 0 - 1
callback_urlstring
Opcjonalne

URL webhooka dla powiadomień asynchronicznych.

continue_atnumber
Opcjonalne

Znacznik czasu w sekundach, od którego należy kontynuować.

lyricsstring
Opcjonalne

Dokładny tekst do zaśpiewania.

Zakres: 5000
modelstring
Wymagane

Identyfikator modelu.

negative_tagsstring
Opcjonalne

Style do unikania.

persona_idstring
Opcjonalne

Identyfikator persony.

persona_typestring
Opcjonalne

Typ persony.

Dozwolone wartości: style, voice
promptstring
Opcjonalne

Opis utworu do automatycznego generowania tekstu.

Zakres: 5000
stylestring
Opcjonalne

Styl muzyczny.

Zakres: 1000
style_weightnumber
Opcjonalne

Waga zgodności ze stylem (0–1).

Zakres: 0 - 1
titlestring
Opcjonalne

Tytuł utworu muzycznego.

Zakres: 80
vocal_genderstring
Opcjonalne

Płeć wokalna.

Dozwolone wartości: male, female
vocal_modestring
Wymagane

Tryb generowania wokalnego.

Dozwolone wartości: auto_lyrics, exact_lyrics, instrumental
weirdness_constraintnumber
Opcjonalne

Ograniczenie dziwności (0–1).

Zakres: 0 - 1
suno-v515 pola
audio_weightnumber
Opcjonalne

Waga audio (0–1).

Zakres: 0 - 1
callback_urlstring
Opcjonalne

URL webhooka dla powiadomień asynchronicznych.

continue_atnumber
Opcjonalne

Znacznik czasu w sekundach, od którego należy kontynuować.

lyricsstring
Opcjonalne

Dokładny tekst do zaśpiewania.

Zakres: 5000
modelstring
Wymagane

Identyfikator modelu.

negative_tagsstring
Opcjonalne

Style do unikania.

persona_idstring
Opcjonalne

Identyfikator persony.

persona_typestring
Opcjonalne

Typ persony.

Dozwolone wartości: style, voice
promptstring
Opcjonalne

Opis utworu do automatycznego generowania tekstu.

Zakres: 5000
stylestring
Opcjonalne

Styl muzyczny.

Zakres: 1000
style_weightnumber
Opcjonalne

Waga zgodności ze stylem (0–1).

Zakres: 0 - 1
titlestring
Opcjonalne

Tytuł utworu muzycznego.

Zakres: 80
vocal_genderstring
Opcjonalne

Płeć wokalna.

Dozwolone wartości: male, female
vocal_modestring
Wymagane

Tryb generowania wokalnego.

Dozwolone wartości: auto_lyrics, exact_lyrics, instrumental
weirdness_constraintnumber
Opcjonalne

Ograniczenie dziwności (0–1).

Zakres: 0 - 1
suno-v5.516 pola
audio_weightnumber
Opcjonalne

Waga audio (0–1).

Zakres: 0 - 1
callback_urlstring
Opcjonalne

URL webhooka dla powiadomień asynchronicznych.

continue_atnumber
Opcjonalne

Znacznik czasu w sekundach, od którego należy kontynuować.

duration_secondsinteger
Opcjonalne

Preferowany czas trwania w sekundach; dostępny tylko dla niestandardowych żądań Suno V5.5.

Zakres: 10 - 360
lyricsstring
Opcjonalne

Dokładny tekst do zaśpiewania.

Zakres: 5000
modelstring
Wymagane

Identyfikator modelu.

negative_tagsstring
Opcjonalne

Style do unikania.

persona_idstring
Opcjonalne

Identyfikator persony.

persona_typestring
Opcjonalne

Typ persony.

Dozwolone wartości: style, voice
promptstring
Opcjonalne

Opis utworu do automatycznego generowania tekstu.

Zakres: 5000
stylestring
Opcjonalne

Styl muzyczny.

Zakres: 1000
style_weightnumber
Opcjonalne

Waga zgodności ze stylem (0–1).

Zakres: 0 - 1
titlestring
Opcjonalne

Tytuł utworu muzycznego.

Zakres: 80
vocal_genderstring
Opcjonalne

Płeć wokalna.

Dozwolone wartości: male, female
vocal_modestring
Wymagane

Tryb generowania wokalnego.

Dozwolone wartości: auto_lyrics, exact_lyrics, instrumental
weirdness_constraintnumber
Opcjonalne

Ograniczenie dziwności (0–1).

Zakres: 0 - 1

Reguły warunkowe

Te wymagania obowiązują, gdy spełnione są wszystkie wymienione warunki.

  1. Kiedy vocal_mode = auto_lyrics
    Wymagane
    prompt
    Nie jest akceptowane
    lyrics, style, title, negative_tags, vocal_gender, duration_seconds
  2. Kiedy vocal_mode = exact_lyrics
    Wymagane
    lyrics, style, title
    Nie jest akceptowane
    prompt
  3. Kiedy vocal_mode = instrumental
    Wymagane
    style, title
    Nie jest akceptowane
    prompt, lyrics, vocal_gender
  4. Kiedy model = suno-v4
    Wymagane
    Nie jest akceptowane
    duration_seconds
  5. Kiedy model = suno-v4.5
    Wymagane
    Nie jest akceptowane
    duration_seconds
  6. Kiedy model = suno-v4.5-all
    Wymagane
    Nie jest akceptowane
    duration_seconds
  7. Kiedy model = suno-v4.5-plus
    Wymagane
    Nie jest akceptowane
    duration_seconds
  8. Kiedy model = suno-v5
    Wymagane
    Nie jest akceptowane
    duration_seconds
04

Tworzenie akceptacji

HTTP 202

POST /api/v1/suno/text_to_music

Schemat odpowiedzi
JSON
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    },
    "task_replayed": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "status",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Przykład odpowiedzi

JSON
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "processing"
}
05

Odpytywanie w toku

HTTP 200

GET /api/v1/suno/text_to_music/:id

Schemat odpowiedzi
JSON
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "duration": {
            "type": "number"
          },
          "id": {
            "type": "string"
          },
          "image_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "lyrics": {
            "type": "string"
          },
          "model_name": {
            "type": "string"
          },
          "stream_audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "generation_stage": {
      "enum": [
        "text_generated",
        "first_audio_ready"
      ],
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Przykład odpowiedzi

JSON
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "generation_stage": "text_generated",
  "id": "tsk_reference_demo",
  "status": "processing"
}
06

Odpytywanie zakończone

HTTP 200

GET /api/v1/suno/text_to_music/:id

Schemat odpowiedzi
JSON
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "duration": {
            "type": "number"
          },
          "id": {
            "type": "string"
          },
          "image_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "lyrics": {
            "type": "string"
          },
          "model_name": {
            "type": "string"
          },
          "stream_audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "generation_stage": {
      "enum": [
        "text_generated",
        "first_audio_ready",
        "all_audios_ready",
        "failed"
      ],
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "audios",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Przykład odpowiedzi

JSON
{
  "audios": [
    {
      "audio_url": "https://file.runapi.ai/reference-audio.mp3",
      "id": "audio_reference"
    }
  ],
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "completed"
}
07

Odpytywanie nie powiodło się

HTTP 200

GET /api/v1/suno/text_to_music/:id

Schemat odpowiedzi
JSON
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "error": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Przykład odpowiedzi

JSON
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "error": "Task processing failed.",
  "id": "tsk_reference_demo",
  "status": "failed"
}
08

Wywołanie zwrotne klienta: przetwarzanie

HTTP 200

POST callback_url

Schemat odpowiedzi
JSON
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "duration": {
            "type": "number"
          },
          "id": {
            "type": "string"
          },
          "image_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "lyrics": {
            "type": "string"
          },
          "model_name": {
            "type": "string"
          },
          "stream_audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "generation_stage": {
      "enum": [
        "text_generated",
        "first_audio_ready"
      ],
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Przykład odpowiedzi

JSON
{
  "generation_stage": "text_generated",
  "id": "tsk_reference_demo",
  "status": "processing"
}
09

Wywołanie zwrotne klienta: ukończono

HTTP 200

POST callback_url

Schemat odpowiedzi
JSON
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "duration": {
            "type": "number"
          },
          "id": {
            "type": "string"
          },
          "image_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "lyrics": {
            "type": "string"
          },
          "model_name": {
            "type": "string"
          },
          "stream_audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "generation_stage": {
      "enum": [
        "text_generated",
        "first_audio_ready",
        "all_audios_ready",
        "failed"
      ],
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "audios"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Przykład odpowiedzi

JSON
{
  "audios": [
    {
      "audio_url": "https://file.runapi.ai/reference-audio.mp3",
      "id": "audio_reference"
    }
  ],
  "id": "tsk_reference_demo",
  "status": "completed"
}
10

Wywołanie zwrotne klienta: niepowodzenie

HTTP 200

POST callback_url

Schemat odpowiedzi
JSON
{
  "properties": {
    "error": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "properties": {
            "code": {
              "type": "string"
            },
            "limit_cents": {
              "type": "integer"
            },
            "message": {
              "type": "string"
            },
            "reset_at": {
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            },
            "used_cents": {
              "type": "integer"
            },
            "window": {
              "enum": [
                "1h",
                "1d",
                "7d",
                "daily",
                "weekly",
                "monthly",
                "lifetime"
              ],
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ],
          "type": "object",
          "unevaluatedProperties": false
        }
      ]
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Przykład odpowiedzi

JSON
{
  "error": {
    "code": "generation_failed",
    "message": "Task processing failed."
  },
  "id": "tsk_reference_demo",
  "status": "failed"
}
11

Błędy

HTTP 401

POST /api/v1/suno/text_to_music

Schemat odpowiedzi
JSON
{
  "properties": {
    "error": {
      "description": "Czytelny dla człowieka komunikat o błędzie.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Przykład odpowiedzi

JSON
{
  "error": "Authentication required"
}
12

Błędy

HTTP 401

GET /api/v1/suno/text_to_music/:id

Schemat odpowiedzi
JSON
{
  "properties": {
    "error": {
      "description": "Czytelny dla człowieka komunikat o błędzie.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Przykład odpowiedzi

JSON
{
  "error": "Authentication required"
}
13

Błędy

HTTP 400

POST /api/v1/suno/text_to_music

Schemat odpowiedzi
JSON
{
  "oneOf": [
    {
      "properties": {
        "error": {
          "description": "Czytelny dla człowieka komunikat o błędzie.",
          "type": "string"
        }
      },
      "required": [
        "error"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    {
      "properties": {
        "error": {
          "description": "Czytelne dla człowieka podsumowanie walidacji.",
          "type": "string"
        },
        "errors": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": "Komunikaty walidacyjne identyfikowane przez publiczne pole żądania, z tablicą czytelnych dla człowieka ciągów znaków dla każdego pola.",
          "type": "object"
        }
      },
      "required": [
        "error",
        "errors"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  ]
}

Przykład odpowiedzi

JSON
{
  "error": "Validation failed",
  "errors": {
    "prompt": [
      "is required"
    ]
  }
}
14

Błędy

HTTP 402

POST /api/v1/suno/text_to_music

Schemat odpowiedzi
JSON
{
  "properties": {
    "error": {
      "description": "Czytelny dla człowieka komunikat o błędzie.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Przykład odpowiedzi

JSON
{
  "error": "Insufficient balance"
}
15

Błędy

HTTP 429

POST /api/v1/suno/text_to_music

Schemat odpowiedzi
JSON
{
  "properties": {
    "error": {
      "description": "Czytelny dla człowieka komunikat o błędzie.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Przykład odpowiedzi

JSON
{
  "error": "API key credit limit exceeded"
}
16

Błędy

HTTP 409

POST /api/v1/suno/text_to_music

Schemat odpowiedzi
JSON
{
  "properties": {
    "error": {
      "description": "Czytelny dla człowieka komunikat o błędzie.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Przykład odpowiedzi

JSON
{
  "error": "The request uses features that are not supported for the selected model"
}
17

Błędy

HTTP 429

POST /api/v1/suno/text_to_music

Schemat odpowiedzi
JSON
{
  "properties": {
    "error": {
      "description": "Czytelny dla człowieka komunikat o błędzie.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Przykład odpowiedzi

JSON
{
  "error": "Rate limit reached. Please retry later."
}
18

Błędy

HTTP 503

POST /api/v1/suno/text_to_music

Schemat odpowiedzi
JSON
{
  "properties": {
    "error": {
      "description": "Czytelny dla człowieka komunikat o błędzie.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Przykład odpowiedzi

JSON
{
  "error": "Service under maintenance, please try again later"
}
19

Błędy

HTTP 504

POST /api/v1/suno/text_to_music

Schemat odpowiedzi
JSON
{
  "properties": {
    "error": {
      "description": "Czytelny dla człowieka komunikat o błędzie.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Przykład odpowiedzi

JSON
{
  "error": "The request timed out"
}
20

Błędy

HTTP 404

GET /api/v1/suno/text_to_music/:id

Schemat odpowiedzi
JSON
{
  "properties": {
    "error": {
      "description": "Czytelny dla człowieka komunikat o błędzie.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Przykład odpowiedzi

JSON
{
  "error": "Task with id 'tsk_reference_demo' not found"
}
21

Wygenerowane przykłady kodu

Używaj bezpośrednio cURL lub zainstaluj SDK dla swojego języka. Każdy przykład przesyła zwalidowane żądanie pokazane w tej dokumentacji.

Instalacja

Shell
pip install runapi-suno
PYTHON
import os
from runapi.suno import SunoClient

client = SunoClient(api_key=os.environ["RUNAPI_API_KEY"])
task = client.text_to_music.create(
  model="suno-v5",
  vocal_mode="auto_lyrics",
  prompt="An uplifting acoustic pop song about a rainy city night.",
  persona_id="persona_reference",
  persona_type="style"
)