# Sample

**What**：Take a snippet from existing music as inspiration to generate new music.

**When**：Use to expand on a melody snippet.

## Endpoints
- POST `/api/cqt/generator/suno` (task: `sample`)
- GET `/api/cqt/info/suno?id={taskId}`

## Request params
| Param | Type | Required | Description |
| --- | --- | --- | --- |
| task | string | Yes | Fixed value: sample |
| model | string | Yes | Model version (v6 recommended) |
| clipId | string | Yes | Source clip ID |
| rangeStartS | number | Yes | Sample start second |
| rangeEndS | number | Yes | Sample end second |
| styleWeight | number(0~1) | — | Style weight; higher sticks closer to tags |
| audioWeight | number(0~1) | — | Original-audio influence weight (for audio-based tasks) |
| weirdnessConstraint | number(0~1) | — | Creativity / weirdness; higher is bolder |
| personaId | string | — | Voice persona ID (sing with a persona) |
| artistClipId | string | — | Reference clip ID for style |

## Request example
```bash
curl -X POST https://api.novapi.ai/api/cqt/generator/suno \
  -H 'Authorization: Bearer <API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{ "task":"sample", "model":"v6", "clipId":"a9f9be49-3ce7-4bd6-b712-ef7009077e7c", "rangeStartS":10, "rangeEndS":20 }'
# -> { "code":200, "data":"<taskId>" }
```

## Response example
```json
{
  "code": 200,
  "msg": "success",
  "data": {
    "id": "9328af0374ef4b969f2466d87422c5bf",
    "taskType": "sample",
    "status": "succeeded",
    "errorMsg": "",
    "param": {
      "task": "sample",
      "model": "chirp-v55",
      "clipId": "a9f9be49-3ce7-4bd6-b712-ef7009077e7c",
      "rangeStartS": 10,
      "rangeEndS": 20
    },
    "result": [
      {
        "id": "6b1a760c-3f38-4fc3-9777-69834eb0ab1b",
        "title": "",
        "handle": "devonpruittaikpe",
        "status": "complete",
        "user_id": "86e4f4a4-7498-45a5-9f5a-1c54513f4b27",
        "metadata": {
          "tags": "",
          "task": "chop_sample_condition",
          "type": "gen",
          "prompt": "",
          "avg_bpm": 91.09,
          "max_bpm": 93.75,
          "min_bpm": 88.24,
          "duration": 78.64,
          "is_remix": true,
          "show_remix": true,
          "make_instrumental": false,
          "uses_latest_model": true
        },
        "audio_url": "https://cdn1.suno.ai/6b1a760c-3f38-4fc3-9777-69834eb0ab1b.mp3",
        "image_url": "https://cdn2.suno.ai/image_6b1a760c-3f38-4fc3-9777-69834eb0ab1b.jpeg",
        "image_large_url": "https://cdn2.suno.ai/image_large_6b1a760c-3f38-4fc3-9777-69834eb0ab1b.jpeg",
        "video_url": "",
        "clip_roots": {
          "clips": [
            { "user_handle": "roselinhobbui3xs", "user_display_name": "roselinhobbui3xs" }
          ],
          "clip_attribution_type": "remix"
        },
        "media_urls": [
          { "url": "https://d2lwuy8qc234o3.cloudfront.net/1/clip/6b1a760c-3f38-4fc3-9777-69834eb0ab1b.m4a", "delivery": "progressive", "content_type": "m4a-opus" },
          { "url": "https://cdn1.suno.ai/6b1a760c-3f38-4fc3-9777-69834eb0ab1b.mp3", "delivery": "progressive", "content_type": "mp3" }
        ],
        "model_name": "chirp-fenix",
        "batch_index": 0,
        "created_at": "2026-07-09T01:39:34.461Z",
        "major_model_version": "v5.5"
      },
      {
        "id": "a097c545-d3ac-43e5-a5df-a3ab7e563f34",
        "title": "",
        "status": "complete",
        "metadata": {
          "task": "chop_sample_condition",
          "type": "gen",
          "avg_bpm": 91.8,
          "duration": 78.04,
          "is_remix": true,
          "show_remix": true
        },
        "audio_url": "https://cdn1.suno.ai/a097c545-d3ac-43e5-a5df-a3ab7e563f34.mp3",
        "image_url": "https://cdn2.suno.ai/image_a097c545-d3ac-43e5-a5df-a3ab7e563f34.jpeg",
        "batch_index": 1,
        "major_model_version": "v5.5"
      }
    ],
    "createTime": "2026-07-09 09:39:29",
    "completeTime": "2026-07-09 09:40:36"
  }
}
```

## Response fields
| Field | Type | Description |
| --- | --- | --- |
| code | number | Status code; 200 = success |
| msg | string | Message |
| data.id | string | Task ID (the taskId returned on submit; used to poll) |
| data.taskType | string | Task type; matches the submitted task |
| data.status | string | Status: pending / succeeded / failed |
| data.errorMsg | string | Failure reason; empty on success |
| data.param | object | Echo of the request params you submitted |
| data.result | array | Results; returns 2 candidate clips |
| data.result[].id | string | The generated clipId; reusable for further extend / cover, etc. |
| data.result[].audio_url | string | Audio file URL (mp3) |
| data.result[].video_url | string | Video file URL (mp4); may be empty, re-query later |
| data.result[].image_url | string | Cover image URL (image_large_url is the large one) |
| data.result[].title | string | Song title |
| data.result[].status | string | Clip status; "complete" = ready to download |
| data.result[].metadata.duration | number | Total audio duration (seconds) |
| data.result[].metadata.tags | string | Style tags |
| data.result[].metadata.task | string | For sample, the clip metadata.task shows "chop_sample_condition" |
| data.result[].metadata.avg_bpm | number | Average tempo in BPM (also max_bpm/min_bpm) |
| data.result[].metadata.is_remix | bool | Whether it is a remix; always true for sample |
| data.result[].clip_roots | object | Source (parent) clip info: title / cover / author |
| data.result[].media_urls | array | Multi-format audio URLs (m4a-opus / mp3) |
| data.result[].batch_index | number | Candidate index (0, 1) |
| data.result[].major_model_version | string | Model version used, e.g. v4.5 / v5.5 |
| data.createTime / completeTime | string | Task submit time / completion time |
| 其它字段 | — | action_config / model_badges / secondary_badges / ownership / avatar_image_url, etc. are for Suno UI and can be ignored |

## OpenAI-style call
This task is also available via `POST /v1/audio/generations` (add `task: "sample"` to the body, write model as suno-v6); poll `GET /v1/audio/generations/{id}`, non-audio results are in `result`.

```bash
curl -X POST https://api.novapi.ai/v1/audio/generations \
  -H 'Authorization: Bearer <API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "suno-v6",
  "task": "sample",
  "clipId": "a9f9be49-3ce7-4bd6-b712-ef7009077e7c",
  "rangeStartS": 10,
  "rangeEndS": 20
}'
# -> { "id":"audio_<taskId>", "object":"audio.generation", "status":"queued", ... }
# poll: GET https://api.novapi.ai/v1/audio/generations/audio_<taskId>
```
