> ## 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.

# カスタムモデルを作成

> 6～24 件の参照音声から Suno V6 カスタムモデルを作成します

<Info>
  モデル作成は非同期です。送信後、`task_id` でタスクをポーリングし、完了したら `data.result.model_id` からカスタムモデル 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 Key 管理ページ](https://apimart.ai/keys) で API Key を取得してください。
</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>
  公開アクセス可能な音声ファイルの直接 HTTP(S) URL を 6～24 個指定します。MP3、WAV、M4A を推奨します。各 URL はログインページではなく音声ファイルを直接返す必要があります。
</ParamField>

<Warning>
  無効なメディアファイルがあると、モデル作成タスク全体が失敗する場合があります。ローカルファイルは先にアップロードして公開 URL を使用し、ローカルパスや `blob:` URL は送信しないでください。
</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 分かかります。カスタムモデルの利用可能期間は変わる場合があるため、固定の有効期限を案内しないでください。モデル作成と各生成は別々に課金されます。
