> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apimart.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Создание пользовательской модели

> Создайте пользовательскую модель Suno V6 из 6–24 референсных аудиофрагментов

<Info>
  Создание модели асинхронно. Опрашивайте задачу по `task_id`, а после завершения прочитайте ID модели из `data.result.model_id`.
</Info>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.apimart.ai/v1/music/generations/createModel \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "model": "suno",
      "name": "warm folk model",
      "audio_urls": [
        "https://example.com/ref-01.mp3",
        "https://example.com/ref-02.mp3",
        "https://example.com/ref-03.wav",
        "https://example.com/ref-04.m4a",
        "https://example.com/ref-05.mp3",
        "https://example.com/ref-06.mp3"
      ]
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.apimart.ai/v1/music/generations/createModel",
      headers={"Authorization": "Bearer <token>"},
      json={
          "model": "suno",
          "name": "warm folk model",
          "audio_urls": [
              "https://example.com/ref-01.mp3",
              "https://example.com/ref-02.mp3",
              "https://example.com/ref-03.wav",
              "https://example.com/ref-04.m4a",
              "https://example.com/ref-05.mp3",
              "https://example.com/ref-06.mp3",
          ],
      },
  )
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.apimart.ai/v1/music/generations/createModel", {
    method: "POST",
    headers: {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      model: "suno",
      name: "warm folk model",
      audio_urls: [
        "https://example.com/ref-01.mp3",
        "https://example.com/ref-02.mp3",
        "https://example.com/ref-03.wav",
        "https://example.com/ref-04.m4a",
        "https://example.com/ref-05.mp3",
        "https://example.com/ref-06.mp3"
      ]
    })
  });
  console.log(await response.json());
  ```
</RequestExample>

## Authorizations

<ParamField header="Authorization" type="string" required>
  Bearer Token. Получите ключ на [странице управления API-ключами](https://apimart.ai/keys).
</ParamField>

## Body

<ParamField body="model" type="string" default="suno">
  Всегда используйте `suno`.
</ParamField>

<ParamField body="name" type="string" required>
  Название пользовательской модели. После удаления пробелов по краям оно не должно быть пустым.
</ParamField>

<ParamField body="audio_urls" type="string[]" required>
  От 6 до 24 прямых публичных HTTP(S)-URL аудио. Рекомендуются MP3, WAV и M4A. Каждая URL должна возвращать сам файл, а не страницу входа.
</ParamField>

<Warning>
  Недопустимый медиафайл может привести к сбою всей задачи создания модели. Сначала загрузите локальные файлы и используйте публичные URL; не отправляйте локальные пути и URL `blob:`.
</Warning>

## Response

<ResponseField name="code" type="integer">Код статуса ответа.</ResponseField>

<ResponseField name="data" type="array">
  Результат отправки. Прочитайте `data[0].task_id` и запросите статус обучения через `GET /v1/music/tasks/{task_id}`.
</ResponseField>

<ResponseExample>
  ```json submitted theme={null}
  {
    "code": 200,
    "data": [
      {"status": "submitted", "task_id": "task_01M24YMN4EV04M84R5QYM77R1E"}
    ]
  }
  ```

  ```json completed theme={null}
  {
    "code": 200,
    "data": {
      "id": "task_01M24YMN4EV04M84R5QYM77R1E",
      "status": "completed",
      "progress": 100,
      "result": {
        "model_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "name": "warm folk music model"
      }
    }
  }
  ```
</ResponseExample>

## Использование созданной модели

После завершения сохраните `result.model_id`. В следующих запросах используйте его как `custom_model_id`, исключив `version` и `persona_id`.

```json theme={null}
{
  "model": "suno",
  "custom_model_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "custom": true,
  "instrumental": false,
  "prompt": "[Verse]\nan old wooden guitar plays a new journey",
  "style": "acoustic folk, warm vocals",
  "max_mode": true,
  "audio_format": "mp3"
}
```

Создание модели занимает несколько минут, иногда около 20. Доступность может меняться; не обещайте фиксированный срок. Создание модели и каждая генерация оплачиваются отдельно.
