# Suno

Source: [Suno](<https://docs.gptunnel.ru/en/creative-lab/suno/>)

<a id="_top"></a>
Create music with `POST /api/v2/media/tasks` and `model: "suno"`. Set your [GPTunneL API key](<https://docs.gptunnel.ru/en/>) in the `GPTUNNEL_API_KEY` environment variable.

This method accepts text for Suno generation. To validate the request and get a quote, send the same `model`, `prompt`, `params` and `inputs` to the [price endpoint](<https://docs.gptunnel.ru/en/creative-lab/price/>).

<a id="simple-mode"></a>
## Simple Mode

Describe the sound in `prompt` using up to 500 characters. To supply your own lyrics, title and style separately, set `is_custom: true`.

```bash
curl 'https://gptunnel.ru/api/v2/media/tasks' \
  -H "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "suno",
    "prompt": "Спокойный lo-fi трек с мягким пианино и лёгкими ударными"
  }'
```

 <a id="кастомный-режим"></a>
 
<a id="text-and-style"></a>
## Text and style

Pass the lyrics in `prompt`, the title in `params.title` and the style description in `params.tags`.

```bash
curl 'https://gptunnel.ru/api/v2/media/tasks' \
  -H "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "suno",
    "prompt": "[Verse]\nMorning lights along the shore\nWaves are rolling in once more\nWe count the boats against the blue\nAnd wait to watch the sky turn new",
    "params": {
      "is_custom": true,
      "version": "chirp-v6",
      "title": "Along the Shore",
      "tags": "Indie pop, acoustic guitar, soft drums, 95 BPM",
      "vocal_gender": "f"
    }
  }'
```

| Parameter | What to pass |
| --- | --- |
| `is_custom` | Set to `true` to provide your own lyrics, style and title. Defaults to `false`. |
| `version` | Suno version from the [model catalog](<https://docs.gptunnel.ru/en/creative-lab/models/>). |
| `title` | Track title, up to 80 characters. Required when `is_custom: true`. |
| `tags` | Style description. Required when `is_custom: true`. Up to 1,000 characters for v6 and v6 mini. |
| `instrumental` | For a track without lyrics, pass `is_custom: true`, `instrumental: true`, `title` and `tags`. Omit `prompt`. |
| `vocal_gender` | When `is_custom: true`, use `f` for female vocals or `m` for male vocals. |
| `voice_id` | ID of a Suno voice you saved. |

Retired Suno version IDs are mapped to current versions. The response reports the version used in `params.version`.

For v6 and v6 mini, lyrics can contain up to 5,000 characters, counted in UTF-16 code units, like JavaScript `String.length`. For example, 🎵 takes two units.

For an instrumental track with your own style, use the following request body.

```json
{
  "model": "suno",
  "params": {
    "is_custom": true,
    "instrumental": true,
    "title": "У берега",
    "tags": "Акустическая гитара, мягкие ударные, 95 BPM"
  }
}
```

The Suno model entry describes this combination in `prompt_optional_when`. An invalid value for a known parameter returns HTTP 400 with the field name in `details`. Unknown names appear in `ignored_params`.

<a id="saved-voice"></a>
## Saved Voice

```bash
curl 'https://gptunnel.ru/api/v2/media/voices?model=suno' \
  -H "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}"
```

Take `voices[].id` from the response and use it as `params.voice_id`. Choose `chirp-v6` and omit `vocal_gender`. For a song with your own lyrics, send the voice ID along with `is_custom: true`, the title and the style. For an instrumental track, pick a voice marked `supports_instrumental: true`. The catalog returns saved Suno voices for the key owner. Create a voice in the GPTunneL music tool to get a `voice_id`. Omit `voice_id` to let Suno pick the vocals.

If the voice is missing from the owner’s library or incompatible with the selected version, the API returns HTTP 400 before creating a task or charging the account. The provider can also reject a saved voice during generation. Once you have the task `id`, check the final status with `GET /api/v2/media/tasks/{id}`.

<a id="result"></a>
## Result

To retry safely after a timeout, set `idempotency_key` in the first request to `/tasks` and retry with the same body and key. Replace `TASK_ID` with the `id` from the creation response.

```bash
curl "https://gptunnel.ru/api/v2/media/tasks/${TASK_ID:?Set TASK_ID}" \
  -H "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}"
```

When the status is `done`, `result[].url` contains the links to both tracks. See [Get task result](<https://docs.gptunnel.ru/en/creative-lab/get-task/>).
